-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
56 lines (44 loc) · 1.86 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
from datetime import datetime
import discord
from modules.firebase import create_firebase_app
from modules.versionChecker import VersionChecker
from options import token, debugmode, version, gearsList, firebase_id
create_firebase_app(firebase_id)
# Define intents for the bot to receive all available events
intents = discord.Intents.all()
intents.presences = True
intents.members = True
intents.messages = True
# Create the Discord bot instance with specified intents
bot = discord.Bot(case_insensitive=True, intents=intents)
VersionChecker(bot)
# Gears are always cool
# Event that runs when the bot is ready and connected to Discord
@bot.event
async def on_ready():
# Print bot information and connected guilds
print("------")
print(f"Текущее время: {datetime.now()}")
print(f"{bot.user.name} запущен!")
print(f"Версия: {version}")
print(f"ID бота: {str(bot.user.id)}")
for guild in bot.guilds:
print(f"Подключились к серверу: {guild}")
print("------")
# Set bot status and activity based on debug mode
if debugmode == "ON":
status = discord.Status.dnd
activity = discord.Activity(type=discord.ActivityType.playing, name=f"debug-режиме (v{version})")
else:
status = discord.Status.online
activity = discord.Activity(type=discord.ActivityType.listening, name=f"обиды участников (v{version})")
await bot.change_presence(status=status, activity=activity)
for module_name in gearsList:
try:
bot.load_extension(f'gears.{module_name}')
print(f"Загружен общий модуль '{module_name}'")
except Exception as e:
print(f"Не удалось загрузить общий модуль '{module_name}': {str(e)}")
# Run the bot with the provided token
if __name__ == "__main__":
bot.run(token)