forked from astroid-app/api-main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
37 lines (28 loc) · 1.04 KB
/
init.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
import traceback
import nextcord
from nextcord.ext import commands
import config
import asyncio
import os
client = commands.Bot(command_prefix=".", intents=nextcord.Intents.all())
@client.event
async def on_ready():
for filename in os.listdir('cogs'):
if filename.endswith('.py'):
try:
client.load_extension(f'cogs.{filename[:-3]}')
except:
traceback.print_exc()
client.loop.create_task(change_presence())
client.loop.create_task(sync_commands())
async def sync_commands():
while True:
await client.sync_application_commands()
await asyncio.sleep(1)
async def change_presence():
await client.change_presence(
activity=nextcord.Activity(type=nextcord.ActivityType.watching, name="Your Guilded Server"))
await asyncio.sleep(30)
await client.change_presence(activity=nextcord.Activity(type=nextcord.ActivityType.watching, name="Guildcord API"))
await asyncio.sleep(30)
client.run(config.DISCORD_TOKEN)