Skip to content

Commit

Permalink
Add showFeedbackLink option
Browse files Browse the repository at this point in the history
  • Loading branch information
MycroftKang committed Mar 20, 2024
1 parent 79449f8 commit 3297a89
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 25 deletions.
52 changes: 32 additions & 20 deletions src/bot/core/controllers/discord/utils/MsgFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ def get(
name="Requested by", value="<@{}>".format(user_id), inline=False
)

embed.add_field(
value="[{0}](https://discord.gg/3RpDwjJCeZ)".format(__("Give Feedback ▷")),
name="",
inline=False,
)
if CONFIG.showFeedbackLink:
embed.add_field(
value="[{0}](https://discord.gg/3RpDwjJCeZ)".format(
__("Give Feedback ▷")
),
name="",
inline=False,
)

embed.set_footer(
text="Powered by Mulgyeol MK Bot",
Expand Down Expand Up @@ -129,11 +132,14 @@ def simple(
for fd in fields:
embed.add_field(**fd)

embed.add_field(
value="[{0}](https://discord.gg/3RpDwjJCeZ)".format(__("Give Feedback ▷")),
name="",
inline=False,
)
if CONFIG.showFeedbackLink:
embed.add_field(
value="[{0}](https://discord.gg/3RpDwjJCeZ)".format(
__("Give Feedback ▷")
),
name="",
inline=False,
)

embed.set_footer(
text="Powered by Mulgyeol MK Bot",
Expand All @@ -154,11 +160,14 @@ def push(title, description="", fields: list = []):
for fd in fields:
embed.add_field(**fd)

embed.add_field(
value="[{0}](https://discord.gg/3RpDwjJCeZ)".format(__("Give Feedback ▷")),
name="",
inline=False,
)
if CONFIG.showFeedbackLink:
embed.add_field(
value="[{0}](https://discord.gg/3RpDwjJCeZ)".format(
__("Give Feedback ▷")
),
name="",
inline=False,
)

embed.set_footer(
text="Powered by Mulgyeol MK Bot",
Expand Down Expand Up @@ -192,11 +201,14 @@ def abrt(ctx_or_iaction, issue_link, tb, show_req_user=True):

embed.add_field(name="Requested by", value="<@{}>".format(user_id))

embed.add_field(
value="[{0}](https://discord.gg/3RpDwjJCeZ)".format(__("Give Feedback ▷")),
name="",
inline=False,
)
if CONFIG.showFeedbackLink:
embed.add_field(
value="[{0}](https://discord.gg/3RpDwjJCeZ)".format(
__("Give Feedback ▷")
),
name="",
inline=False,
)

embed.set_footer(
text="Powered by Mulgyeol MK Bot",
Expand Down
14 changes: 9 additions & 5 deletions src/bot/core/controllers/discord/utils/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from core.controllers.discord.utils.command_helper import send
from mgylabs.i18n import __
from mgylabs.utils.config import VERSION, is_development_mode
from mgylabs.utils.config import CONFIG, VERSION, is_development_mode


class Feature:
Expand Down Expand Up @@ -45,10 +45,14 @@ async def outerfunc(*args, **kwargs):
else:
await send(
ctx_or_iaction,
__(
"This command is an experimental feature and only available when you have access to the **MK Bot Support Server**."
)
+ "\nhttps://discord.gg/3RpDwjJCeZ",
(
__(
"This command is an experimental feature and only available when you have access to the **MK Bot Support Server**."
)
+ "\nhttps://discord.gg/3RpDwjJCeZ"
if CONFIG.showFeedbackLink
else ""
),
)
return

Expand Down
3 changes: 3 additions & 0 deletions src/bot/discord_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ async def process_commands(self, request_id, message):

ctx = await self.get_context(message)

if ctx.command is None:
return False

if not await self.check_init_user_locale(ctx, message):
return False

Expand Down
1 change: 1 addition & 0 deletions src/lib/mgylabs/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Settings:
gitlabToken = SettingItem("")
mgylabsToken = SettingItem("")
enabledChatMode = SettingItem(False)
showFeedbackLink = SettingItem(True)
betaUpdate = SettingItem(False)

def __init__(self, data):
Expand Down

0 comments on commit 3297a89

Please sign in to comment.