-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
32 lines (25 loc) · 987 Bytes
/
Copy pathbot.py
File metadata and controls
32 lines (25 loc) · 987 Bytes
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
import sys
sys.path.append("")
import discord
from discord.ext import commands
from config import Config
class Timestamper(commands.Bot):
def __init__(self):
super().__init__(
command_prefix=Config.PREFIX,
intents=discord.Intents.default(),
application_id=Config.APPLICATION_ID
)
self.initial_extensions = ["timestamp"]
async def setup_hook(self) -> None:
for ext in self.initial_extensions:
await self.load_extension(ext)
async def on_ready(self):
print(f"{self.user} has connected to discord", flush=True)
async def on_message(self, message: discord.Message) -> None:
if(message.content == f"{Config.PREFIX}sync" and message.author.id == Config.OWNER):
synced = await bot.tree.sync()
await message.channel.send(f"Synced {len(synced)} commands globally")
if __name__ == "__main__":
bot = Timestamper()
bot.run(Config.BOT_TOKEN)