Skip to content

Commit

Permalink
Add role react basic functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Nov 13, 2023
1 parent b44ebc5 commit 430dd06
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ message_bruh.py
.run
*.run.xml
*.db
run_heckbot.bat
run_heckbot.sh
*.csv

# Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks
Expand Down
1 change: 1 addition & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class HeckBot(commands.Bot):
'moderation',
'poll',
'react',
'roles',
]

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
aiohttp~=3.8.4
colorama~=0.4.6
discord~=2.2.2
discord~=2.3.2
dpytest~=0.6.4
heckbot
pynacl~=1.5.0
Expand Down
47 changes: 47 additions & 0 deletions src/heckbot/cogs/roles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from __future__ import annotations

import asyncio

import discord
from discord.ext import commands
from discord.ext.commands import Bot
from discord.ext.commands import Context
from heckbot.adapter.reaction_table_adapter import ReactionTableAdapter

from bot import HeckBot


class Roles(commands.Cog):
"""
Cog for enabling role-selection related features in the bot.
"""

def __init__(
self,
bot: HeckBot,
) -> None:
"""
Constructor method
:param bot: Instance of the running Bot
"""
self._bot = bot

@commands.command(aliases=['createrolesmessage', 'createrolesmsg'])
@commands.has_permissions(kick_members=True)
@commands.bot_has_permissions(kick_members=True)
async def create_roles_message(self, ctx: Context):
"""
Sends a role-reaction-enabled message in the current chat.
:param ctx: Context of the command
"""
await ctx.author.send(f'{ctx.guild.roles}')


async def setup(
bot: HeckBot,
) -> None:
"""
Setup function for registering the react-match cog.
:param bot: Instance of the running Bot
"""
await bot.add_cog(Roles(bot))

0 comments on commit 430dd06

Please sign in to comment.