This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.py
63 lines (47 loc) · 1.81 KB
/
start.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
#!/usr/bin/env python
# coding=utf-8
import discord
import time
import asyncio
import json
from signal import SIGTERM
from discord.ext import commands
class COBot(commands.bot.BotBase, discord.Client):
def __init__(self, command_prefix=None, case_insensitive=None, status=None, database_online=True, beta=False, dbl_token=""):
super().__init__(command_prefix=command_prefix,
case_insensitive=case_insensitive, status=status)
async def get_prefix(self, msg):
return get_prefix(self, msg)
def get_prefix(bot, msg):
return commands.when_mentioned_or("^")(bot, msg)
def main():
client = COBot(command_prefix=get_prefix, case_insensitive=True)
client.load_extension("cogs.admin")
client.load_extension("cogs.vote")
client.load_extension("cogs.configManager")
client.load_extension("cogs.giveaways")
async def on_ready():
print('\nBot connecté')
print("Nom : "+client.user.name)
print("ID : "+str(client.user.id))
if len(client.guilds) < 200:
serveurs = [x.name for x in client.guilds]
print(
"Connecté sur ["+str(len(client.guilds))+"] "+", ".join(serveurs))
else:
print("Connecté sur "+str(len(client.guilds))+" serveurs")
print(time.strftime("%d/%m %H:%M:%S"))
print('------')
await asyncio.sleep(2)
async def check_once(ctx):
try:
return ctx.guild != None and ctx.guild.id in [719527687000948797]
except Exception as e:
ctx.bot.log.error("ERROR on global_check:", e, ctx.guild)
return True
client.add_listener(on_ready)
with open("config.json", "r", encoding="utf8") as f:
data = json.load(f)
client.run(data['bot_token'])
if __name__ == "__main__":
main()