Skip to content

Commit 3b43dfa

Browse files
authored
Merge pull request #74 from RedCokeDevelopment/dev
Upgrade dependencies and fix github workflow
2 parents 8ed440a + 19c6aeb commit 3b43dfa

File tree

8 files changed

+49
-47
lines changed

8 files changed

+49
-47
lines changed

.github/workflows/Teapot.py.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v2
17-
- name: Set up Python 3.9.5
17+
- name: Set up Python 3.9.16
1818
uses: actions/setup-python@v2
1919
with:
20-
python-version: 3.9.5
20+
python-version: 3.9.16
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-2021 Red Coke Development
3+
Copyright (c) 2020-2023 Red Coke Development
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ A big thanks to all those who contribute to the project ❤
4646
There are two owners for this project. They all contribute massively to the running of this project. Links to their GitHub profiles can be found below:
4747

4848
- [ColaIan](https://github.com/ColaIan) (ColaIan#2974)
49-
- [RedTea](https://github.com/RedTeaDev) (RedTea#0001)
49+
- [RedTea](https://github.com/RedTeaDev) (RedTea#9209)
5050

5151
## 📜 Requirements
5252
These are the requirements for the bot.

Teapot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@
7676
teapot.managers.database.create_table(
7777
"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")
7878

79-
print(
80-
f"Connected to database ({teapot.config.db_host()}:{teapot.config.db_port()}) in {round(time.perf_counter() - time_start, 2)}s")
81-
8279
db.execute("INSERT INTO `bot_logs`(timestamp, type, class, message) VALUES(%s, %s, %s, %s)",
8380
(teapot.time(), "BOT_START", __name__, "Initialized bot"))
8481
database.commit()
8582

83+
print(
84+
f"Connected to database ({teapot.config.db_host()}:{teapot.config.db_port()}) in {round(time.perf_counter() - time_start, 2)}s")
85+
8686
intents = discord.Intents.default()
8787
intents.members = True
8888
intents.typing = False

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ urllib3>=1.25.10
1919
websockets>=8.1
2020
yarl>=1.5.1
2121
mysql-connector-python>=8.0.21
22-
alt-profanity-check==1.1.1
22+
alt-profanity-check==1.1.3
23+
protobuf>=3.20.2 # not directly required, pinned by Snyk to avoid a vulnerability
24+

teapot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def copyright():
3535
return f"© 2020-{year()} RedCoke Development"
3636

3737

38-
def getPlatform():
38+
def platform():
3939
return platform.system() + " " + platform.release()
4040

4141

teapot/cogs/cmds.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ async def info(ctx):
8484
"/7fe078b5ea6b43000dfb7964e3e4d21d.png?size=512")
8585
embed.set_thumbnail(url="https://avatars2.githubusercontent.com/u/60006969?s=200&v=4")
8686
embed.add_field(name="Bot User:", value=bot.user)
87-
embed.add_field(name="Guilds:", value=str(len(bot.guilds)))
88-
embed.add_field(name="Members:", value=str(len(set(bot.get_all_members()))))
89-
embed.add_field(name="O.S.:", value=str(teapot.getPlatform()))
87+
embed.add_field(name="Guilds:", value=len(bot.guilds))
88+
embed.add_field(name="Members:", value=len(set(bot.get_all_members())))
89+
embed.add_field(name="O.S.:", value=str(teapot.platform()))
9090
embed.add_field(name="Storage Type:", value=teapot.config.storage_type())
9191
embed.add_field(name="Prefix:", value=", ".join(teapot.config.bot_prefix()))
9292
embed.add_field(name="Github Repo:", value="[Teapot.py](https://github.com/RedCokeDevelopment/Teapot.py)")
@@ -191,7 +191,7 @@ async def debug(ctx):
191191
embed.add_field(name="Memory",
192192
value=str(round(psutil.virtual_memory()[1] / 1024 / 1024 / 1024)) + "GB / " + str(round(
193193
psutil.virtual_memory()[0] / 1024 / 1024 / 1024)) + "GB", inline=True)
194-
embed.add_field(name="O.S.:", value=str(teapot.getPlatform()), inline=True)
194+
embed.add_field(name="O.S.:", value=str(teapot.platform()), inline=True)
195195
embed.add_field(name="Storage Type:", value=teapot.config.storage_type(), inline=True)
196196
embed.add_field(name="Prefix:", value=", ".join(teapot.config.bot_prefix()), inline=True)
197197
embed.add_field(name="Github Repo:", value="[Teapot.py](https://github.com/RedCokeDevelopment/Teapot.py)",

teapot/cogs/neko.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,87 +8,87 @@
88
from discord.ext import commands
99

1010
import teapot
11-
import teapot.tools.embed as dmbd
11+
import teapot.tools.embed as embed
12+
13+
14+
def neko_api(x):
15+
req = requests.get(f'https://nekos.life/api/v2/img/{x}')
16+
try:
17+
if req.status_code != 200:
18+
print("Unable to obtain neko image!")
19+
api_json = json.loads(req.text)
20+
url = api_json["url"]
21+
em = embed.newembed().set_image(url=url)
22+
return em
23+
except:
24+
return teapot.messages.error(f"obtaining image ({req.status_code})")
1225

1326

1427
class Neko(commands.Cog):
1528
"""Neko!!! :3"""
1629

1730
def __init__(self, bot):
18-
""" Initialize neko class"""
19-
31+
"""Initialize neko class"""
2032
self.bot = bot
2133

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-
3434
@commands.command()
3535
async def neko(self, ctx):
36-
await ctx.send(embed=self.neko_api(ctx, "neko"))
36+
await ctx.send(embed=neko_api("neko"))
3737

3838
@commands.command()
3939
async def waifu(self, ctx):
40-
await ctx.send(embed=self.neko_api(ctx, "waifu"))
40+
await ctx.send(embed=neko_api("waifu"))
4141

4242
@commands.command()
4343
async def avatar(self, ctx):
44-
await ctx.send(embed=self.neko_api(ctx, "avatar"))
44+
await ctx.send(embed=neko_api("avatar"))
4545

4646
@commands.command()
4747
async def wallpaper(self, ctx):
48-
await ctx.send(embed=self.neko_api(ctx, "wallpaper"))
48+
await ctx.send(embed=neko_api("wallpaper"))
4949

5050
@commands.command()
5151
async def tickle(self, ctx):
52-
await ctx.send(embed=self.neko_api(ctx, "tickle"))
52+
await ctx.send(embed=neko_api("tickle"))
5353

5454
@commands.command()
5555
async def poke(self, ctx):
56-
await ctx.send(embed=self.neko_api(ctx, "poke"))
56+
await ctx.send(embed=neko_api("poke"))
5757

5858
@commands.command()
5959
async def kiss(self, ctx):
60-
await ctx.send(embed=self.neko_api(ctx, "kiss"))
60+
await ctx.send(embed=neko_api("kiss"))
6161

6262
@commands.command(aliases=['8ball'])
6363
async def eightball(self, ctx):
64-
await ctx.send(embed=self.neko_api(ctx, "8ball"))
64+
await ctx.send(embed=neko_api("8ball"))
6565

6666
@commands.command()
6767
async def lizard(self, ctx):
68-
await ctx.send(embed=self.neko_api(ctx, "lizard"))
68+
await ctx.send(embed=neko_api("lizard"))
6969

7070
@commands.command()
7171
async def slap(self, ctx):
72-
await ctx.send(embed=self.neko_api(ctx, "slap"))
72+
await ctx.send(embed=neko_api("slap"))
7373

7474
@commands.command()
7575
async def cuddle(self, ctx):
76-
await ctx.send(embed=self.neko_api(ctx, "cuddle"))
76+
await ctx.send(embed=neko_api("cuddle"))
7777

7878
@commands.command()
7979
async def goose(self, ctx):
80-
await ctx.send(embed=self.neko_api(ctx, "goose"))
80+
await ctx.send(embed=neko_api("goose"))
8181

8282
@commands.command()
8383
async def fox_girl(self, ctx):
84-
await ctx.send(embed=self.neko_api(ctx, "fox_girl"))
84+
await ctx.send(embed=neko_api("fox_girl"))
8585

8686
@commands.command()
8787
async def baka(self, ctx):
88-
await ctx.send(embed=self.neko_api(ctx, "baka"))
88+
await ctx.send(embed=neko_api("baka"))
8989

9090
@commands.command()
91-
async def hentai(self, ctx, type=""):
91+
async def hentai(self, ctx, api_type=""):
9292
if ctx.message.channel.nsfw:
9393
api_types = ['femdom', 'classic', 'ngif', 'erofeet', 'erok', 'les',
9494
'hololewd', 'lewdk', 'keta', 'feetg', 'nsfw_neko_gif', 'eroyuri',
@@ -97,13 +97,13 @@ async def hentai(self, ctx, type=""):
9797
'feet', 'smug', 'kemonomimi', 'solog', 'holo', 'bj', 'woof', 'yuri', 'trap', 'anal',
9898
'blowjob', 'holoero', 'feed', 'gasm', 'hentai', 'futanari', 'ero', 'solo', 'pwankg', 'eron',
9999
'erokemo']
100-
if type in api_types:
100+
if api_type in api_types:
101+
req = requests.get(f'https://nekos.life/api/v2/img/{api_type}')
101102
try:
102-
req = requests.get(f'https://nekos.life/api/v2/img/{type}')
103103
if req.status_code != 200:
104104
print("Unable to obtain image")
105-
apijson = json.loads(req.text)
106-
url = apijson["url"]
105+
api_json = json.loads(req.text)
106+
url = api_json["url"]
107107

108108
message = await ctx.send(embed=teapot.messages.downloading())
109109
async with aiohttp.ClientSession() as session:

0 commit comments

Comments
 (0)