-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEvos.py
64 lines (55 loc) · 2.22 KB
/
Evos.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#MIT License
#Copyright (c) 2020 Semih Aydın
#UTF-8
import discord
from discord.ext import commands
import pyfiglet
import sqlite3
import json
import os
from logging_files.evos_log import logger
intents = discord.Intents.default()
intents.members = True
modules = 0
loaded = 0
defaultPrefix = '.'
def get_prefix(client,message):
db = sqlite3.connect("data/server/Data.db")
cursor = db.cursor()
try :
cursor.execute("SELECT CUSTOM_PREFIX FROM ServerData WHERE SERVER_ID=?",(str(message.guild.id),))
customPrefix = cursor.fetchone()
return customPrefix[0]
except Exception as e:
logger.error(f"{client.user.name} | GetPrefix | Error: {e}")
return defaultPrefix
def get_token():
with open("data/Token.json", "r") as tokenJsonFile:
data = json.load(tokenJsonFile)
token = data["token"]
return token
def get_version_number():
with open("package.json", "r") as packageJsonFile:
data = json.load(packageJsonFile)
versionNumber = data["version"]
return versionNumber
client = commands.Bot(command_prefix=get_prefix,intents=intents)
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online, activity=discord.Activity(type=discord.ActivityType.watching, name=f".yardım | .help | v{get_version_number()}"))
print(pyfiglet.figlet_format(f"{client.user.name} | v{get_version_number()}"))
logger.info(f"{client.user.name} is ready.")
print("Modül yükleme işlemi başladı.")
for filename in os.listdir('cogs'):
if filename.endswith('.py'):
modules += 1
try :
client.load_extension(f'cogs.{filename[:-3]}')
print(f"\t{filename[:-3]} yüklendi.")
loaded += 1
except Exception as e:
logger.error(f"{client.user.name} | LoadModule | File: {filename[:-3]} | Error: {e}")
print(f"\t{filename[:-3]} yüklenemedi.")
print(f"\t--------------------------\n\tToplam Eklenti: \t{modules}\n\tYüklenen Eklenti: \t{loaded}\n\tYüklenemeyen Eklenti: \t{modules-loaded}\n\t--------------------------")
print("Modül yükleme işlemi tamamlandı.")
client.run(get_token(), reconnect=True)