From b7c3126e8d3a09146f12b9d3971ae51e1147dcd3 Mon Sep 17 00:00:00 2001 From: rutgerbeltman Date: Sun, 4 Sep 2022 23:44:47 +0100 Subject: [PATCH] rename cogmanagermixin to cogmanagermixin --- clanbotjas/cogmanager.py | 2 +- ...{cogManagerMixin.py => cogmanagermixin.py} | 0 clanbotjas/cogs/autorole.py | 2 +- clanbotjas/cogs/commands.py | 20 ++++++++++++++----- clanbotjas/cogs/pollbot.py | 2 +- clanbotjas/cogs/rolebot.py | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) rename clanbotjas/{cogManagerMixin.py => cogmanagermixin.py} (100%) diff --git a/clanbotjas/cogmanager.py b/clanbotjas/cogmanager.py index 9f5a15f..6b2b9b0 100644 --- a/clanbotjas/cogmanager.py +++ b/clanbotjas/cogmanager.py @@ -3,7 +3,7 @@ from discord import option import settings -from cogManagerMixin import commandlogger +from cogmanagermixin import commandlogger class CogManager(commands.Cog): diff --git a/clanbotjas/cogManagerMixin.py b/clanbotjas/cogmanagermixin.py similarity index 100% rename from clanbotjas/cogManagerMixin.py rename to clanbotjas/cogmanagermixin.py diff --git a/clanbotjas/cogs/autorole.py b/clanbotjas/cogs/autorole.py index 03650bf..aa40ee2 100644 --- a/clanbotjas/cogs/autorole.py +++ b/clanbotjas/cogs/autorole.py @@ -1,7 +1,7 @@ import discord from discord.ext import commands from discord.utils import get -from cogManagerMixin import commandlogger +from cogmanagermixin import commandlogger import settings diff --git a/clanbotjas/cogs/commands.py b/clanbotjas/cogs/commands.py index 98a90cc..b521018 100644 --- a/clanbotjas/cogs/commands.py +++ b/clanbotjas/cogs/commands.py @@ -6,24 +6,33 @@ from discord.ext import commands import settings -from cogManagerMixin import commandlogger +from cogmanagermixin import commandlogger + class SayCommandModal(discord.ui.Modal): def __init__(self) -> None: super().__init__(title="Modal via Slash Command") - self.add_item(discord.ui.InputText(label="Say command input", style=discord.InputTextStyle.long, max_length=2000)) + self.add_item( + discord.ui.InputText( + label="Say command input", + style=discord.InputTextStyle.long, + max_length=2000, + ) + ) async def callback(self, interaction: discord.Interaction): text = self.children[0].value for channel in interaction.client.get_all_channels(): - channelName = "#" + channel.name + channelName = "#" + channel.name if channelName in text: text = text.replace(channelName, channel.mention) for member in interaction.client.get_all_members(): memberName = "@" + member.name if memberName in text: text = text.replace(memberName, member.mention) - for role in await interaction.client.get_guild(settings.DISCORD_GUILD_ID).fetch_roles(): + for role in await interaction.client.get_guild( + settings.DISCORD_GUILD_ID + ).fetch_roles(): if role.name.startswith("@"): roleName = role.name else: @@ -31,10 +40,11 @@ async def callback(self, interaction: discord.Interaction): if roleName in text: text = text.replace(roleName, role.mention) - + await interaction.channel.send(text) await interaction.response.send_message("Message was sent.", ephemeral=True) + class Commands(commands.Cog): def __init__(self, client): self.client = client diff --git a/clanbotjas/cogs/pollbot.py b/clanbotjas/cogs/pollbot.py index a173cb9..f9c1ed3 100644 --- a/clanbotjas/cogs/pollbot.py +++ b/clanbotjas/cogs/pollbot.py @@ -8,7 +8,7 @@ from discord import option from discord.commands.options import OptionChoice -from cogManagerMixin import commandlogger, LogButton, LogSelect +from cogmanagermixin import commandlogger, LogButton, LogSelect import settings diff --git a/clanbotjas/cogs/rolebot.py b/clanbotjas/cogs/rolebot.py index c351f1b..6e940b7 100644 --- a/clanbotjas/cogs/rolebot.py +++ b/clanbotjas/cogs/rolebot.py @@ -7,7 +7,7 @@ from discord.commands import SlashCommandGroup import settings -from cogManagerMixin import commandlogger, LogButton +from cogmanagermixin import commandlogger, LogButton class RoleButton(LogButton):