A Command-like discord message handler for discord.
Project description
MessageHandler
This is a discord handler for people who use discord.Client but want to use the bot like discord.ext that is developed by Tim232.
Example :
main.py
import discord
from handler import Handler
client = discord.Client()
mHandler = Handler(client=client, directory="modules", prefix="!", help_command=True)
@client.event
async def on_ready():
print(client.user.id)
@client.event
async def on_message(message):
await mHandler.process_messages(message)
client.run("token")
modules/test.py
import discord
async def run(client, message):
if message.content.startswith("!Test"):
await message.channel.send("Example")
await message.channel.send(client.user.avatar_url)
if message.content == "!example":
await message.channel.send("Test")
content_key = ["!example"]
startswith_key = ["!Test"]
- The handler automatically generates
{prefix}help
command if client'shelp_command
isTrue
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file MessageHandler-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: MessageHandler-1.0.2-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 662c99a4f1e18c566a436c56fb4b06f7f57d479358d43a73eca1e8569fbf998a |
|
MD5 | 2a18e214874ccac4d1b895a28cb0b131 |
|
BLAKE2b-256 | 98be21bfa45cae067a873c99b2a5aa361392d5f57ff004b86cf2f00e75628321 |