-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
76 lines (60 loc) · 1.96 KB
/
main.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
65
66
67
68
69
70
71
72
73
74
75
76
import aiohttp
import config
from datetime import datetime
import aiosqlite
from BotBase import BotBaseBot
import nextcord
cogs = [
"cogs.Fun.animals",
# "cogs.misc.afk",
"jishaku",
"cogs.misc.emote",
"cogs.Fun.activities",
"cogs.misc.crosstalk",
"cogs.owner.guild_logger"
]
bot = BotBaseBot(
command_prefix=config.prefix,
intents=nextcord.Intents.all(),
status=nextcord.Status.online,
activity=nextcord.Game(name="Playing nothing."),
help_command=None,
owner_ids=config.owners,
)
@bot.command(name="help")
async def help(ctx):
return await ctx.send("Soon.")
@bot.event
async def on_ready():
print(f"Logged in as {bot.user} at {datetime.now()}!")
async def my_startup_function():
# cogs
for extension in cogs:
try:
bot.load_extension(extension)
print(f"Successfully loaded extension {extension}")
except Exception as e:
exc = f"{type(e).__name__,}: {e}"
print(f"Failed to load extension {extension}\n{exc}")
# bot vars
bot.prefix = config.prefix
bot.owner_id = config.owner_id
bot.appeal_server_invite = config.appeal_server_invite
bot.main_server_invite = config.main_server_invite
bot.afk_ignored_channels = []
bot.session = aiohttp.ClientSession()
bot.listening_channels = config.crosstalk
bot.kucoin_api_key = config.kucoin_api_key
bot.kucoin_api_secret = config.kucoin_api_secret
bot.kucoin_api_passphrase = config.kucoin_api_passphrase
bot.wait_until_ready()
bot.home_server = bot.get_guild(int(config.home_server))
bot.guild_logger = await bot.fetch_channel(config.guild_logger)
bot.message_logger = await bot.fetch_channel(config.message_logger)
# dbs
bot.db = await aiosqlite.connect("dbs/db.sqlite3")
await bot.db.execute(
"CREATE TABLE IF NOT EXISTS afk (id bigint PRIMARY KEY, msg str)"
)
bot.loop.create_task(my_startup_function())
bot.run(config.token)