-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
36 lines (31 loc) · 1017 Bytes
/
Copy pathbot.py
File metadata and controls
36 lines (31 loc) · 1017 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
33
34
35
36
import discord
import json
import os
import asyncio
from discord.ext import commands
from discord import Intents
# Get config.json
with open("config.json", "r") as config:
data = json.load(config)
prefix = data["prefix"]
# Define the activity then create the bot client
activity = discord.Activity(name=f'for {prefix}help', type=discord.ActivityType.watching)
bot = commands.Bot(prefix, intents=Intents.all(), activity=activity)
# Once ready, print out that it is ready
@bot.event
async def on_ready():
print(f"We have logged in as {bot.user}")
print(discord.__version__)
async def main():
async with bot:
bot.remove_command("help")
try:
print("Logging in...")
for file in os.listdir("cogs"):
if file.endswith(".py"):
name = file[:-3]
await bot.load_extension(f"cogs.{name}")
await bot.start(data['token'])
except KeyboardInterrupt:
bot.close()
asyncio.run(main())