-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.py
47 lines (37 loc) · 1.29 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
import nextcord
from nextcord.ext import commands
import utils.settings as settings
import os
from utils.translations import translator
from utils.errorhandling import handle_errors, setup_logging
import utils.constants as constants
setup_logging()
intents = nextcord.Intents.all()
bot = commands.Bot(
command_prefix=settings.bot_prefix, intents=intents, help_command=None
)
translator.set_language(settings.bot_language)
@bot.event
async def on_ready():
print(constants.PALBOT_ART)
print(f"Connected to {len(bot.guilds)} servers with {len(bot.users)} users.")
print(f"Invite link: {nextcord.utils.oauth_url(bot.user.id)}")
print(f"{bot.user} is ready! Created by koz")
bot.loop.create_task(settings.run_whitelist_check(bot))
activity = nextcord.Activity(
type=nextcord.ActivityType.playing, name=settings.bot_activity
)
await bot.change_presence(activity=activity)
@bot.event
async def on_guild_join(guild):
await settings.check_whitelist(bot)
# Error Handling
@bot.event
async def on_application_command_error(interaction, error):
await handle_errors(interaction, error)
@bot.command()
async def ping(ctx):
await ctx.send(f"Pong! {round(bot.latency * 1000)}ms")
settings.load_cogs(bot)
if __name__ == "__main__":
bot.run(settings.bot_token)