Skip to content

Commit f6c60bf

Browse files
committed
Redesigned help command
Signed-off-by: ColaIan <colaian.yt@gmail.com>
1 parent cd4f8b2 commit f6c60bf

File tree

10 files changed

+83
-47
lines changed

10 files changed

+83
-47
lines changed

Teapot.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,17 @@
5353
time_start = time.perf_counter()
5454
database = teapot.managers.database.__init__()
5555
db = teapot.managers.database.db(database)
56-
db.execute('CREATE TABLE IF NOT EXISTS `guilds` (`guild_id` BIGINT, `guild_name` TINYTEXT)')
57-
db.execute('CREATE TABLE IF NOT EXISTS `channels` (`channel_id` BIGINT, `channel_name` TINYTEXT)')
58-
db.execute("CREATE TABLE IF NOT EXISTS `users` (`user_id` BIGINT, `user_name` TINYTEXT, `user_discriminator` INT)")
59-
db.execute("CREATE TABLE IF NOT EXISTS `bot_logs` (`timestamp` TEXT, `type` TINYTEXT, `class` TINYTEXT, `message` "
60-
"MEDIUMTEXT)")
56+
db.execute('ALTER DATABASE teapot CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci')
57+
db.execute(
58+
'CREATE TABLE IF NOT EXISTS `guilds` (`guild_id` BIGINT, `guild_name` TINYTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci')
59+
db.execute(
60+
'CREATE TABLE IF NOT EXISTS `channels` (`channel_id` BIGINT, `channel_name` TINYTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci')
61+
db.execute(
62+
"CREATE TABLE IF NOT EXISTS `users` (`user_id` BIGINT, `user_name` TINYTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, `user_discriminator` INT) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci")
63+
db.execute(
64+
"CREATE TABLE IF NOT EXISTS `bot_logs` (`timestamp` TEXT, `type` TINYTEXT, `class` TINYTEXT, `message` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci")
6165
teapot.managers.database.create_table(
62-
"CREATE TABLE IF NOT EXISTS `guild_logs` (`timestamp` TEXT, `guild_id` BIGINT, `channel_id` BIGINT, "
63-
"`message_id` BIGINT, `user_id` BIGINT, `action_type` TINYTEXT, `message` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci)")
66+
"CREATE TABLE IF NOT EXISTS `guild_logs` (`timestamp` TEXT, `guild_id` BIGINT, `channel_id` BIGINT, `message_id` BIGINT, `user_id` BIGINT, `action_type` TINYTEXT, `message` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci")
6467

6568
print(
6669
f"Connected to database ({teapot.config.db_host()}:{teapot.config.db_port()}) in {round(time.perf_counter() - time_start, 2)}s")

teapot/cogs/cat.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class Cat(commands.Cog):
12-
""" Cat Module"""
12+
""" Cat and dog command"""
1313

1414
def __init__(self, bot):
1515
""" Initialize Cat Class"""
@@ -18,7 +18,7 @@ def __init__(self, bot):
1818

1919
@commands.command(pass_context=True, aliases=['meow'])
2020
async def cat(self, ctx):
21-
""" When User Types ~meow, return a cat link """
21+
""" Get a cat image """
2222
req = requests.get('https://api.thecatapi.com/v1/images/search')
2323
if req.status_code != 200:
2424
print("Could not get a meow")
@@ -30,6 +30,7 @@ async def cat(self, ctx):
3030

3131
@commands.command(pass_context=True, aliases=['woof'])
3232
async def dog(self, ctx):
33+
""" Get a dog image """
3334
req = requests.get('http://random.dog/')
3435
if req.status_code != 200:
3536
print("Could not get a woof")

teapot/cogs/cmds.py

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,53 @@ def helpcmd(bot):
1919
bot.remove_command('help')
2020

