Compare commits

...

4 Commits

2 changed files with 8 additions and 4 deletions

10
main.py
View File

@ -1,6 +1,5 @@
#!/bin/env python3
from typing import Literal, Optional
from emoji import emojize
from yaml import safe_load
import discord
@ -8,7 +7,6 @@ from discord.ext import commands
from discord.ext.commands import Greedy, Context
from discord import app_commands
from src.roles import AddRoleButton, RemoveRoleButton
from src.ui import RoleSelectView
class Bot(commands.Bot):
@ -31,11 +29,17 @@ roles = app_commands.Group(name="roles", description="Manage role dialogues")
# Commands
## Group: roles
@commands.guild_only()
@commands.has_permissions(administrator=True)
@roles.command(name="create")
async def roles_create_button(interaction: discord.Interaction):
await interaction.response.send_message(view=RoleSelectView())
# Sync using ,sync ~
# Sync using ,sync [~, *, ^]
# https://about.abstractumbra.dev/discord.py/2023/01/29/sync-command-example.html
# ~ -> Current guild
# * -> Global
# ^ -> Clear global tree, sync to current guild
@client.command()
@commands.guild_only()
@commands.is_owner()

View File

@ -9,7 +9,7 @@ class RoleSelectView(View):
super().__init__(timeout=None)
self.add_item(
AddRoleButton(
style=ButtonStyle.primary,
style=ButtonStyle.secondary,
label="Add Roles",
emoji=PartialEmoji.from_str(emojize(":check_mark_button:")),
custom_id="role_select:add"