Welcome to discord-rebot (py)
discordRebot is a RegEx based command mapping discord BOT framework with authorization.
Why discordRebot?
discordRebot is easy to use, minimal, and async ready framework using discord.py
Most of the bots uses a single prefix, string to match command and args
split by spaces, example !cmd arg1 arg2.
But discordRebot uses RegEx for both matching the command and capturing the arguments. It gives more control over both matching the command and parsing arguments.
Also, it provides authorization to authorize the author of the message before executing the command.
Basic Example
A minimal bot with echo command
from discordRebot import *
client = discord.Client()
key = Mapper()
@key(re.compile(r"^!echo (.*)$")) # Eg: '!echo hello' -> 'hello'
def echo(msg, string):
return string
echo.auth = None
client.event(Manager(key).on_message)
import os; client.run(os.environ["DBToken"])
You can find more examples in the examples directory.
Features
-
It also supports
Example:
@key(re.compile(r"^!ticker (\d*) (\d*)$")) async def ticker(msg, delay, to): delay, to = int(delay), int(to) for i in range(to): yield i await asyncio.sleep(delay)
-
Authorizes the message author
based on- user_id example:
1234567890 - user_name example:
'user#1234' - roles server (not applicable for DM)
- permissions of members in server (not applicable for DM)
- custom Callable[[author], bool]
Example:
@key("am i authorized ?") def amiauthorized(msg): return "Authorized" amiauthorized.auth = {1234567890, 'user#1234'} # only executable by user1 (with id 1234567890) and user2 (with username 'user#1234')
- user_id example:
-
Can match multiple commands with a message
Example:
@key(re.compile(r"^([\s\S]*)$")) def printmsg(msg, content): print(f"@{msg.author}:") print(content) @key("whereami") def whereami(msg): if msg.guild: return msg.guild.name else: return "DM"
Links
discordpy-ext-rebot comming soon (for full featured Discord Bot with RegEx based argparser)
Metadata
Release files for discord-rebot 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| discord-rebot-0.0.2.tar.gz | 13.3 kB | Without provenance | Details for discord-rebot-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| discord_rebot-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for discord_rebot-0.0.2-py3-none-any.whl |
Total release size: 26.6 kB
Release files / discord-rebot-0.0.2.tar.gz
| Download URL | discord-rebot-0.0.2.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe052dda9cb5e026b06b2a2a79dc207318626b178a0e495fc8311f2dd5ca9f9c
|
|
BLAKE2b-256 checksum How to use checksums |
ca90ad502d73330fc15170adabc150bdc47093b3646c842ba56fb535a7110ee3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.3 Linux/5.4.43-1-MANJARO
|
Release files / discord_rebot-0.0.2-py3-none-any.whl
| Download URL | discord_rebot-0.0.2-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1396c27c4e62e825a9015dfccc64ec8853ac66fb7a0eab9d25fe7f2568f1d9c4
|
|
BLAKE2b-256 checksum How to use checksums |
80178cc15384c1b7af801143c888bd484146429031c688cb5471884ddd3c45a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.3 Linux/5.4.43-1-MANJARO
|
Security for discord-rebot 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.