-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.py
88 lines (71 loc) · 3.97 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
import discord
import os
from colorama import Fore
from discord.ext import commands
from dotenv import load_dotenv
import asyncio
load_dotenv()
intents = discord.Intents.default()
intents.message_content = True
client = commands.Bot(command_prefix="*", activity=discord.Game(name="I'm in fucking alpha don't expect much"),
intents=intents)
client.remove_command('help')
async def main():
async with client:
async def load_extensions():
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
# cut off the .py from the file name
await client.load_extension(f"cogs.{filename[:-3]}")
@client.event
async def on_ready():
# init sequence, only print statements allowed
print("===== BOT INITILIZATION =====")
print(Fore.GREEN, '{0.user} standing by'.format(client), Fore.RESET)
print("===== SERVERS LOADED =====")
print(Fore.BLUE, '\n'.join(guild.name for guild in client.guilds), Fore.RESET)
print("===== MODULES LOADED =====", Fore.YELLOW)
@client.command()
async def sourcehelp(ctx):
embed = discord.Embed(title="__Source Code__", color=0x4287f5)
embed.add_field(name="Source code available on github", value="https://github.com/Soulsender/Earth-Invader",
inline=False)
await ctx.send(embed=embed)
# cryptography help menu
@client.command()
async def help(ctx):
embed = discord.Embed(title="Codex Bot", color=0x2b2a2a)
embed.url = 'https://github.com/Soulsender/Codex-Bot'
embed.set_author(name='Soulsender#3162', url='https://soulsender.github.io')
embed.description = 'Basic Cryptography Commands'
embed.add_field(name="Base64", value="`b64 {encode/e & decode/d} {\"string\"}`\n"
"Encoding and decoding from base64.", inline=False)
embed.add_field(name="133T 5P34K", value="`leet {encode/e & decode/d} {\"string\"}`\n"
"Encoding and decoding from 133T 5P34K (Leet Speak).", inline=False)
embed.add_field(name="Hex", value="`hex {encode/e & decode/d} {\"string\"}`\n"
"Encoding and decoding from Hex.", inline=False)
embed.add_field(name="Caesar Cipher", value="`cc {encode/e & decode/d} {\"string\"} {key 1}`\n"
"Encoding and decoding with Caesar Cipher. *Requires a Key as an integer.*",
inline=False)
embed.add_field(name="Rot47", value="`r47 {encode/e & decode/d} {\"string\"}`\n"
"Encoding and decoding with Rotation 47.", inline=False)
embed.add_field(name="Rot13", value="`r13 {encode/e & decode/d} {\"string\"}`\n"
"Encoding and decoding with Rotation 13.", inline=False)
embed.add_field(name="Binary", value="`bin {encode/e & decode/d} {\"string\"}`\n"
"Encoding and decoding with binary.", inline=False)
embed.set_footer(text='Created by Soulsender. See the wiki for documentation.')
await ctx.send(embed=embed)
# mimic
@client.command()
@commands.has_role('Bot Admin') # Checks for Administrator rank.
async def m(ctx, *, question):
await ctx.message.delete()
await ctx.send(f'{question}')
@client.command()
async def servers(ctx):
servers = list(client.guilds)
await ctx.send(f"Connected on {str(len(servers))} servers:")
await ctx.send('\n'.join(guild.name for guild in client.guilds))
await load_extensions()
await client.start(str(os.getenv('TOKEN')))
asyncio.run(main())