Skip to content

Commit

Permalink
Merge pull request #80 from 00-kat/helpers
Browse files Browse the repository at this point in the history
Allow helpers to move messages and turn messages into #help posts
  • Loading branch information
mitchellh authored Dec 29, 2024
2 parents 1bf6f44 + d7ebbdc commit e5c36a6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
BOT_HELP_CHANNEL_ID=7635317444894061557
BOT_MEDIA_CHANNEL_ID=1245859287631622769
BOT_MOD_ROLE_ID=1245855561015099402
BOT_SHOWCASE_CHANNEL_ID=1245859287634524358
BOT_MOD_ROLE_ID=1245855561015099402
BOT_HELPER_ROLE_ID=1245855736495049483
BOT_TOKEN=CdwafxF9MTRvxKKtXpeqKdI4qE.P5PKdC.ke2veU7KdecW5jxgTu-5fgCUssNlPAdNf3tsG7
GITHUB_ORG=ghostty-org
GITHUB_REPOS=main:ghostty,bot:discord-bot,web:website
Expand Down
4 changes: 3 additions & 1 deletion app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@

HELP_CHANNEL_ID = int(os.environ["BOT_HELP_CHANNEL_ID"])
MEDIA_CHANNEL_ID = int(os.environ["BOT_MEDIA_CHANNEL_ID"])
MOD_ROLE_ID = int(os.environ["BOT_MOD_ROLE_ID"])
SHOWCASE_CHANNEL_ID = int(os.environ["BOT_SHOWCASE_CHANNEL_ID"])

MOD_ROLE_ID = int(os.environ["BOT_MOD_ROLE_ID"])
HELPER_ROLE_ID = int(os.environ["BOT_HELPER_ROLE_ID"])
6 changes: 3 additions & 3 deletions app/features/move_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from app import view
from app.setup import bot
from app.utils import SERVER_ONLY, is_dm, is_mod
from app.utils import SERVER_ONLY, is_dm, is_helper, is_mod
from app.view import HelpPostTitle


Expand All @@ -18,7 +18,7 @@ async def move_message(
"""
assert not is_dm(interaction.user)

if not is_mod(interaction.user):
if not (is_mod(interaction.user) or is_helper(interaction.user)):
await interaction.response.send_message(
"You do not have permission to move messages.", ephemeral=True
)
Expand All @@ -43,7 +43,7 @@ async def turn_into_help_post(
"""
assert not is_dm(interaction.user)

if not is_mod(interaction.user):
if not (is_mod(interaction.user) or is_helper(interaction.user)):
await interaction.response.send_message(
"You do not have permission to use this action.", ephemeral=True
)
Expand Down
4 changes: 4 additions & 0 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def is_mod(member: discord.Member) -> bool:
return member.get_role(config.MOD_ROLE_ID) is not None


def is_helper(member: discord.Member) -> bool:
return member.get_role(config.HELPER_ROLE_ID) is not None


async def try_dm(account: Account, content: str) -> None:
try:
await account.send(content)
Expand Down

0 comments on commit e5c36a6

Please sign in to comment.