-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
76 lines (66 loc) · 2.15 KB
/
bot.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 discord
from discord.ext import commands
import os
from dotenv import load_dotenv
from dotenv import load_dotenv
from os import getenv
import typing
import traceback
import sys
load_dotenv()
token = getenv("TOKEN")
description = "TourmalineBot - Made by dhoru#7700"
bot = commands.Bot(command_prefix="t.", description=description, intents=discord.Intents.all())
bot.remove_command('help')
#bot.load_extension("cogs.mainCommands")
#bot.load_extension("cogs.ownerCommands")
#bot.load_extension("cogs.helpMe")
#bot.load_extension("cogs.miscCommands")
bot.load_extension("cogs.betaCmd")
@bot.command()
@commands.guild_only()
@commands.is_owner()
async def sync(
ctx: commands.Context, guilds: commands.Greedy[discord.Object], spec: typing.Optional[typing.Literal["~", "*", "^"]] = None) -> None:
if not guilds:
if spec == "~":
synced = await ctx.bot.tree.sync(guild=ctx.guild)
elif spec == "*":
ctx.bot.tree.copy_global_to(guild=ctx.guild)
synced = await ctx.bot.tree.sync(guild=ctx.guild)
elif spec == "^":
ctx.bot.tree.clear_commands(guild=ctx.guild)
await ctx.bot.tree.sync(guild=ctx.guild)
synced = []
else:
synced = await ctx.bot.tree.sync()
await ctx.send(
f"Synced {len(synced)} commands {'globally' if spec is None else 'to the current guild.'}"
)
return
ret = 0
for guild in guilds:
try:
await ctx.bot.tree.sync(guild=guild)
except discord.HTTPException:
pass
else:
ret += 1
await ctx.send(f"Synced the tree to {ret}/{len(guilds)}.")
@bot.event
async def on_ready():
activity = discord.Game(name="Dhoru is Epic | t.help", type=3)
await bot.change_presence(status=discord.Status.online, activity=activity)
botUserName = bot.user.name
botUserId = bot.user.id
initMessage = '''
--------
Bot is ready!
Logged in as:
{}
{}
--------
'''
initMessage = initMessage.format(botUserName, botUserId)
print(initMessage)
bot.run(token)