Compare commits
No commits in common. "b71f9bf1d81ab9879dc6271a3285580279d3718d" and "63c764b6cce480cb570d837e39df7a9d106578ae" have entirely different histories.
b71f9bf1d8
...
63c764b6cc
1 changed files with 4 additions and 52 deletions
|
@ -11,8 +11,7 @@ class Shortmute(commands.Cog):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.config = Config.get_conf(self, identifier=25781647388294, force_registration=True)
|
self.config = Config.get_conf(self, identifier=25781647388294, force_registration=True)
|
||||||
self.config.register_guild(
|
self.config.register_guild(
|
||||||
dm = True,
|
dm = True
|
||||||
logging_channels = []
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@app_commands.command()
|
@app_commands.command()
|
||||||
|
@ -101,62 +100,15 @@ class Shortmute(commands.Cog):
|
||||||
await target.send(embed=dm_embed)
|
await target.send(embed=dm_embed)
|
||||||
except discord.HTTPException as error:
|
except discord.HTTPException as error:
|
||||||
await old_message.edit(content="Could not message the target, user most likely has Direct Messages disabled.")
|
await old_message.edit(content="Could not message the target, user most likely has Direct Messages disabled.")
|
||||||
logging_channels_list = await self.config.guild(old_interaction.guild.id).logging_channels()
|
|
||||||
if logging_channels_list:
|
|
||||||
logging_embed = discord.Embed(title="Shortmute", description=f"Moderator: {old_interaction.user.mention} ({old_interaction.user.id})\nTarget: {target.mention} ({target.id})\nDuration: `{readable_duration}`\nReason: `{reason}`", color=await self.bot.get_embed_color(None))
|
|
||||||
if evidence:
|
|
||||||
logging_embed.set_image(evidence)
|
|
||||||
for channel_id in logging_channels_list:
|
|
||||||
channel_obj = old_interaction.guild.get_channel(channel_id)
|
|
||||||
await channel_obj.send(embed=logging_embed)
|
|
||||||
|
|
||||||
@ui.button(label="No", style=discord.ButtonStyle.danger)
|
@ui.button(label="No", style=discord.ButtonStyle.danger)
|
||||||
async def shortmute_button_no(self, button: ui.Button, interaction: discord.Interaction):
|
async def shortmute_button_no(self, button: ui.Button, interaction: discord.Interaction):
|
||||||
message = await self.passed_info['interaction'].edit_original_response(content="Command cancelled.", view=None, embed=None)
|
message = await self.passed_info['interaction'].edit_original_response(content="Command cancelled.", view=None, embed=None)
|
||||||
await message.delete(delay=3)
|
await message.delete(delay=3)
|
||||||
|
|
||||||
@commands.group(name='shortmuteset', autohelp=True)
|
@commands.command()
|
||||||
@commands.guild_only()
|
async def shortmute_dm(self, ctx: commands.Context, enabled: bool = None):
|
||||||
async def shortmute_config(self, ctx: commands.Context):
|
"""This command changes if the `/shortmute` slash command Direct Messages its' target."""
|
||||||
"""This command group is used to configure the `/shortmute` slash command."""
|
|
||||||
|
|
||||||
@shortmute_config.command(name='addchannel')
|
|
||||||
async def shortmute_config_addchannel(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
|
||||||
"""This command changes where the `/shortmute` slash command will log shortmutes. You can set multiple channels as well!"""
|
|
||||||
current_list = await self.config.guild(ctx.guild.id).logging_channels()
|
|
||||||
if channel:
|
|
||||||
if channel.id in current_list:
|
|
||||||
await ctx.send("This channel is already in the logging channel list!")
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
current_list.append(channel.id)
|
|
||||||
await self.config.guild(ctx.guild.id).logging_channels.set(current_list)
|
|
||||||
await ctx.send(f"{channel.mention} has been added to the logging channels list.")
|
|
||||||
else:
|
|
||||||
already_in_list = []
|
|
||||||
for channel_id in current_list:
|
|
||||||
channel_obj = ctx.guild.get_channel(channel_id)
|
|
||||||
if channel_obj:
|
|
||||||
already_in_list.append(channel_obj.mention)
|
|
||||||
if already_in_list:
|
|
||||||
await ctx.send("Channels already in the list:\n" + "\n".join(already_in_list))
|
|
||||||
else:
|
|
||||||
await ctx.send("Please provide a valid channel.")
|
|
||||||
|
|
||||||
@shortmute_config.command(name='removechannel')
|
|
||||||
async def shortmute_config_removechannel(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
|
||||||
"""This command removes a channel from the `/shortmute`slash command's logging channels list."""
|
|
||||||
current_list = await self.config.guild(ctx.guild.id).logging_channels()
|
|
||||||
if channel.id in current_list:
|
|
||||||
current_list.remove(channel.id)
|
|
||||||
await self.config.guild(ctx.guild.id).logging_channels.set(current_list)
|
|
||||||
await ctx.send(f"{channel.mention} has been removed from the logging channels list.")
|
|
||||||
else:
|
|
||||||
await ctx.send("Please provide a valid channel that exists in the logging channels list.")
|
|
||||||
|
|
||||||
@shortmute_config.command(name='dm')
|
|
||||||
async def shortmute_config_dm(self, ctx: commands.Context, enabled: bool = None):
|
|
||||||
"""This command changes if the `/shortmute` slash command Direct Messages its target."""
|
|
||||||
old_value = await self.config.guild(ctx.guild.id).dm()
|
old_value = await self.config.guild(ctx.guild.id).dm()
|
||||||
if enabled:
|
if enabled:
|
||||||
await self.config.guild(ctx.guild.id).dm.set(enabled)
|
await self.config.guild(ctx.guild.id).dm.set(enabled)
|
||||||
|
|
Loading…
Reference in a new issue