1.1.0 #352

Merged
edraft merged 145 commits from 1.1.0 into master 2023-08-24 17:50:25 +02:00
5 changed files with 103 additions and 27 deletions
Showing only changes of commit 0a3affc5d0 - Show all commits

View File

@ -157,6 +157,12 @@
"message": "{} hat eine Beschwerde eingereicht:\n{}",
"response": "Danke für deine Beschwerde"
},
"bug": {
"title": "Bug melden",
"label": "Bug",
"message": "{} meldet einen Bug:\n{}",
"response": "Danke für dein Feedback :D"
},
"afk_command_channel_missing_message": "Zu unfähig einem Sprachkanal beizutreten?",
"afk_command_move_message": "Ich verschiebe dich ja schon... (◔_◔)",
"game_server": {

View File

@ -8,7 +8,6 @@ from bot_core.abc.module_abc import ModuleABC
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from modules.base.abc.base_helper_abc import BaseHelperABC
from modules.base.command.afk_command import AFKCommand
from modules.base.command.complaint_command import ComplaintCommand
from modules.base.command.game_server_group import GameServerGroup
from modules.base.command.help_command import HelpCommand
from modules.base.command.info_command import InfoCommand
@ -17,6 +16,7 @@ from modules.base.command.ping_command import PingCommand
from modules.base.command.presence_command import PresenceCommand
from modules.base.command.purge_command import PurgeCommand
from modules.base.command.register_group import RegisterGroup
from modules.base.command.submit_group import SubmitGroup
from modules.base.command.unregister_group import UnregisterGroup
from modules.base.command.user_group import UserGroup
from modules.base.events.base_on_command_error_event import BaseOnCommandErrorEvent
@ -37,6 +37,7 @@ from modules.base.events.base_on_voice_state_update_event_help_channel import (
from modules.base.events.base_on_voice_state_update_event_scheduled_event_bonus import (
BaseOnVoiceStateUpdateEventScheduledEventBonus,
)
from modules.base.forms.bug_report_form import BugReportForm
from modules.base.forms.complaint_form import ComplaintForm
from modules.base.helper.base_reaction_handler import BaseReactionHandler
from modules.base.service.base_helper_service import BaseHelperService
@ -58,11 +59,12 @@ class BaseModule(ModuleABC):
services.add_transient(UserWarningsService)
# forms
services.add_singleton(BugReportForm)
services.add_singleton(ComplaintForm)
# commands
self._dc.add_command(AFKCommand)
self._dc.add_command(ComplaintCommand)
self._dc.add_command(SubmitGroup)
self._dc.add_command(HelpCommand)
self._dc.add_command(InfoCommand)
self._dc.add_command(MassMoveCommand)

View File

@ -1,25 +0,0 @@
from cpl_core.logging import LoggerABC
from cpl_discord.command import DiscordCommandABC
from cpl_discord.service import DiscordBotServiceABC
from discord.ext import commands
from discord.ext.commands import Context
from bot_core.helper.command_checks import CommandChecks
from modules.base.forms.complaint_form import ComplaintForm
class ComplaintCommand(DiscordCommandABC):
def __init__(self, logger: LoggerABC, bot: DiscordBotServiceABC, form: ComplaintForm):
DiscordCommandABC.__init__(self)
self._logger = logger
self._bot = bot
self._form = form
@commands.hybrid_command()
@commands.guild_only()
@CommandChecks.check_is_ready()
async def complaint(self, ctx: Context):
self._logger.debug(__name__, f"Received command complaint {ctx}")
await ctx.interaction.response.send_modal(self._form)
self._logger.trace(__name__, f"Finished command complaint {ctx}")

View File

@ -0,0 +1,43 @@
from cpl_core.logging import LoggerABC
from cpl_discord.command import DiscordCommandABC
from cpl_discord.service import DiscordBotServiceABC
from discord.ext import commands
from discord.ext.commands import Context
from bot_core.helper.command_checks import CommandChecks
from modules.base.forms.bug_report_form import BugReportForm
from modules.base.forms.complaint_form import ComplaintForm
class SubmitGroup(DiscordCommandABC):
def __init__(
self, logger: LoggerABC, bot: DiscordBotServiceABC, complaint_form: ComplaintForm, bug_form: BugReportForm
):
DiscordCommandABC.__init__(self)
self._logger = logger
self._bot = bot
self._complaint_form = complaint_form
self._bug_form = bug_form
@commands.hybrid_group()
@commands.guild_only()
async def submit(self, ctx: Context):
pass
@submit.command()
@commands.guild_only()
@CommandChecks.check_is_ready()
async def complaint(self, ctx: Context):
self._logger.debug(__name__, f"Received command complaint {ctx}")
await ctx.interaction.response.send_modal(self._complaint_form)
self._logger.trace(__name__, f"Finished command complaint {ctx}")
pass
@submit.command()
@commands.guild_only()
@CommandChecks.check_is_ready()
async def bug_report(self, ctx: Context):
self._logger.debug(__name__, f"Received command complaint {ctx}")
await ctx.interaction.response.send_modal(self._bug_form)
self._logger.trace(__name__, f"Finished command complaint {ctx}")

View File

@ -0,0 +1,50 @@
import discord
from cpl_core.database.context import DatabaseContextABC
from cpl_discord.service import DiscordBotServiceABC
from cpl_translation import TranslatePipe
from discord import ui, TextStyle
from bot_core.abc.message_service_abc import MessageServiceABC
from bot_core.configuration.bot_settings import BotSettings
from bot_core.logging.command_logger import CommandLogger
from modules.base.service.base_helper_service import BaseHelperService
class BugReportForm(ui.Modal):
description = ui.TextInput(label="Report a bug", required=True, style=TextStyle.long)
def __init__(
self,
bot_settings: BotSettings,
bot: DiscordBotServiceABC,
db: DatabaseContextABC,
logger: CommandLogger,
message_service: MessageServiceABC,
base_helper: BaseHelperService,
t: TranslatePipe,
):
ui.Modal.__init__(self, title=t.transform("modules.base.bug.title"))
self._bot_settings = bot_settings
self._bot = bot
self._db = db
self._message_service = message_service
self._logger = logger
self._base_helper = base_helper
self._t = t
self.description.label = t.transform("modules.base.bug.label")
async def on_submit(self, interaction: discord.Interaction):
self._logger.debug(__name__, f"Started bug report form")
for t in self._bot_settings.technicians:
member = self._bot.get_user(t)
await self._message_service.send_dm_message(
self._t.transform("modules.base.bug.message").format(interaction.user.mention, self.description.value),
member,
without_tracking=True,
)
await self._message_service.send_interaction_msg(interaction, self._t.transform("modules.base.bug.response"))
self._logger.trace(__name__, f"Finished bug report form")