Пример #1
0
import discord, os, time, math, threading, sys, asyncio, server
from discord.ext import commands
from easypydb import DB

dbTOKEN = os.getenv('dbTOKEN')
userDB = DB('userDB', dbTOKEN)
generalDB = DB('generalDB', dbTOKEN)
pfpDB = DB('pfpDB', dbTOKEN)

intents = discord.Intents.default()
intents.messages = True
intents.guilds = True
intents.members = True

client = commands.Bot(command_prefix='=',
                      help_command=None,
                      case_insensitive=True,
                      intents=intents)

#-------------------------------------------------------
#							Status/On Ready
#-------------------------------------------------------


@client.event
async def on_ready():
    print('Good Morning')
    activity = discord.Activity(name='For =help',
                                type=discord.ActivityType.watching)
    await client.change_presence(activity=activity)
    print('In ' + str(len(client.guilds)) + ' servers')
Пример #2
0
import flask, uuid, hashlib, os
from datetime import datetime
from easypydb import DB

dbtoken = os.getenv('dbTOKEN')

userDB = DB('userDB', dbtoken)
todoDB = DB('todoDB', dbtoken)

app = flask.Flask(__name__)
app.secret_key = os.getenv('secretKey')
session = flask.session


def hash_password(password):
    salt = uuid.uuid4().hex
    return hashlib.sha256(salt.encode() +
                          password.encode()).hexdigest() + ':' + salt


def check_password(hashed_password, user_password):
    password, salt = hashed_password.split(':')
    return password == hashlib.sha256(salt.encode() +
                                      user_password.encode()).hexdigest()


@app.route('/')
def main():
    colours = {}
    tasks = []
    completedTasks = False
Пример #3
0
from discord_webhook import DiscordWebhook
from replit import db
import json
import reflux
import base64
import cloudinary
import cloudinary.api
import cloudinary.uploader
import random
import requests
from easypydb import DB
from selenium import webdriver
import threading
from threading import Thread

userdb = DB("users", os.environ['DB_TOKEN'])
userdb.autoload = True
userdb.autosave = True

cloudinary.config(
	cloud_name = os.getenv("CLOUDINARY_CLOUD_NAME"),
	api_key = os.getenv("CLOUDINARY_API_KEY"),
	api_secret = os.getenv("CLOUDINARY_API_SECRET")
)

render = web.template.render('templates/')

urls = (
	'/', 'index',
	'/apiv1', 'apiv1',
	'/apiv2', 'apiv2',
Пример #4
0
import flask, os
from easypydb import DB
from threading import Thread

app = flask.Flask('')

dbTOKEN = os.getenv('dbTOKEN')
userDB = DB('userDB', dbTOKEN)
pfpDB = DB('pfpDB', dbTOKEN)


def commas(i):
    s, i = "", str(i)
    for x in range(len(i) // 3):
        s = "," + i[-3:] + s
        i = i[:-3]
    if i == "": s = s[1:]
    return (i + s)


def ranking():
    scores = []
    users = []
    for i in userDB.data:
        if i != '691576874261807134':
            scores.append(userDB[i]['score'])
    scores.sort(reverse=True)
    for s in scores:
        for u in userDB.data:
            if userDB[u]['score'] == s and u not in users:
                users.append(u)
Пример #5
0
import flask, os, uuid, hashlib, base64, random
from easypydb import DB

app = flask.Flask(__name__)
app.secret_key = os.getenv('secretKey')
session = flask.session

dbToken = os.getenv('dbToken')
loginDB = DB('loginDB', dbToken)
userDB = DB('users', dbToken)


def hash_password(password):
    salt = uuid.uuid4().hex
    return hashlib.sha256(salt.encode() +
                          password.encode()).hexdigest() + ':' + salt


def check_password(hashed_password, user_password):
    password, salt = hashed_password.split(':')
    return password == hashlib.sha256(salt.encode() +
                                      user_password.encode()).hexdigest()


def decode(encoded):
    toString = lambda encoded: ''.join(''.join(encoded.split("b'")[1:]).split(
        "'")[:-1])
    return toString(str(base64.b64decode(toString(encoded).encode())))


@app.route('/')
Пример #6
0
from discord.ext import commands
import random
import os
from dotenv import load_dotenv
import discord
from easypydb import DB

load_dotenv()

dbtoken = os.getenv("dbtoken")
database = DB("EconomyDB", dbtoken)


class Economy(commands.Cog):
    @commands.command()
    @commands.cooldown(1, 60, commands.BucketType.user)
    async def work(self, ctx):
        database.load()
        money = random.randint(25, 100)
        embed = discord.Embed(
            title=f"{ctx.message.author}",
            description=
            f"{ctx.message.author.mention} worked hard and received {money} happy coins!"
        )
        await ctx.send(embed=embed)
        try:
            balance = database[str(ctx.message.author.id)]
        except:
            balance = 0
        database[str(ctx.message.author.id)] = balance + money
Пример #7
0
import discord, os, server, time, datetime, asyncio, math
from discord.ext import commands
from easypydb import DB

intents = discord.Intents.default()
intents.messages = True
intents.guilds = True
intents.members = True

client = commands.Bot(command_prefix="+",
                      case_insensitive=True,
                      help_command=None,
                      intents=intents)

db = DB("db", os.getenv("dbToken"))


def pfp(user):
    try:
        user2 = client.get_user(int(user))
        if user2.is_avatar_animated():
            format = "gif"
        else:
            format = "png"
        pfp = str(user2.avatar_url_as(format=format))
    except AttributeError:
        pfp = None
    return pfp


def timeStrToSeconds(time):