-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (29 loc) · 1.12 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
import discord, json, os, asyncio, time
from datetime import datetime,timezone,timedelta
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents.all()
with open('./data/config.json','r',encoding='utf8') as config_file:
config=json.load(config_file)
bot = commands.Bot(command_prefix= config['prefix'],owner_id=int(os.getenv("Owner")),intents=intents,strip_after_prefix=False)
@bot.event
async def on_ready():
await bot.tree.sync()
print(f">> {bot.user.name} is online <<")
t=time.localtime(time.time())
print(f">>現在時間 {datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(timezone(timedelta(hours=8)))}")
async def Cog_load():
for filename in os.listdir('./cmds'):
if filename.endswith('.py'):
print(f"Cog_load {filename[:-3]}")
await bot.load_extension(f'cmds.{filename[:-3]}')
"""for filename in os.listdir("./txts"):
if(filename.endswith('.py')):
print(f"Cog_load {filename[:-3]}")
await bot.load_extension(f"txts.{filename[:-3]}")
"""
async def main():
await Cog_load()
await bot.start(os.getenv("Token"))
asyncio.run(main())