2121
@bot.command(aliases=['?'])
22-
async def help(ctx):
23-
embed = discord.Embed(title="Command List", description="List of commands that you can use",
24-
color=0x7400FF)
25-
embed.set_author(name=f"Teapot.py {teapot.version()}",
26-
icon_url="https://cdn.discordapp.com/avatars/612634758744113182/7fe078b5ea6b43000dfb7964e3e4d21d.png?size=512")
27-
embed.set_thumbnail(url="https://avatars2.githubusercontent.com/u/60006969?s=200&v=4")
28-
embed.add_field(name="General", value="``help``, ``info``", inline=False)
29-
embed.add_field(name="Music",
30-
value="``play``, ``pause``, ``resume``, ``stop``, ``repeat``, ``seek``, ``skip``, ``remove``, ``now``, ``queue``, ``volume``, ``shuffle``, ``find``, ``disconnect``",
31-
inline=False)
32-
embed.add_field(name="Tools", value="``github``, ``osu``", inline=False)
33-
embed.add_field(name="Fun", value="``cat``, ``dog``, ``neko``, ``hentai [NSFW]``", inline=False)
34-
embed.add_field(name="Staff", value="``purge``, ``ping``, ``kick``, ``ban``", inline=False)
35-
embed.add_field(name="Links",
36-
value="[Support Discord](https://discord.gg/7BRGs6F) | [Add bot to server](https://discordapp.com/api/oauth2/authorize?client_id=669880564270104586&permissions=0&scope=bot) | [Repository](https://github.com/RedCokeDevelopment/Teapot.py)",
37-
inline=False)
38-
39-
embed.set_image(
40-
url="https://user-images.githubusercontent.com/43201383/72987537-89830a80-3e25-11ea-95ef-ecfa0afcff7e.png")
41-
embed.set_footer(text=f"{teapot.copyright()} | Code licensed under the MIT License")
42-
await ctx.send(embed=embed)
22+
async def help(ctx, *cog):
23+
if not cog:
24+
embed = discord.Embed(description="📖 Help", color=0x7400FF,
25+
icon_url="https://cdn.discordapp.com/avatars/612634758744113182/7fe078b5ea6b43000dfb7964e3e4d21d.png?size=512")
26+
embed.set_thumbnail(url="https://avatars2.githubusercontent.com/u/60006969?s=200&v=4")
27+
cogs_desc = ""
28+
for x in bot.cogs:
29+
cogs_desc += f'**{x}** - {bot.cogs[x].__doc__}\n'
30+
embed.add_field(name='Modules', value=cogs_desc[0:len(cogs_desc) - 1])
31+
embed.set_footer(text=f"{teapot.copyright()} | Code licensed under the MIT License")
32+
await ctx.send(embed=embed)
33+
await ctx.message.add_reaction(emoji='✅')
34+
else:
35+
if len(cog) > 1:
36+
await ctx.send(embed=teapot.messages.toomanyarguments())
37+
await ctx.message.add_reaction(emoji='🛑')
38+
else:
39+
found = False
40+
for x in bot.cogs:
41+
for y in cog:
42+
if x == y:
43+
embed = discord.Embed(color=0x7400FF)
44+
cog_info = ''
45+
for c in bot.get_cog(y).get_commands():
46+
if not c.hidden:
47+
cog_info += f"**{c.name}** - {c.help}\n"
48+
embed.add_field(name=f"{cog[0]} Module", value=cog_info)
49+
await ctx.send(embed=embed)
50+
await ctx.message.add_reaction(emoji='✅')
51+
found = True
52+
if not found:
53+
for x in bot.cogs:
54+
for c in bot.get_cog(x).get_commands():
55+
if c.name.lower() == cog[0].lower():
56+
embed = discord.Embed(title=f"Command: {c.name.lower().capitalize()}",
57+
description=f"**Description:** {c.help}\n**Syntax:** {c.qualified_name} {c.signature}",
58+
color=0x7400FF)
59+
embed.set_author(name=f"Teapot.py {teapot.version()}",
60+
icon_url="https://cdn.discordapp.com/avatars/612634758744113182/7fe078b5ea6b43000dfb7964e3e4d21d.png?size=512")
61+
await ctx.message.add_reaction(emoji='✅')
62+
found = True
63+
if not found:
64+
embed = teapot.messages.notfound("Module")
65+
await ctx.message.add_reaction(emoji='🛑')
66+
await ctx.send(embed=embed)
67+
else:
68+
await ctx.message.add_reaction(emoji='✅')
4369

4470

4571
def info(bot):
@@ -61,6 +87,9 @@ async def info(ctx):
6187
embed.add_field(name="Bug Report:", value="[Issues](https://github.com/RedCokeDevelopment/Teapot.py/issues)",
6288
inline=True)
6389
embed.add_field(name="Discussion:", value="[Forums](https://forum.redtea.red)", inline=True)
90+
embed.add_field(name="Links",
91+
value="[Support Discord](https://discord.gg/7BRGs6F) | [Add bot to server](https://discordapp.com/oauth2/authorize?client_id=669880564270104586&permissions=8&scope=bot) | [Repository](https://github.com/RedCokeDevelopment/Teapot.py)",
92+
inline=False)
6493
embed.set_footer(text=f"{teapot.copyright()} | Code licensed under the MIT License")
6594
embed.set_image(
6695
url="https://user-images.githubusercontent.com/43201383/72987537-89830a80-3e25-11ea-95ef-ecfa0afcff7e.png")

teapot/cogs/github.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def __init__(self, bot):
1616

