Skip to content

Commit 5e47e5d

Browse files
committed
0.0.1.3 Update
- Fixed Neko command - Fixed cat and dog command aliases - Added Help command Signed-off-by: ColaIan <colaian.yt@gmail.com>
1 parent 34ccb0e commit 5e47e5d

File tree

11 files changed

+205
-149
lines changed

11 files changed

+205
-149
lines changed

Teapot.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
print("Initializing bot...")
3030
if teapot.config.storage_type() == "mysql":
3131
time_start = time.perf_counter()
32-
database = teapot.database.__init__()
33-
db = teapot.database.db(database)
32+
database = teapot.managers.database.__init__()
33+
db = teapot.managers.database.db(database)
3434
db.execute('CREATE TABLE IF NOT EXISTS `guilds` (`guild_id` BIGINT, `guild_name` TINYTEXT)')
3535
db.execute('CREATE TABLE IF NOT EXISTS `channels` (`channel_id` BIGINT, `channel_name` TINYTEXT)')
3636
db.execute("CREATE TABLE IF NOT EXISTS `users` (`user_id` BIGINT, `user_name` TINYTEXT, `user_discriminator` INT)")
@@ -52,13 +52,7 @@ async def on_ready():
5252
teapot.cogs.neko.setup(bot)
5353
if teapot.config.storage_type() == "mysql":
5454
for guild in bot.guilds:
55-
db.execute("SELECT * FROM `guilds` WHERE guild_id = '" + str(guild.id) + "'")
56-
if db.rowcount == 0:
57-
db.execute("INSERT INTO `guilds`(guild_id, guild_name) VALUES(%s, %s)", (guild.id, guild.name))
58-
database.commit()
59-
db.execute("CREATE TABLE IF NOT EXISTS `" + str(
60-
guild.id) + "_logs" + "` (`timestamp` TEXT, `guild_id` BIGINT, `channel_id` BIGINT, `message_id` "
61-
"BIGINT, `user_id` BIGINT, `action_type` TINYTEXT, `message` MEDIUMTEXT)")
55+
teapot.managers.database.create_guild_table(guild)
6256
elif teapot.config.storage_type() == "flatfile":
6357
print("[!] Flatfile storage has not been implemented yet. MySQL database is recommended")
6458
print(f"Registered commands and events in {round(time.perf_counter() - time_start, 2)}s")
@@ -75,6 +69,7 @@ async def on_message(message):
7569
db.execute("INSERT INTO `users`(user_id, user_name, user_discriminator) VALUES(%s, %s, %s)",
7670
(message.author.id, message.author.name, message.author.discriminator.zfill(4)))
7771
database.commit()
72+
7873
db.execute("SELECT * FROM `channels` WHERE channel_id = '" + str(message.channel.id) + "'")
7974
if db.rowcount == 0:
8075
db.execute("INSERT INTO `channels`(channel_id, channel_name) VALUES(%s, %s)",

teapot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from .cogs import *
2+
from .managers import *
23
from .tools import *
34
from .config import *
4-
from .database import *
55
from .events import *
66
from .messages import *
77
from .setup import *

teapot/cogs/cat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, bot):
1616

1717
self.bot = bot
1818

19-
@commands.command(pass_context=True, alias=['meow'])
19+
@commands.command(pass_context=True, aliases=['meow'])
2020
async def cat(self, ctx):
2121
""" When User Types ~meow, return a cat link """
2222
req = requests.get('https://api.thecatapi.com/v1/images/search')
@@ -28,7 +28,7 @@ async def cat(self, ctx):
2828
em.set_image(url=rngcat)
2929
await ctx.send(embed=em)
3030

31-
@commands.command(pass_context=True, alias=['woof'])
31+
@commands.command(pass_context=True, aliases=['woof'])
3232
async def dog(self, ctx):
3333
req = requests.get('http://random.dog/')
3434
if req.status_code != 200:

teapot/cogs/cmds.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ def __init__(bot):
88
""" Initialize commands """
99
helpcmd(bot)
1010
info(bot)
11-
leave(bot)
1211
ping(bot)
1312
purge(bot)
1413
kick(bot)
@@ -21,25 +20,25 @@ def helpcmd(bot):
2120

