# **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:
```bash
pip install simplecmd_discordpy
```
## Usage example
```python
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
```python
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`
```python
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")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "simplecmd-discordpy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "simplecmd discordpy comandos",
"author": "An\u00e3o Lenda",
"author_email": "4x0bfuscator@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ea/b0/2e8e8c8d77d7b741da19ad281ce4903149943767fb1acb8e931ae4497207/simplecmd_discordpy-2.0.1.tar.gz",
"platform": null,
"description": "# **simplecmd_discordpy**\n\n**(PT-BR):** Biblioteca simples para criar comandos no `discord.py`, ideal para iniciantes. N\u00e3o visa substituir outras bibliotecas, mas oferece uma maneira f\u00e1cil de configurar e organizar comandos para bots no Discord.\n\n**(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.\n\n---\n\n## **Instala\u00e7\u00e3o**\n\nPara instalar a biblioteca, execute o seguinte comando:\n```bash\npip install simplecmd_discordpy\n```\n\n\n## Usage example\n```python\nimport simplecmd_discordpy as scmd\nimport discord\n\nTOKEN = \"your_token_here\"\nscmd.config.set(logs=True, prefix=f\"$\") # Adiciona as configura\u00e7\u00f5es necess\u00e1rias\n\nintents = discord.Intents.default()\nintents.message_content = True\nclient = discord.Client(intents=intents)\n\n@scmd.command(\"ping\") # Fun\u00e7\u00e3o para criar comandos\nasync def ping_cmd(msg, client, *args):\n if args:\n await msg.channel.send(f\"Pong\ud83c\udfd3\" + ''.join(args[0]), reference=msg)\n else:\n await msg.channel.send(f\"Pong\ud83c\udfd3\", reference=msg)\n\n@client.event\nasync def on_message(message):\n if message.author.bot:\n return\n if message.author.id == client.user.id:\n return\n await scmd.load(message) # Carrega Todos Os Comandos\nclient.run(TOKEN)\n```\n\n## Example by Folder\n```python\nimport discord\nimport simplecmd_discordpy as scmd\n\nTOKEN = \"your_token_here\"\nscmd.config.set(logs=True, prefix=\"$\", folder=\"commands\") # Adiciona as configura\u00e7\u00f5es necess\u00e1rias\n\nintents = discord.Intents.default()\nintents.message_content = True\nclient = discord.Client(intents=intents)\n\n@client.event\nasync def on_message(message):\n if message.author.id == client.user.id:\n return\n await scmd.load_files(message, client) # Carrega todos os comandos por arquivo\n\nclient.run(TOKEN)\n```\n\n* J\u00e1 no arquivo `commands/say.py`\n```python\nimport discord\n\nasync def run(msg, client, *args):\n if args:\n # Se houver argumentos passados para o comando\n argumento = \" \".join(args) # Junta todos os argumentos em uma \u00fanica string\n await msg.channel.send(argumento)\n else:\n # Se n\u00e3o houver argumentos\n await msg.channel.send(\"Voc\u00ea precisa mencionar alguma coisa que o bot deve falar\")\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Uma biblioteca mais simples para a cria\u00e7\u00e3o de comandos no Discord.py",
"version": "2.0.1",
"project_urls": null,
"split_keywords": [
"simplecmd",
"discordpy",
"comandos"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "09484e2d3f3c0455ea47482a7ce110189794e14b57f961cb53592004bceb1726",
"md5": "dab163bdc968d562ba2d9b14db6a1967",
"sha256": "5bd04dc8caad93af987c1fa54af7d16af141d77457729fed893da447775e3256"
},
"downloads": -1,
"filename": "simplecmd_discordpy-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dab163bdc968d562ba2d9b14db6a1967",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 4170,
"upload_time": "2024-12-03T11:33:11",
"upload_time_iso_8601": "2024-12-03T11:33:11.586367Z",
"url": "https://files.pythonhosted.org/packages/09/48/4e2d3f3c0455ea47482a7ce110189794e14b57f961cb53592004bceb1726/simplecmd_discordpy-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eab02e8e8c8d77d7b741da19ad281ce4903149943767fb1acb8e931ae4497207",
"md5": "84329504fee7a4e878c3f97b175e6111",
"sha256": "47a8938ff539d949304c68db2c1aa6d18e1e99bd74511c03b7f68a3ff5d0d6ed"
},
"downloads": -1,
"filename": "simplecmd_discordpy-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "84329504fee7a4e878c3f97b175e6111",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 3915,
"upload_time": "2024-12-03T11:33:12",
"upload_time_iso_8601": "2024-12-03T11:33:12.684071Z",
"url": "https://files.pythonhosted.org/packages/ea/b0/2e8e8c8d77d7b741da19ad281ce4903149943767fb1acb8e931ae4497207/simplecmd_discordpy-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-03 11:33:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "simplecmd-discordpy"
}