1717
@commands.command(pass_context=True, aliases=['gh'])
1818
async def github(self, ctx, arg):
19+
"""Fetch repository info"""
1920
req = requests.get(f'https://api.github.com/repos/{arg}')
2021
apijson = json.loads(req.text)
2122
if req.status_code == 200:

teapot/cogs/music.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212

1313
class Music(commands.Cog):
14+
"""Music Time"""
15+
1416
def __init__(self, bot):
1517
self.bot = bot
1618

teapot/cogs/neko.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Module for generating a random cat picture"""
1+
""" Module for generating random neko pictures"""
22
import io
33
import json
44

@@ -12,10 +12,10 @@
1212

1313

1414
class Neko(commands.Cog):
15-
""" Cat Module"""
15+
"""Neko!!! :3"""
1616

1717
def __init__(self, bot):
18-
""" Initialize Cat Class"""
18+
""" Initialize neko class"""
1919

2020
self.bot = bot
2121

@@ -51,10 +51,6 @@ async def wallpaper(self, ctx):
5151
async def tickle(self, ctx):
5252
await ctx.send(embed=self.neko_api(ctx, "tickle"))
5353

54-
@commands.command(pass_context=True)
55-
async def ngif(self, ctx):
56-
await ctx.send(embed=self.neko_api(ctx, "ngif"))
57-
5854
@commands.command(pass_context=True)
5955
async def poke(self, ctx):
6056
await ctx.send(embed=self.neko_api(ctx, "poke"))
@@ -90,7 +86,7 @@ async def gox_girl(self, ctx):
9086
@commands.command(pass_context=True)
9187
async def hentai(self, ctx, type=""):
9288
if ctx.message.channel.nsfw:
93-
api_types = ['femdom', 'classic', 'erofeet', 'erok', 'les',
89+
api_types = ['femdom', 'classic', 'ngif', 'erofeet', 'erok', 'les',
9490
'hololewd', 'lewdk', 'keta', 'feetg', 'nsfw_neko_gif', 'eroyuri',
9591
'tits', 'pussy_jpg', 'cum_jpg', 'pussy', 'lewdkemo', 'lewd', 'cum', 'spank',
9692
'smallboobs', 'Random_hentai_gif', 'nsfw_avatar', 'hug', 'gecg', 'boobs', 'pat',

teapot/cogs/osu.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ def display(self, author):
4646

4747

4848
class Osu(commands.Cog):
49+
"""Osu! Statistics"""
50+
4951
def __init__(self, bot):
5052
self.bot = bot
5153

5254
@commands.command(pass_context=True, no_pm=True)
5355
async def osu(self, ctx, *, args: str):
54-
"""
55-
Look up an osu player:
56-
Usage: osu [UserID/Username]
57-
"""
56+
""" Look up an osu player """
5857

5958
args_array = args.split(' ')
6059
if len(args_array) == 2:

teapot/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async def on_raw_message_edit(ctx):
9999
except Exception as e:
100100
print(e)
101101
except:
102-
content = str(json.loads(json.dumps(ctx.data))['embeds'][0])
102+
content = str(json.loads(json.dumps(ctx.data))['embeds'])
103103
if teapot.config.storage_type() == "mysql":
104104
try:
105105
database = teapot.database.__init__()

teapot/messages.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33

44
def WIP():
5-
return discord.Embed(title="⏲ This feature is Work In Progress!",
6-
description="Please stay tuned to our latest updates!", color=0x89CFF0)
5+
return discord.Embed(title="⏲ This feature is work in progress!",
6+
description="Please stay tuned to our latest updates [here]("
7+
"https://github.com/RedCokeDevelopment/Teapot.py)!", color=0x89CFF0)
78

89

910
def PermissionDenied():
@@ -31,3 +32,8 @@ def error(e="executing command"):
3132
def invalidargument(arg):
3233
return discord.Embed(title="🟥 Invalid argument!", description=f"Valid argument(s): ``{arg}``",
3334
color=0xFF0000)
35+
36+
37+
def toomanyarguments():
38+
return discord.Embed(title="🛑 Too many arguments!", description=f"You have entered too many arguments!",
39+
color=0xFF0000)

teapot/setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ def __init__():
6666
6767
LAVALINK_HOST={input_lavalink_host}
6868
LAVALINK_PORT={input_lavalink_port}
69-
LAVALINK_PASSWORD={input_lavalink_password}
70-
"""
69+
LAVALINK_PASSWORD={input_lavalink_password}"""
7170
open('./.env', 'w').write(config)
7271
print("\n[*] Successfully created config.ini!")
7372
print("Setup complete!")

0 commit comments

Comments
 (0)