2221
@bot.command(aliases=['?'])
2322
async def help(ctx):
24-
embed = discord.Embed(title="Developers: ColaIan, RedTea", description="Multi-purpose Discord Bot",
23+
embed = discord.Embed(title="Command List", description="List of commands that you can use",
2524
color=0x7400FF)
2625
embed.set_author(name=f"Teapot.py | {teapot.version()}",
2726
icon_url="https://cdn.discordapp.com/avatars/612634758744113182/7fe078b5ea6b43000dfb7964e3e4d21d.png?size=512")
2827
embed.set_thumbnail(url="https://avatars2.githubusercontent.com/u/60006969?s=200&v=4")
29-
embed.add_field(name="Bot User:", value=bot.user, inline=True)
30-
embed.add_field(name="Guilds:", value=len(bot.guilds), inline=True)
31-
embed.add_field(name="Members:", value=len(set(bot.get_all_members())), inline=True)
32-
embed.add_field(name="O.S.:", value=str(teapot.platform()), inline=True)
33-
embed.add_field(name="Storage Type:", value=teapot.config.storage_type(), inline=True)
34-
embed.add_field(name="Prefix:", value=", ".join(teapot.config.bot_prefix()), inline=True)
35-
embed.add_field(name="Github Repo:", value="[Teapot.py](https://github.com/RedCokeDevelopment/Teapot.py)",
36-
inline=True)
37-
embed.add_field(name="Bug Report:", value="[Issues](https://github.com/RedCokeDevelopment/Teapot.py/issues)",
38-
inline=True)
39-
embed.add_field(name="Discussion:", value="[Forums](https://forum.redtea.red)", inline=True)
40-
embed.set_footer(text=f"{teapot.copyright()} | Code licensed under the MIT License")
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+
4139
embed.set_image(
4240
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")
4342
await ctx.send(embed=embed)
4443

4544

@@ -68,12 +67,6 @@ async def info(ctx):
6867
await ctx.send(embed=embed)
6968

7069

71-
def leave(bot):
72-
@bot.command()
73-
async def leave(ctx):
74-
await ctx.voice_client.disconnect()
75-
76-
7770
def ping(bot):
7871
@bot.command()
7972
async def ping(ctx):

teapot/cogs/music.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ async def volume(self, ctx, volume: int = None):
180180
if not volume:
181181
return await ctx.send(f'🔈 | {player.volume}%')
182182

183-
await player.set_volume(volume) # Lavalink will automatically cap values between, or equal to 0-1000.
183+
await player.set_volume(volume) # Values are automatically capped between, or equal to 0-1000.
184184
await ctx.send(f'🔈 | Set to {player.volume}%')
185185

186186
@commands.command()

teapot/cogs/neko.py

Lines changed: 83 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -14,110 +14,112 @@
1414
class Neko(commands.Cog):
1515
""" Cat Module"""
1616

17-
# api_options = ['femdom', 'tickle', 'classic', 'ngif', 'erofeet', 'meow', 'erok', 'poke', 'les', 'v3',
18-
# 'hololewd', 'nekoapi_v3.1', 'lewdk', 'keta', 'feetg', 'nsfw_neko_gif', 'eroyuri', 'kiss', '8ball', 'kuni',
19-
# 'tits', 'pussy_jpg', 'cum_jpg', 'pussy', 'lewdkemo', 'lizard', 'slap', 'lewd', 'cum', 'cuddle', 'spank',
20-
# 'smallboobs', 'goose', 'Random_hentai_gif', 'avatar', 'fox_girl', 'nsfw_avatar', 'hug', 'gecg', 'boobs', 'pat',
21-
# 'feet', 'smug', 'kemonomimi', 'solog', 'holo', 'wallpaper', 'bj', 'woof', 'yuri', 'trap', 'anal', 'baka',
22-
# 'blowjob', 'holoero', 'feed', 'neko', 'gasm', 'hentai', 'futanari', 'ero', 'solo', 'waifu', 'pwankg', 'eron',
23-
# 'erokemo']
24-
2517
def __init__(self, bot):
2618
""" Initialize Cat Class"""
2719

2820
self.bot = bot
2921

22+
def neko_api(self, ctx, x):
23+
try:
24+
req = requests.get(f'https://nekos.life/api/v2/img/{x}')
25+
if req.status_code != 200:
26+
print("Could not get a neko")
27+
apijson = json.loads(req.text)
28+
url = apijson["url"]
29+
em = dmbd.newembed().set_image(url=url)
30+
return em
31+
except:
32+
return teapot.messages.error(f"obtaining image ({req.status_code})")
33+
3034
@commands.command(pass_context=True)
3135
async def neko(self, ctx):
32-
""" When User Types ~neko, return a neko link """
33-
req = requests.get('https://nekos.life/api/v2/img/neko')
34-
if req.status_code != 200:
35-
print("Could not get a neko")
36-
nekolink = json.loads(req.text)
37-
rngneko = nekolink["url"]
38-
em = dmbd.newembed()
39-
em.set_image(url=rngneko)
40-
await ctx.send(embed=em)
36+
await ctx.send(embed=self.neko_api(ctx, "neko"))
4137

4238
@commands.command(pass_context=True)
4339
async def waifu(self, ctx):
44-
""" When User Types ~waifu, return a waifu link """
45-
req = requests.get('https://nekos.life/api/v2/img/waifu')
46-
if req.status_code != 200:
47-
print("Could not get a waifu")
48-
waifulink = json.loads(req.text)
49-
rngwaifu = waifulink["url"]
50-
em = dmbd.newembed()
51-
em.set_image(url=rngwaifu)
52-
await ctx.send(embed=em)
53-
54-
@commands.command(pass_context=True, aliases=['manofculture'])
40+
await ctx.send(embed=self.neko_api(ctx, "waifu"))
41+
42+
@commands.command(pass_context=True)
43+
async def avatar(self, ctx):
44+
await ctx.send(embed=self.neko_api(ctx, "avatar"))
45+
46+
@commands.command(pass_context=True)
47+
async def wallpaper(self, ctx):
48+
await ctx.send(embed=self.neko_api(ctx, "wallpaper"))
49+
50+
@commands.command(pass_context=True)
51+
async def tickle(self, ctx):
52+
await ctx.send(embed=self.neko_api(ctx, "tickle"))
53+
54+
@commands.command(pass_context=True)
55+
async def ngif(self, ctx):
56+
await ctx.send(embed=self.neko_api(ctx, "ngif"))
57+
58+
@commands.command(pass_context=True)
59+
async def poke(self, ctx):
60+
await ctx.send(embed=self.neko_api(ctx, "poke"))
61+
62+
@commands.command(pass_context=True)
63+
async def kiss(self, ctx):
64+
await ctx.send(embed=self.neko_api(ctx, "kiss"))
65+
66+
@commands.command(pass_context=True, aliases=['8ball'])
67+
async def eightball(self, ctx):
68+
await ctx.send(embed=self.neko_api(ctx, "8ball"))
69+
70+
@commands.command(pass_context=True)
71+
async def lizard(self, ctx):
72+
await ctx.send(embed=self.neko_api(ctx, "lizard"))
73+
74+
@commands.command(pass_context=True)
75+
async def slap(self, ctx):
76+
await ctx.send(embed=self.neko_api(ctx, "slap"))
77+
78+
@commands.command(pass_context=True)
79+
async def cuddle(self, ctx):
80+
await ctx.send(embed=self.neko_api(ctx, "cuddle"))
81+
82+
@commands.command(pass_context=True)
83+
async def goose(self, ctx):
84+
await ctx.send(embed=self.neko_api(ctx, "goose"))
85+
86+
@commands.command(pass_context=True)
87+
async def gox_girl(self, ctx):
88+
await ctx.send(embed=self.neko_api(ctx, "fox_girl"))
89+
90+
@commands.command(pass_context=True)
5591
async def hentai(self, ctx, type=""):
56-
""" When User Types ~hentai, return a hentai link """
5792
if ctx.message.channel.nsfw:
58-
if type.lower() == "ero":
59-
req = requests.get('https://nekos.life/api/v2/img/ero')
60-
if req.status_code != 200:
61-
print("Could not get a hentai image")
62-
hentailink = json.loads(req.text)
63-
hentaiimg = hentailink["url"]
64-
65-
message = await ctx.send(embed=teapot.messages.downloading())
66-
async with aiohttp.ClientSession() as session:
67-
async with session.get(hentaiimg) as resp:
68-
if resp.status != 200:
69-
return await ctx.send('Could not download file...')
70-
data = io.BytesIO(await resp.read())
71-
await ctx.send(file=discord.File(data, 'SPOILER_HENTAI.gif'))
72-
await message.delete()
73-
elif type.lower() == "neko":
74-
req = requests.get('https://nekos.life/api/v2/img/nsfw_neko_gif')
75-
if req.status_code != 200:
76-
print("Could not get a hentai image")
77-
hentailink = json.loads(req.text)
78-
hentaiimg = hentailink["url"]
79-
80-
message = await ctx.send(embed=teapot.messages.downloading())
81-
async with aiohttp.ClientSession() as session:
82-
async with session.get(hentaiimg) as resp:
83-
if resp.status != 200:
84-
return await ctx.send('Could not download file...')
85-
data = io.BytesIO(await resp.read())
86-
await ctx.send(file=discord.File(data, 'SPOILER_HENTAI.gif'))
87-
await message.delete()
88-
elif type.lower() == "random":
89-
req = requests.get('https://nekos.life/api/v2/img/Random_hentai_gif')
90-
if req.status_code != 200:
91-
print("Could not get a hentai image")
92-
hentailink = json.loads(req.text)
93-
hentaiimg = hentailink["url"]
94-
95-
message = await ctx.send(embed=teapot.messages.downloading())
96-
async with aiohttp.ClientSession() as session:
97-
async with session.get(hentaiimg) as resp:
98-
if resp.status != 200:
99-
return await ctx.send('Could not download file...')
100-
data = io.BytesIO(await resp.read())
101-
await ctx.send(file=discord.File(data, 'SPOILER_HENTAI.gif'))
102-
await message.delete()
103-
else:
93+
api_types = ['femdom', 'classic', 'erofeet', 'erok', 'les',
94+
'hololewd', 'lewdk', 'keta', 'feetg', 'nsfw_neko_gif', 'eroyuri',
95+
'tits', 'pussy_jpg', 'cum_jpg', 'pussy', 'lewdkemo', 'lewd', 'cum', 'spank',
96+
'smallboobs', 'Random_hentai_gif', 'nsfw_avatar', 'hug', 'gecg', 'boobs', 'pat',
97+
'feet', 'smug', 'kemonomimi', 'solog', 'holo', 'bj', 'woof', 'yuri', 'trap', 'anal', 'baka',
98+
'blowjob', 'holoero', 'feed', 'gasm', 'hentai', 'futanari', 'ero', 'solo', 'pwankg', 'eron',
99+
'erokemo']
100+
if type in api_types:
104101
try:
105102
req = requests.get(f'https://nekos.life/api/v2/img/{type}')
106103
if req.status_code != 200:
107-
print("Could not get a hentai image")
108-
hentailink = json.loads(req.text)
109-
hentaiimg = hentailink["url"]
104+
print("Unable to obtain image")
105+
apijson = json.loads(req.text)
106+
url = apijson["url"]
110107

111108
message = await ctx.send(embed=teapot.messages.downloading())
112109
async with aiohttp.ClientSession() as session:
113-
async with session.get(hentaiimg) as resp:
110+
async with session.get(url) as resp:
114111
if resp.status != 200:
112+
print(resp.status)
113+
print(await resp.read())
115114
return await ctx.send('Could not download file...')
116115
data = io.BytesIO(await resp.read())
117-
await ctx.send(file=discord.File(data, 'SPOILER_HENTAI.gif'))
116+
await ctx.send(
117+
file=discord.File(data, f'SPOILER_HENTAI.{url.split("/")[-1].split(".")[-1]}'))
118118
await message.delete()
119119
except:
120-
await ctx.send(embed=teapot.messages.invalidarguments("ero, neko, random"))
120+
await ctx.send(embed=teapot.messages.error(f"obtaining image ({req.status_code})"))
121+
else:
122+
await ctx.send(embed=teapot.messages.invalidargument(", ".join(api_types)))
121123
else:
122124
await ctx.send("This command only works in NSFW channels!")
123125

teapot/database.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)