Skip to content

Commit 9d53f89

Browse files
authored
2024-09-25
new commands!!! yaaay~
1 parent 3e6db3e commit 9d53f89

14 files changed

+125
-77
lines changed

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ You are 100% allowed to have a self-hosted version of Yume under the following c
1515
Soon™ (I'm still planning it)
1616

1717
## Changelog
18-
- Cleaner code on embeds.py.
19-
- Bad codding.
20-
- Text file containing all the used links.
21-
18+
- Cats, Dogs 3 & Knuckles.
19+
- A currency converter comamand.
20+
- removed some of the useless imports.
2221
## Have a suggestion?
2322
If you have any suggestions or ideas for new commands, you can tell them to me and I will analyze then carefully. Thanks for the attention!
2423

cogs/actions.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Bibliotecas utilizadas neste arquivo
22
from discord.ext import commands
33
from discord import app_commands
4-
from utils import helpers
54
from utils import buttons
65
import discord
76

cogs/dreams.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,19 @@ async def info(self, interaction: discord.Interaction):
3030
await interaction.response.send_message(embed=InfoEmbed.iembed, ephemeral=True)
3131

3232
# Typo Report
33-
@app_commands.command(name='typo', description="a way to report any typos you've found so far!")
33+
@app_commands.command(name='typo', description="A way to report any typos you've found so far!")
3434
async def typo(self, interaction: discord.Interaction):
3535

3636
typo = modals.TypoModal()
3737
await interaction.response.send_modal(typo)
3838

3939
# Suggestions
40-
@app_commands.command(name='suggestion', description="you can give suggestions on how to improve me!")
40+
@app_commands.command(name='suggestion', description="With this command you can give Yume your suggestions!")
4141
async def suggestion(self, interaction: discord.Interaction):
4242

4343
suggestion = modals.SuggestionModal()
4444
await interaction.response.send_modal(suggestion)
4545

46-
# Command Ideas
47-
@app_commands.command(name='ideas', description="have any command ideas? share them with me~")
48-
async def ideas(self, interaction: discord.Interaction):
49-
50-
ideas = modals.IdeaModal()
51-
await interaction.response.send_modal(ideas)
52-
5346

5447
# Realiza o registro da classe nos cogs
5548
async def setup(yume: commands.AutoShardedBot) -> None:

cogs/image.py

+60
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,66 @@ async def reddit(self, interaction: discord.Interaction, *, subreddit: str):
4949
elif result[1] is False and interaction.channel.is_nsfw():
5050
await interaction.response.send_message(embed=embed)
5151

52+
# Cachorrinhos
53+
@app_commands.command(name='dogs', description="Yume will give you a random image of a doggy!")
54+
async def dog(self, interaction: discord.Interaction):
55+
56+
helpers.dogcat = "thedogapi"
57+
GenericEmbed.embed.set_image(url=await helpers.catdog())
58+
GenericEmbed.embed.set_author(name="Here's the doggy I've got for you!! Hope you like it~")
59+
60+
await interaction.response.send_message(embed=GenericEmbed.embed)
61+
62+
# Gatinhos
63+
@app_commands.command(name='cats', description="Yume will give you a random image of a kitty!")
64+
async def cat(self, interaction: discord.Interaction):
65+
66+
helpers.dogcat = "thecatapi"
67+
GenericEmbed.embed.set_image(url=await helpers.catdog())
68+
GenericEmbed.embed.set_author(name="Here's the kitty I've got for you!! Hope you like it~")
69+
70+
await interaction.response.send_message(embed=GenericEmbed.embed)
71+
72+
# Waifus
73+
@app_commands.command(name="waifu", description="I'll give you a random image of a waifu")
74+
async def waifu(self, interaction: discord.Interaction):
75+
76+
helpers.nekos_gif = 'waifu'
77+
GenericEmbed.embed.set_image(url = await helpers.nekos_best())
78+
GenericEmbed.embed.set_author(name="Here's the waifu yume got for you!!")
79+
80+
await interaction.response.send_message(embed=GenericEmbed.embed)
81+
82+
# Husbandos
83+
@app_commands.command(name="husbando", description="I'll give you a random image of a husbando")
84+
async def husbando(self, interaction: discord.Interaction):
85+
86+
helpers.nekos_gif = 'husbando'
87+
GenericEmbed.embed.set_image(url=await helpers.nekos_best())
88+
GenericEmbed.embed.set_author(name="Here's the husbando yume got for you!!")
89+
90+
await interaction.response.send_message(embed=GenericEmbed.embed)
91+
92+
# Nekos
93+
@app_commands.command(name="neko", description="I'll give you a cute random image of a catgirl!")
94+
async def neko(self, interaction: discord.Interaction):
95+
96+
helpers.nekos_gif = 'neko'
97+
GenericEmbed.embed.set_image(url=await helpers.nekos_best())
98+
GenericEmbed.embed.set_author(name="Here's the neko yume got for you!!")
99+
100+
await interaction.response.send_message(embed=GenericEmbed.embed)
101+
102+
# Kitsunes
103+
@app_commands.command(name="kitsune", description="I'll give you a cute random image of a kitsune!")
104+
async def kitsune(self, interaction: discord.Interaction):
105+
106+
helpers.nekos_gif = 'kitsune'
107+
GenericEmbed.embed.set_image(url=await helpers.nekos_best())
108+
GenericEmbed.embed.set_author(name="Here's the kitsune yume got for you!!")
109+
110+
await interaction.response.send_message(embed=GenericEmbed.embed)
111+
52112

53113
# Realiza o registro da classe nos cogs
54114
async def setup(yume: commands.AutoShardedBot) -> None:

cogs/roleplay.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# bibliotecas
2-
from discord.ext.commands import bot
3-
42
from utils.embeds import GenericEmbed
53
from discord.ext import commands
64
from discord import app_commands
@@ -100,7 +98,7 @@ async def stare(self, interaction: discord.Interaction, *, user: discord.Member)
10098

10199
helpers.nekos_gif = 'stare'
102100
GenericEmbed.embed.set_image(url=str(await helpers.nekos_best()))
103-
GenericEmbed.embed.set_footer(text='Careful to not stare too much, they may notice it...')
101+
GenericEmbed.embed.set_footer(text='Be careful not to stare for too long - they might notice!')
104102

105103
if user == interaction.user:
106104
GenericEmbed.embed.set_author("I'm gonna stare at you then... please don't look away!")
@@ -115,10 +113,10 @@ async def shoot(self, interaction: discord.Interaction, *, user: discord.Member)
115113

116114
helpers.nekos_gif = 'shoot'
117115
GenericEmbed.embed.set_image(url=str(await helpers.nekos_best()))
118-
GenericEmbed.embed.set_footer(text="Oh my God, are you okay? I'm calling a ambulance, stay strong, please!")
116+
GenericEmbed.embed.set_footer(text="Oh my God, are you okay? I'm calling an ambulance, stay strong, please!")
119117

120118
if user == interaction.user:
121-
GenericEmbed.embed.set_author("I wasn't wanting to shoot you but, that might be.... hehe~")
119+
GenericEmbed.embed.set_author("Suuuree.... hehe~")
122120
await interaction.response.send_message(embed=GenericEmbed.embed)
123121

124122
GenericEmbed.embed.set_author(name=f"{user.display_name} just got shot by {interaction.user.display_name}!!! Should we call the police?")

cogs/utility.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Bibliotecas utilizadas neste arquivo
22
from discord.ext import commands
33
from discord import app_commands
4+
from utils import helpers
45
import discord
56

67

@@ -35,6 +36,15 @@ async def avatar(self, interaction: discord.Interaction, user: discord.Member =
3536

3637
await interaction.response.send_message(embed=avatar)
3738

39+
# Currency
40+
@app_commands.command(name='currency', description="Let's you see the currency values")
41+
async def currency(self, interaction: discord.Interaction, *, currency1: str, amount: int, currency2: str):
42+
43+
helpers.values = currency1, currency2, amount
44+
result = await helpers.currency_finder()
45+
46+
await interaction.response.send_message(f"Yume thinks that **{amount} {currency1.upper()}** is equal to **{result} {currency2.upper()}**!!", ephemeral=True)
47+
3848

3949
# Realiza o registro da classe nos cogs
4050
async def setup(yume: commands.AutoShardedBot) -> None:

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
beautifulsoup4==4.12.3
12
python-dotenv==1.0.1
23
discord.py==2.3.2
3-
discord==2.3.2
44
aiohttp==3.10.2
5+
discord==2.3.2
56
uwuipy==0.1.9

texts/external_emojis.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<:github:1243404130651865098>
2+
<:kofi:1286360498853380159>
3+
<:externallink:1286308168762134569>

texts/status.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
I'm watching you~
2-
What are you doing?
3-
Get out of my head....
4-
With dreams
1+
Updating
2+
Getting updated

utils/buttons.py

-12
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,3 @@
2121
bribe_button = Button(label="Try giving them a bribe", style=discord.ButtonStyle.blurple)
2222
sad_button = Button(label="So sad...", style=discord.ButtonStyle.blurple)
2323
wave_button = Button(label="Wave to them", style=discord.ButtonStyle.blurple)
24-
25-
26-
view_smug = View()
27-
view_smug.add_item(smug_button)
28-
view_smug.add_item(stare_button)
29-
view_smug.add_item(laugh_button)
30-
31-
32-
view_party = View()
33-
view_party.add_item(party_button)
34-
view_party.add_item(leave_button)
35-
view_party.add_item(stare_button)

utils/envkeys.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@ def sugghook():
2121
return os.environ.get("SUGGHOOK")
2222

2323

24-
def ideahook():
25-
return os.environ.get("IDEAHOOK")
24+
def cats_key():
25+
return os.environ.get("CAT_API")
26+
27+
28+
def dogs_key():
29+
return os.environ.get("DOG_API")

utils/helpers.py

+32
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Bibliotecas utilizadas neste arquivo
2+
from utils.envkeys import dogs_key, cats_key
3+
from bs4 import BeautifulSoup
24
import aiohttp
35
import random
46
import json
@@ -7,6 +9,8 @@
79
# Variáveis Globais
810
sub_reddit = None
911
nekos_gif = None
12+
values = None
13+
dogcat = None
1014

1115

1216
# Reddit Search
@@ -57,3 +61,31 @@ async def nekos_best():
5761
data = await r.json()
5862

5963
return data['results'][0]['url']
64+
65+
66+
# Currency Finder
67+
async def currency_finder():
68+
69+
async with aiohttp.ClientSession() as session:
70+
async with session.get(f"https://x-rates.com/calculator/?from={values[0]}&to={values[1]}&amount={values[2]}") as r:
71+
data = await r.text()
72+
73+
little_soup = BeautifulSoup(data, 'html.parser')
74+
value = little_soup.find("span", class_="ccOutputRslt").get_text()
75+
76+
return value[:-7]
77+
78+
79+
# Cats and Dogs
80+
async def catdog():
81+
82+
if dogs_key == "thedogapi":
83+
key = dogs_key()
84+
else:
85+
key = cats_key()
86+
87+
async with aiohttp.ClientSession() as session:
88+
async with session.get(f"https://api.{dogcat}.com/v1/images/search?limit=10&api_key={key}") as r:
89+
data = await r.json()
90+
91+
return data[random.randint(0, 9)]['url']

utils/modals.py

+1-39
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Bibliotecas utilizadas neste arquivo
2-
from utils.envkeys import typohook, sugghook, ideahook
2+
from utils.envkeys import typohook, sugghook
33
from discord import Webhook, SyncWebhook
44
from discord.ext import commands
55
from datetime import datetime
@@ -81,41 +81,3 @@ async def on_submit(self, interaction: discord.Interaction):
8181

8282
async def on_error(self, interaction: discord.Interaction, error):
8383
await interaction.response.send_message("I think something went wrong with me, it's not your fault, don't worry!", ephemeral=True)
84-
85-
86-
class IdeaModal(discord.ui.Modal, title="If you have some cool ideas for commands!"):
87-
88-
idea_title = discord.ui.TextInput(
89-
style=discord.TextStyle.short,
90-
label="Give it a Name!",
91-
required=True,
92-
max_length=100,
93-
placeholder="What's the name of your idea?")
94-
95-
idea_message = discord.ui.TextInput(
96-
style=discord.TextStyle.long,
97-
label="If added, how you think it should work?",
98-
required=True,
99-
max_length=500,
100-
placeholder="Explain it to me bit more!"
101-
)
102-
103-
async def on_submit(self, interaction: discord.Interaction):
104-
105-
async with aiohttp.ClientSession() as session:
106-
107-
webhook = Webhook.from_url(f"https://discord.com/api/webhooks/{ideahook()}", session=session)
108-
109-
now = datetime.now()
110-
idea_e = discord.Embed(color=discord.Color.random())
111-
idea_e.set_author(name=self.idea_title.value, icon_url=interaction.user.avatar.url)
112-
idea_e.add_field(name="Command Idea:", value=f"{self.idea_message.value}", inline=False)
113-
idea_e.add_field(name="Submitted By:", value=f"{interaction.user.name}", inline=False)
114-
idea_e.add_field(name="UserID", value=f"{interaction.user.id}", inline=False)
115-
idea_e.set_footer(text=f"Submitted at: {now.strftime('%Y/%m/%d - %H:%M:%S')}")
116-
117-
await webhook.send(embed=idea_e)
118-
await interaction.response.send_message("Thanks for giving Yume a new command idea!", ephemeral=True)
119-
120-
async def on_error(self, interaction: discord.Interaction, error):
121-
await interaction.response.send_message("I think something went wrong with me, it's not your fault, don't worry!", ephemeral=True)

utils/test.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)