diff --git a/.gitignore b/.gitignore index e2480f7..0dc5734 100644 --- a/.gitignore +++ b/.gitignore @@ -101,43 +101,3 @@ venv.bak/ # mypy .mypy_cache/ - -# node/react crap -.DS_STORE -node_modules -scripts/flow/*/.flowconfig -.flowconfig -*~ -*.pyc -.grunt -_SpecRunner.html -__benchmarks__ -build2/ -remote-repo/ -coverage/ -.module-cache -fixtures/dom/public/react-dom.js -fixtures/dom/public/react.js -test/the-files-to-test.generated.js -*.log* -chrome-user-data -*.sublime-project -*.sublime-workspace -.idea -*.iml -.vscode -*.swp -*.swo - -packages/react-devtools-core/dist -packages/react-devtools-extensions/chrome/build -packages/react-devtools-extensions/chrome/*.crx -packages/react-devtools-extensions/chrome/*.pem -packages/react-devtools-extensions/firefox/build -packages/react-devtools-extensions/firefox/*.xpi -packages/react-devtools-extensions/firefox/*.pem -packages/react-devtools-extensions/shared/build -packages/react-devtools-extensions/.tempUserDataDir -packages/react-devtools-inline/dist -packages/react-devtools-shell/dist -packages/react-devtools-scheduling-profiler/dist diff --git a/aadiscordbot/cogs/abuse.py b/aadiscordbot/cogs/abuse.py index 1c3d69e..65d89a5 100644 --- a/aadiscordbot/cogs/abuse.py +++ b/aadiscordbot/cogs/abuse.py @@ -49,7 +49,7 @@ async def respond_to_abuse(self, message): "https://media.tenor.com/x8v1oNUOmg4AAAAC/rickroll-roll.gif" ] rand = randrange(0, len(replies) - 1) - if message.mention_everyone: + if message.mention_everyone or message.author.id == self.bot.user.id: return try: if self.bot.user.mentioned_in(message): diff --git a/aadiscordbot/cogs/tickets.py b/aadiscordbot/cogs/tickets.py index 694a18e..85acd16 100644 --- a/aadiscordbot/cogs/tickets.py +++ b/aadiscordbot/cogs/tickets.py @@ -1,9 +1,9 @@ # Cog Stuff import logging -from typing import Optional import discord from discord import ChannelType, Embed, Message, command, ui +from discord.commands import option from discord.ext import commands # AA Contexts @@ -27,6 +27,16 @@ def get_groups(): return out +THREAD_EMBED = Embed( + title="Private Thread Guide", + description=( + "To add a person to this thread simply `@ping` them. " + "This works with `@groups` as well to bulk add people " + "to the channel. Use wisely, abuse will not be tolerated." + ) +) + + class TicketDropdown(discord.ui.Select): """ Group Dropdown for discord message to summon a private help channel. @@ -42,15 +52,28 @@ async def callback(self, interaction: discord.Interaction): sup_channel = models.TicketGroups.get_solo().ticket_channel.channel ch = interaction.guild.get_channel(sup_channel) grp = discord.utils.get(interaction.guild.roles, name=self.values[0]) - th = await ch.create_thread(name=f"{interaction.user.display_name} | {self.values[0]} | {timezone.now().strftime('%Y-%m-%d %H:%M')}", - auto_archive_duration=10080, - type=discord.ChannelType.private_thread, - reason=None) - msg = f"<@{interaction.user.id}> needs help!, Someone from <@&{grp.id}> will get in touch soon!" - embd = Embed(title="Private Thread Guide", - description="To add a person to this thread simply `@ping` them. This works with `@groups` as well to bulk add people to the channel. Use wisely, abuse will not be tolerated.\n\nThis is a beta feature if you experience issues please contact the admins. :heart:") - await th.send(msg, embed=embd) - await interaction.response.send_message(content="Ping in the thread created for urgent help!", view=None, ephemeral=True) + th = await ch.create_thread( + name=( + f"{interaction.user.display_name} | " + f"{self.values[0]} | {timezone.now().strftime('%Y-%m-%d %H:%M')}" + ), + auto_archive_duration=10080, + type=discord.ChannelType.private_thread, + reason=None + ) + msg = ( + f"<@{interaction.user.id}> needs help!, Someone from" + f" <@&{grp.id}> will get in touch soon!" + ) + await th.send(msg, embed=THREAD_EMBED) + await interaction.response.send_message( + content=( + f"Check the thread created! {th.mention} " + "Ping in the thread for urgent help!" + ), + view=None, + ephemeral=True + ) class HelpView(ui.View): @@ -93,11 +116,74 @@ async def slash_close( if ch.type != ChannelType.private_thread: return await ctx.respond("Not a private thread!", ephemeral=True) await ctx.defer() - embd = Embed(title="Thread Marked Complete", - description=f"{ctx.user.display_name} has marked this thread as completed. To reopen simply start chatting again.") + embd = Embed( + title="Thread Marked Complete", + description=( + f"{ctx.user.display_name} has marked this thread as completed." + " To reopen simply start chatting again." + ) + ) await ctx.respond(embed=embd) return await ch.archive() + @command(name='help_targeted', guild_ids=[int(settings.DISCORD_GUILD_ID)]) + @option("character", description="What Character to add to the ticket") + @option("group", description="What Group to add to the ticket ") + async def slash_reverse_help( + self, + interaction, + character: discord.User = None, + group: discord.Role = None + ): + """ + Open a ticket and drag people in by force! + """ + if character is None and group is None: + return await interaction.response.send_message( + content="You need to pick someone to add...", + view=None, + ephemeral=True) + + mentions = [] + names = [] + if character is not None: + mentions.append(f"{character.mention} ") + names.append(character.display_name) + + if group is not None: + mentions.append(f"{group.mention} ") + names.append(group.name) + + mentions = ", ".join(mentions) + names = ", ".join(names) + sup_channel = models.TicketGroups.get_solo().ticket_channel.channel + ch = interaction.guild.get_channel(sup_channel) + + th = await ch.create_thread( + name=( + f"{interaction.user.display_name} |" + f" {names} | {timezone.now().strftime('%Y-%m-%d %H:%M')}" + ), + auto_archive_duration=10080, + type=discord.ChannelType.private_thread, + reason=None) + msg = f"<@{interaction.user.id}> has a question for: " + mentions = [] + if character is not None: + mentions.append(f"{character.mention} ") + + if group is not None: + mentions.append(f"{group.mention} ") + + msg += ", ".join(mentions) + + await th.send(msg, embed=THREAD_EMBED) + await interaction.response.send_message( + content=f"Check the thread created! {th.mention}", + view=None, + ephemeral=True + ) + @commands.message_command(name="Create Help Ticket", guild_ids=[int(settings.DISCORD_GUILD_ID)]) async def reverse_halp(self, ctx, message: Message): sup_channel = models.TicketGroups.get_solo().ticket_channel.channel @@ -107,16 +193,21 @@ async def reverse_halp(self, ctx, message: Message): files.append(a.proxy_url) _f = "\n".join(files) - th = await ch.create_thread(name=f"{message.author.display_name} | {message.id} | {timezone.now().strftime('%Y-%m-%d %H:%M')}", - #message=f"Ping in here if your request is urgent!", - auto_archive_duration=10080, - type=discord.ChannelType.private_thread, - reason=None) - msg = f"hi, <@{message.author.id}>, <@{ctx.author.id}> wants clarification on this message\n\n```{message.content}```\n\n{message.jump_url}\n{_f}" - embd = Embed(title="Private Thread Guide", - description="To add a person to this thread simply `@ping` them. This works with `@groups` as well to bulk add people to the channel. Use wisely, abuse will not be tolerated.") - - await th.send(msg, embed=embd) + th = await ch.create_thread( + name=( + f"{message.author.display_name} | " + f"{message.id} | {timezone.now().strftime('%Y-%m-%d %H:%M')}" + ), + auto_archive_duration=10080, + type=discord.ChannelType.private_thread, + reason=None + ) + msg = ( + f"hi, <@{message.author.id}>, <@{ctx.author.id}> " + "wants clarification on this message\n\n" + f"```{message.content}```\n\n{message.jump_url}\n{_f}" + ) + await th.send(msg, embed=THREAD_EMBED) def setup(bot):