simplecmd_discordpy
(PT-BR): Biblioteca simples para criar comandos no discord.py, ideal para iniciantes. Não visa substituir outras bibliotecas, mas oferece uma maneira fácil de configurar e organizar comandos para bots no Discord.
(ENG): A simple library to create commands for discord.py, perfect for beginners. It doesn't aim to replace other libraries, but provides an easier way to set up and organize commands for Discord bots.
Instalação
Para instalar a biblioteca, execute o seguinte comando:
pip install simplecmd_discordpy
Usage example
import simplecmd_discordpy as scmd
import discord
TOKEN = "your_token_here"
scmd.config.set(logs=True, prefix=f"$") # Adiciona as configurações necessárias
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
@scmd.command("ping") # Função para criar comandos
async def ping_cmd(msg, client, *args):
if args:
await msg.channel.send(f"Pong🏓" + ''.join(args[0]), reference=msg)
else:
await msg.channel.send(f"Pong🏓", reference=msg)
@client.event
async def on_message(message):
if message.author.bot:
return
if message.author.id == client.user.id:
return
await scmd.load(message) # Carrega Todos Os Comandos
client.run(TOKEN)
Example by Folder
import discord
import simplecmd_discordpy as scmd
TOKEN = "your_token_here"
scmd.config.set(logs=True, prefix="$", folder="commands") # Adiciona as configurações necessárias
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
@client.event
async def on_message(message):
if message.author.id == client.user.id:
return
await scmd.load_files(message, client) # Carrega todos os comandos por arquivo
client.run(TOKEN)
- Já no arquivo
commands/say.py
import discord
async def run(msg, client, *args):
if args:
# Se houver argumentos passados para o comando
argumento = " ".join(args) # Junta todos os argumentos em uma única string
await msg.channel.send(argumento)
else:
# Se não houver argumentos
await msg.channel.send("Você precisa mencionar alguma coisa que o bot deve falar")
Release files for simplecmd-discordpy 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simplecmd_discordpy-2.0.1.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simplecmd_discordpy-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / simplecmd_discordpy-2.0.1.tar.gz
| Download URL | simplecmd_discordpy-2.0.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47a8938ff539d949304c68db2c1aa6d18e1e99bd74511c03b7f68a3ff5d0d6ed
|
|
BLAKE2b-256 checksum How to use checksums |
eab02e8e8c8d77d7b741da19ad281ce4903149943767fb1acb8e931ae4497207
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.0 CPython/3.12.7
|
Release files / simplecmd_discordpy-2.0.1-py3-none-any.whl
| Download URL | simplecmd_discordpy-2.0.1-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5bd04dc8caad93af987c1fa54af7d16af141d77457729fed893da447775e3256
|
|
BLAKE2b-256 checksum How to use checksums |
09484e2d3f3c0455ea47482a7ce110189794e14b57f961cb53592004bceb1726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.0 CPython/3.12.7
|