-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
76 lines (54 loc) · 1.73 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
token = os.getenv("TOKEN")
desc = os.getenv("DESC")
path = 'files/tts'
if not os.path.exists(path):
os.makedirs(path)
intents = discord.Intents.default() # discord's permission integer
intents.message_content = True # permission scope
intents.members = True
intents.message_content = True
voicely = commands.Bot(command_prefix=";", description=desc, intents=intents)
@voicely.event
async def on_ready():
print(f"logging on as {voicely.user}")
await load_ext()
@voicely.command()
@commands.is_owner()
async def sync(ctx):
await voicely.tree.sync(guild=ctx.guild)
await voicely.tree.sync()
await ctx.send("syncing to global namespace")
async def load_ext():
for filename in os.listdir("./cogs"): # read cogs folder
if filename.endswith(".py"):
await voicely.load_extension(f"cogs.{filename[:-3]}")
@voicely.command(name="load", hidden=True)
@commands.is_owner()
async def load(ctx, mycog):
try:
await voicely.load_extension(f"cogs.{mycog}")
await ctx.send(f"loaded {mycog}")
except:
await ctx.send("something went wrong")
@voicely.command(name="unload", hidden=True)
@commands.is_owner()
async def unload(ctx, mycog):
try:
await voicely.unload_extension(f"cogs.{mycog}")
await ctx.send(f"unloaded {mycog}")
except:
await ctx.send("something went wrong")
@voicely.command(name="reload", hidden=True)
@commands.is_owner()
async def rel(ctx, mycog):
try:
await voicely.reload_extension(f"cogs.{mycog}")
await ctx.send(f"reloading {mycog}")
except:
await ctx.send("something went wrong")
voicely.run(token)