-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
48 lines (36 loc) · 1.02 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
from discord.ext import commands
import discord
import os
import asyncio
import keep_alive
intents = discord.Intents.all()
intents.members = True
bot = commands.Bot(
command_prefix = "!",
intents = intents
)
@bot.event
async def on_ready():
print(f"目前登入身份 --> {bot.user}")
@bot.command()
async def load(ctx, extensions):
bot.load_extension(f"cmds.{extensions}")
await ctx.send(f"Load {extensions}")
@bot.command()
async def unload(ctx, extensions):
bot.unload_extension(f"cmds.{extensions}")
await ctx.send(f"Unload {extensions}")
async def load_extensions():
for filename in os.listdir('./cmds'):
if filename.endswith('.py'):
await bot.load_extension(f"cmds.{filename[:-3]}")
async def main():
async with bot:
await load_extensions()
# can use json to change the text
await bot.start('Your Discord Bot Token')
if __name__ == '__main__':
keep_alive.keep_alive()
asyncio.run(main())
# can use json to change the text
bot.run('Your Discord Bot Token')