Compare commits
No commits in common. "7275c83e98685fd8ae5c3d217c600ff1ddc95697" and "0499339b000aed63257aed7087667d4281df28c5" have entirely different histories.
7275c83e98
...
0499339b00
10
main.py
10
main.py
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/env python3
|
#!/bin/env python3
|
||||||
from typing import Literal, Optional
|
from typing import Literal, Optional
|
||||||
|
from emoji import emojize
|
||||||
from yaml import safe_load
|
from yaml import safe_load
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
@ -7,6 +8,7 @@ from discord.ext import commands
|
||||||
from discord.ext.commands import Greedy, Context
|
from discord.ext.commands import Greedy, Context
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
|
|
||||||
|
from src.roles import AddRoleButton, RemoveRoleButton
|
||||||
from src.ui import RoleSelectView
|
from src.ui import RoleSelectView
|
||||||
|
|
||||||
class Bot(commands.Bot):
|
class Bot(commands.Bot):
|
||||||
|
@ -29,17 +31,11 @@ roles = app_commands.Group(name="roles", description="Manage role dialogues")
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
## Group: roles
|
## Group: roles
|
||||||
@commands.guild_only()
|
|
||||||
@commands.has_permissions(administrator=True)
|
|
||||||
@roles.command(name="create")
|
@roles.command(name="create")
|
||||||
async def roles_create_button(interaction: discord.Interaction):
|
async def roles_create_button(interaction: discord.Interaction):
|
||||||
await interaction.response.send_message(view=RoleSelectView())
|
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()
|
@client.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
|
|
|
@ -9,7 +9,7 @@ class RoleSelectView(View):
|
||||||
super().__init__(timeout=None)
|
super().__init__(timeout=None)
|
||||||
self.add_item(
|
self.add_item(
|
||||||
AddRoleButton(
|
AddRoleButton(
|
||||||
style=ButtonStyle.secondary,
|
style=ButtonStyle.primary,
|
||||||
label="Add Roles",
|
label="Add Roles",
|
||||||
emoji=PartialEmoji.from_str(emojize(":check_mark_button:")),
|
emoji=PartialEmoji.from_str(emojize(":check_mark_button:")),
|
||||||
custom_id="role_select:add"
|
custom_id="role_select:add"
|
||||||
|
|
Loading…
Reference in New Issue