Small cleanups, clarification on sync command

This commit is contained in:
fanyx 2024-01-23 17:57:37 +01:00
parent 13cc7a7f8a
commit 04a51e3695
1 changed files with 7 additions and 14 deletions

21
main.py
View File

@ -1,14 +1,12 @@
#!/bin/env python3
from typing import Literal, Optional
from emoji import emojize
from yaml import safe_load
import discord
from discord.ext import commands
from discord.ext.commands import Greedy, Context
from discord import app_commands, Embed
from discord import app_commands
from src.roles import AddRoleButton, RemoveRoleButton
from src.ui import RoleSelectView
class Bot(commands.Bot):
@ -34,18 +32,13 @@ roles = app_commands.Group(name="roles", description="Manage role dialogues")
@commands.guild_only()
@roles.command(name="create")
async def roles_create_button(interaction: discord.Interaction):
await interaction.response.send_message(
view=RoleSelectView(),
embed=Embed(
title="Available Roles:",
description="\n".join([
f"{interaction.client.get_emoji(role['emoji'])} {interaction.guild.get_role(role['id']).mention}"
for role in interaction.client.config['roles']
])
)
)
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()