-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
42 lines (37 loc) · 1.22 KB
/
Copy pathmain.py
File metadata and controls
42 lines (37 loc) · 1.22 KB
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
import asyncio
import os
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from discord.ext.commands import errors
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(
command_prefix="~",
activity=discord.Game(name="木貓"),
description="由某白夜和綠鷹精心為木貓打造的機器人~awa",
intents=intents)
slash = SlashCommand(client, sync_commands=True, sync_on_cog_reload=True)
from dotenv import load_dotenv
load_dotenv()
@client.command(name="reload")
async def reload(ctx):
await ctx.message.delete()
for file in os.listdir("./cogs"):
if not file.endswith(".py"):
for fileName in os.listdir(f"./cogs/{file}"):
if fileName.endswith(".py"):
if fileName not in ["osu.py"]:
try:
client.unload_extension(f"cogs.{file}.{fileName[:-3]}")
except:
pass
client.load_extension(f"cogs.{file}.{fileName[:-3]}")
await ctx.send("成功!! (ノ◕ヮ◕)ノ*.✧")
for file in os.listdir("./cogs"):
if not file.endswith(".py"):
for fileName in os.listdir(f"./cogs/{file}"):
if fileName.endswith(".py"):
client.load_extension(f"cogs.{file}.{fileName[:-3]}")
if __name__ == "__main__":
client.run(os.getenv("token"))