rendello / pipe_bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cover image

pipe|bot is a Discord chatbot that allows you to chain multiple text commands together with pipes. It also supports arbritrary subgrouping.

Usage

Basic

pipe|bot runs text through commands and posts the results. Run a command by appending it to your message with the pipe character, « | ».

"Hello, world! | uppercase" will give you "HELLO, WORLD!"

You can chain together as many commands as you would like:

"Hello, world! | caps | zalgo | italics" gives "H͓̒͘E̜͒͜L̷̥ͥL͔̠̖Ǫ̼ͧ,̪̺͢ W̸̪͠Ǫ͛̀R̞̻̣L̶͑̇D̷͓͛"

You can run sub-groups between curly braces:

"Hello, {world! | redact}" gives "Hello, █████!"

Advanced

pipe|bot can use the text of previous messages with $LAST and $MESSAGE.

$LAST is replaced with the text of the last message in the channel. It can also take a @mention or an ID, and use that person's last channel message.

$MESSAGE is similar, but requires a message link or ID.

With both $LAST and $MESSAGE, the message text is escaped, so characters such as pipes and curly braces won't interfere with the current operations.

As a convenience, a $LAST is implied if a message starts with « | ».

Commands

CommandDescriptionExample
capsUppercaseUPPERCASE
lowercaseLowercaselowercase
swapcaseSwaps case per lettersWAPS CASE PER LETTER
base64Base64 encodedQmFzZTY0IGVuY29kZWQ=
binaryBinary representation1000010 1101001 1101110 1100001 1110010 1111001 100000 1110010 1100101 1110000 1110010 1100101 1110011 1100101 1101110 1110100 1100001 1110100 1101001 1101111 1101110
from_base64Text from base 64N/A
from_hexText from hexidecimalN/A
hexHexidecimal representation48 65 78 69 64 65 63 69 6d 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e
md5MD5 hash0205eacc79baf77a16ff08e24fbba67a
sha256SHA256 hash92dfe7a311aa63bf4e6171c23270b2181a011f735836cfa16a2355cc115f8a31
blockquoteBlock quote > Block quote
boldBold**Bold**
codeInline code tag`Inline code tag`
codeblockCode block``` Code block ```
italicItalics*Italics*
spoilerSpoiler tag||Spoiler tag||
underlineUnderline__Underline__
clapEmojis between words (default 👏)Emojis 👏 between 👏 words 👏 (default 👏 👏)
mockRandom upper/lowercaseRanDOm UppEr/LoWErCAsE
scrambleScrambled characterselmabSdrc taaechcsrr
uwuCursed UwU textCuwsed UwU text
zalgoSpooky zalgo textS̮͆p̹ͨo̩͚ȯ̓k̸ͬy̪̭ z̼̐ą͙l̐̽g̰ͭoͧ̓ t̀͠e͂ͫx͔̏t͘ͅ
blackletterOld timey blackletter𝔒𝔩𝔡 𝔱𝔦𝔪𝔢𝔶 𝔟𝔩𝔞𝔠𝔨𝔩𝔢𝔱𝔱𝔢𝔯
leetElite hacker text31I73 H4CK3R 73X7
redactLetters substituted for character (default █).███████ ███████████ ███ █████████ (███████ █).
serifUnicode serif font𝐔𝐧𝐢𝐜𝐨𝐝𝐞 𝐬𝐞𝐫𝐢𝐟 𝐟𝐨𝐧𝐭
upsidedownUnicode upside-down font∩uᴉɔopǝ ndsᴉpǝ-poʍu ɟouʇ
vaporwaveCJK full width lettersCJK full width letters

Installation

The bot can be added to your server with the following link:

[LINK]

You're encouraged to rehost the bot and modify it to your needs.

Modification and development

Source overview:

Source file Function
main.py The Discord bot itself. This is the file run to start the bot.
text_transform.py The hand-written lexer, parser, and generator. The grand majority of the bot's functionality is implemented here.
commands.py Data related to the bots commands, including aliases, descriptions, examples, and the names of callbacks.

The end of the file has useful data structures and regex patterns related to the commands.

command_funcs.py The callback functions for each command.
Related file Function
test.py Tests, mostly focusing on the lexer/parser/generator. Run with pytest.
utils.py Related utilities to debug the lexer and to generate the command table for the README.

Code is under the BSD simplified licence. See LICENCE.txt.

About

License:BSD 2-Clause "Simplified" License


Languages

Language:Python 100.0%