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 84b45e043c
commit f24843cdbc
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:
🚀 for Star Citizen
🔫 for Tarkov
👹 for Darktide or Vermintide
🪖 for Battlefield
🚀 for Star Citizen
"""
# message = await bot.get_channel(channel_id).send(blurb)
# 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
async def on_raw_reaction_add(payload):
if payload.guild_id is None:
return # Reaction is on a private message
if payload.guild_id not in core_utils.my_guilds:
return # Reaction is not in my discord
guild = bot.get_guild(payload.guild_id)
role_map = {
@ -89,21 +89,6 @@ async def fix_cdn_url(ctx):
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")
async def convert_heic_to_jpg(ctx):
from cmagick import cmagick

View File

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