-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
109 lines (97 loc) · 4.01 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# modules
import os
import discord
from discord.errors import InvalidArgument
from discord.ext import commands
from discord.ext.commands import *
from keep_alive import keep_alive
# end of modules
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='.', intents=intents)
owner = ["αrchιshα#5518", "notsniped#4573", "thatOneArchUser#5794"]
oid = [706697300872921088, 738290097170153472, 705462972415213588]
bot.remove_command('help')
# when ready
@bot.event
async def on_ready():
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
print(f'\n> {bot.user} HAS CONNECTED TO DISCORD.\n\n>')
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.playing, name=f"Visual Studio Code"))
print(f'[log] Log is loading...')
print(f'[log] {bot.user} changed its activity.')
#@bot.event
#async def on_guild_join(guild):
# await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"codes"))
# print(f'[log] {bot.user} changed its activity.')
#@bot.event
#async def on_guild_remove(guild):
# await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"codes"))
# print(f'[log] {bot.user} changed its activity.')
# end of startup
@bot.command()
async def help(ctx):
embed = discord.Embed(title='help command', description='my prefix is `.`', color=discord.Color.red())
embed.add_field(name='commands:', value='--------------------', inline=False)
embed.add_field(name='`.evaluate`', value='aliases: `.eval`, `.e`\ndescription: this command runs your Python code\nusage: `.evaluate [python_code]`\n...', inline=False)
embed.add_field(name='`.cexecute`', value='aliases: `.cexec`, `.c`\ndescription: this command runs your C code\nusage: `.cexecute [c_code]`\n...', inline=False)
embed.add_field(name='blocked words:', value='--------------------', inline=False)
embed.add_field(name='words below has been banned for security reasons', value="`'while', 'quit', 'exit', 'SystemExit', 'open', '.delete()', 'os', 'subprocess', 'history()', '(\"token\")', '('token')'`", inline=False)
await ctx.reply(embed=embed)
@bot.command()
async def load(ctx, *, arg1):
if ctx.message.author.id in oid:
pass
else:
await ctx.reply(f"You can\'t use this command")
print(f"[Cog] {ctx.author} returned an error: User Missing Permission.")
return
try:
bot.load_extension(f'cogs.{arg1}')
await ctx.send("Loaded Cog")
print(f"[Cog] {ctx.author} loaded cog.")
return
except Exception as e:
await ctx.send(e)
print(f"[Cog] An unexpected error has occurred: {e}")
@bot.command()
async def unload(ctx, *, arg1):
if ctx.message.author.id in oid:
pass
else:
await ctx.reply(f"You can\'t use this command")
print(f"[Cog] {ctx.author} returned an error: User Missing Permission.")
return
try:
bot.unload_extension(f'cogs.{arg1}')
await ctx.send("Unloaded Cog")
print(f"[Cog] {ctx.author} unloaded cog.")
return
except Exception as e:
await ctx.send(e)
print(f"[Cog] An unexpected error has occurred: {e}")
@bot.command()
async def reload(ctx, *, arg1):
if ctx.message.author.id in oid:
pass
else:
await ctx.reply(f"You can\'t use this command")
print(f"[Cog] {ctx.author} returned an error: User Missing Permission.")
return
try:
bot.unload_extension(f'cogs.{arg1}')
bot.load_extension(f'cogs.{arg1}')
await ctx.send("Reloaded Cog")
print(f"[log] {ctx.author} reloaded cog.")
return
except Exception as e:
await ctx.send(e)
print(f"[Cog] An unexpected error has occurred: {e}")
bot.load_extension("cogs.cexec")
bot.load_extension("cogs.eval")
bot.load_extension("cogs.q")
keep_alive()
bot.run('token')
# btw i use arch