Couple updates. Making /invite a slash command, removing some shit post commands, and making the role addition logic only check my servers

This commit is contained in:
Luke Robles 2023-05-23 09:29:20 -07:00
parent 2dd2543951
commit ea4a0e1f39
2 changed files with 21 additions and 32 deletions

View File

@ -40,13 +40,13 @@ We have lots of roles you can select based on what kind of games you're here to
Please react to this message with one of the following emojis to be granted the appropriate role: Please react to this message with one of the following emojis to be granted the appropriate role:
🚀 for Star Citizen
🔫 for Tarkov 🔫 for Tarkov
👹 for Darktide or Vermintide 👹 for Darktide or Vermintide
🪖 for Battlefield 🪖 for Battlefield
🚀 for Star Citizen
""" """
# message = await bot.get_channel(channel_id).send(blurb) # message = await bot.get_channel(channel_id).send(blurb)
# Update the message on_ready to match the content we always want to be there # Update the message on_ready to match the content we always want to be there
@ -56,8 +56,8 @@ Please react to this message with one of the following emojis to be granted the
@bot.event @bot.event
async def on_raw_reaction_add(payload): async def on_raw_reaction_add(payload):
if payload.guild_id is None: if payload.guild_id not in core_utils.my_guilds:
return # Reaction is on a private message return # Reaction is not in my discord
guild = bot.get_guild(payload.guild_id) guild = bot.get_guild(payload.guild_id)
role_map = { role_map = {
@ -89,21 +89,6 @@ async def fix_cdn_url(ctx):
return return
@bot.listen("on_message")
async def he_just_like_me(ctx):
if ctx.guild.id in core_utils.my_guilds:
phrases = ["he just like me", "hjlm", "frfr"]
if any(x in ctx.content for x in phrases):
await ctx.reply("https://imgur.com/V3k729v")
# @bot.listen("on_message")
# harass jason with shitposts
# async def make_a_change(ctx):
# if ctx.author.id == 83012791983673344:
# await ctx.reply("https://i.redd.it/ims06c64idb91.jpg")
@bot.listen("on_message") @bot.listen("on_message")
async def convert_heic_to_jpg(ctx): async def convert_heic_to_jpg(ctx):
from cmagick import cmagick from cmagick import cmagick

View File

@ -10,25 +10,29 @@ class ServerUtils(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot: commands.Bot = bot self.bot: commands.Bot = bot
@commands.command() @commands.slash_command(
async def ping(self, ctx: commands.Context): guild_ids=None,
await ctx.reply("pong") name="invite",
description="Have the bot DM you an invite link (with the option to make it temporary)",
@commands.command(name="invite") )
async def invite(self, ctx: commands.Context): @option(
name="temp",
description="Whether or not to make it a temporary invite",
type=bool,
default=False,
)
async def invite(self, ctx: commands.Context, temp):
# Default to creating the invite to the channel the message was sent in # Default to creating the invite to the channel the message was sent in
# if the user is in a voice channel, create the invite there # if the user is in a voice channel, create the invite there
invite_channel = ctx.message.channel invite_channel = ctx.channel
try: try:
if ctx.message.author.voice.channel: if ctx.author.voice.channel:
invite_channel = ctx.message.author.voice.channel invite_channel = ctx.author.voice.channel
except AttributeError: except AttributeError:
pass pass
temp = False if temp:
if "temp" in ctx.message.content:
temp = True
await ctx.author.send("Here is your temporary invite") await ctx.author.send("Here is your temporary invite")
invite = await invite_channel.create_invite( invite = await invite_channel.create_invite(
@ -36,7 +40,7 @@ class ServerUtils(commands.Cog):
max_age=3600, max_age=3600,
temporary=temp, temporary=temp,
) )
await ctx.reply("Check your DMs") await ctx.respond("Check your DMs")
await ctx.author.send(invite) await ctx.author.send(invite)
@commands.slash_command( @commands.slash_command(