Converting more shit to a slash commands

This commit is contained in:
Luke Robles 2022-10-18 13:56:22 -07:00
parent 74246d573d
commit 34d75566e4
3 changed files with 67 additions and 44 deletions

View File

@ -33,12 +33,12 @@ async def on_ready():
)
if os.getenv("DRAGON_ENV") == "prod":
for guild in bot.guilds:
await bot.register_commands(guild_id=guild.id, force=True)
# for guild in bot.guilds:
# await bot.register_commands(guild_id=guild.id, force=True)
await bot.get_channel(152921472304676865).send("I have reconnected")
else:
# force register commands in test server on launch
await bot.register_commands(guild_id=826547484632678450, force=True)
# else:
# # force register commands in test server on launch
# await bot.register_commands(guild_id=826547484632678450, force=True)
@bot.listen("on_message")

View File

@ -1,3 +1,4 @@
from discord import option
from discord.ext import commands
import core_utils
import discord
@ -16,13 +17,6 @@ class Cheeky(commands.Cog):
await ctx.reply(decide.decide(ctx.message.content))
@commands.command(name="verify")
async def verify(self, ctx: commands.Context):
message = list(await ctx.message.channel.history(limit=2).flatten())[-1]
emoji = discord.utils.get(ctx.message.guild.emojis, name="verified")
if emoji:
await message.add_reaction(emoji)
@commands.command(name="coom", pass_context=True)
async def coom(self, ctx: commands.Context, id=None):
if ctx.message.author.id != core_utils.my_id:
@ -35,28 +29,48 @@ class Cheeky(commands.Cog):
for emoji in await ctx.message.guild.fetch_emojis():
await message.add_reaction(emoji)
@commands.command(name="clap")
async def clap(self, ctx: commands.Context):
content = ctx.message.content.split()[1:]
if len(content) == 1:
content = [char for char in content[0]]
await ctx.send("{}".format(" :clap: ".join(content)))
@commands.slash_command(
guild_ids=None,
name="clap",
description="Returns your passed in text separated by 👏",
)
@option(
name="input_string",
input_type="str",
description="The text you want to split",
required=True,
)
async def clap(self, ctx: commands.Context, input_string: str):
if len(input_string.split()) == 1:
input_string = [char for char in input_string]
await ctx.respond(" :clap: ".join(input_string))
else:
await ctx.respond(" :clap: ".join(input_string.split()) + " :clap: ")
@commands.command(name="greentext")
@commands.slash_command(
guild_ids=None,
debug_guild=826547484632678450,
name="greentext",
description="Posts a greentext image",
)
async def greentext(self, ctx: commands.Context):
import get_from_reddit
await ctx.reply(
embed=core_utils.generate_embed(
embed_title=">implying this actually happened",
embed_color=discord.Color.green(),
embed_url=get_from_reddit.get_image(
boards=["aigreentext", "greentext", "newgreentexts", "4chan"]
),
embed = discord.Embed(
description=">implying this actually happened",
color=discord.Color.green(),
type="rich",
)
embed.set_image(
url=get_from_reddit.get_image(
boards=["aigreentext", "greentext", "newgreentexts", "4chan"]
)
)
await ctx.respond(embed=embed)
@commands.command(name="roll")
async def roll(
self, ctx: commands.Context, number_of_die, sides, number_to_add=None
@ -108,10 +122,10 @@ class Cheeky(commands.Cog):
)
)
@commands.command(name="donate", aliases=["subscribe"])
@commands.slash_command(name="donate")
async def donate(self, ctx: commands.Context):
await ctx.reply(
await ctx.respond(
"https://paypal.me/ldooks\nhttps://venmo.com/ldooks\nhttps://cash.me/$ldooks"
)
@ -124,14 +138,17 @@ class Cheeky(commands.Cog):
await ctx.reply(result)
@commands.command(name="8ball")
async def eight_ball(self, ctx: commands.Context):
@commands.slash_command(
guild_ids=None, name="8ball", description="Ask the magic 8 ball a question"
)
@option(name="question", description="Your question", required=True)
async def eight_ball(self, ctx: commands.Context, question: str):
import eight_ball
result = eight_ball.check_8ball(ctx.message.content)
result = eight_ball.check_8ball(question)
await ctx.reply(":8ball: %s :8ball:" % result)
await ctx.respond(":8ball: %s :8ball:" % result)
@commands.command(name="flows")
async def flows(self, ctx: commands.Context):
@ -140,8 +157,17 @@ class Cheeky(commands.Cog):
result = river_stats.get_stats()
await ctx.reply(embed=result)
@commands.command(name="twitter", aliases=["tweet"])
async def twitter(self, ctx: commands.Context, message_id):
@commands.slash_command(
guild_ids=None,
name="tweet",
description="Returns an image of the pasted in message ID as a tweet",
)
@option(
name="message_id",
description="The message ID to turn into a tweet",
required=True,
)
async def twitter(self, ctx: commands.Context, message_id: str):
message = await ctx.channel.fetch_message(message_id)
author_avatar = message.author.avatar
@ -156,13 +182,15 @@ class Cheeky(commands.Cog):
)
with open("/tmp/tweet.jpg", "wb") as f:
f.write(response.content)
await ctx.message.delete()
await ctx.send(file=discord.File("/tmp/tweet.jpg"))
# await ctx.message.delete()
await ctx.respond(file=discord.File("/tmp/tweet.jpg"))
@commands.command(name="sus")
@commands.slash_command(
guild_ids=None, name="sus", description="Returns a sussy crewmate"
)
async def sus(self, ctx: commands.Context):
if random.randint(0, 200) == 0:
await ctx.reply(
await ctx.respond(
"""
```
@ -179,7 +207,7 @@ class Cheeky(commands.Cog):
```"""
)
else:
await ctx.reply(
await ctx.respond(
"""
```

View File

@ -234,10 +234,6 @@ def get_help_message(method):
"\nGives the role permissions to enter the voice channel\n"
"\nUsage: !vc some_role_name",
],
"verify": [
"Adds the twitter blue check mark to the previous message\n",
"\nLiterally thats all it does\n" "\nUsage: !verify",
],
}
return "```css\n{}: {}\n```".format(method, " ".join(supported_methods[method]))
@ -256,7 +252,6 @@ def get_help_embed(bot):
"nft",
"owo",
"sus",
"verify",
"wordle",
],
"image utils": [