Многие используют from discord_slash import SlashCommandСмелое заявление о библиотеке, которая не обновлялась с 2021 года. У нее уже даже архивный репозиторий удалили и ссылка ведет на interactions.py.
Как создать слеш команды на discord.py?Открыть examples библиотеки, например basic.py, вставить свой токен и запустить. Все примеры снабжены исчерпывающими комментариями.
error: can't find Rust compiler
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain
from unicodedata import normalize
def eq_nfc(str1, str2):
return normalize('NFC', str1) == normalize('NFC', str2)
@bot.command
async def mute(ctx, member: discord.Member):
await member.edit(mute=True)
@client.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.Member, *, reason = None):
await member.ban(reason = reason)
Все сложные случаи гуглюИз старого Beazley - Python Cookbook, хоть и написана для 3.3 классика различных приемов.
как должна выглядеть хорошая масштабируемая архитектураArchitecture Patterns with Python
не знаю как ...отвечает гугл. Если вы используете тег Python потрудитесь представить вашу попытку решения.
async def setdelay(ctx, seconds: int):
await ctx.channel.edit(slowmode_delay=seconds)
guild_ids=[TESTING_GUILD_ID]
, но и в этом случае команды нужно синхронизировать. @disnake.ui.button(label="Disable the view", style=disnake.ButtonStyle.grey)
async def disable_button(self, button: disnake.ui.Button, inter: disnake.MessageInteraction):
# We disable every single component in this view
for child in self.children:
if isinstance(child, disnake.ui.Button):
child.disabled = True
# make sure to update the message with the new buttons
await inter.response.edit_message(view=self)
This function is not guaranteed to be the first event called. Likewise, this function is not guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.