Skip to content

An extremely modular discord bot. Instead of programming through the bot's internal code, program the bot through discord. Commands can be written in Python through the chat client, and are stored within an internal database.

Notifications You must be signed in to change notification settings

brandostrong/Cooke

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cooke

Info

An extremely modular discord bot. Inspired by an IRC bot named Shocky, which in turn was inspired by an IRC bot named Crow, a fork of Skybot. Instead of programming through the bot's internal code, program the bot through discord. Commands can be written in Python through the chat client, and are stored within an internal database.

Features include adding, removing, and listing commands, and has a fully function user and command whitelist. Commands can be fed any number of inputs, and are fully featured(with the exception of security and sandboxing). Add help info to your commands to make them more understandable!

Not up to date, and unmaintained for now, DM for more info.

Usage

Adding commands within Discord

?add commandname -language -type text

Possible values for language are -py and -js Possible values for type are -last, -ping, -text

  • -last will perform operations on the last message said in chat
  • -ping will properly ping a mentioned user in command arguments, last, or if not mentioned, the most recent.
  • -text will treat command text as plaintext and simply repeat

Multi Line Command Example:

?add pyadd -py 
import sys
x = 0
for i in sys.argv[2:]:
     x += int(i)
print(x)

This incorporates the -py flag to enable python code, shows that the bot can parse multi-line commands correctly, and demonstrates its ability to read arguments

?pyadd 1 2 3
Cooke: 6

Showing Commands

Use ?show commandname to see the associated info for a command

?show pyadd
cooke: pyadd -py
import sys
x = 0
for i in sys.argv[2:]:
     x += int(i)
print(x)

Editing Commands

Editing Commands works exactly like adding, following the same conventions, but with the ?edit command. Edits are saved and ?undo will be implemented in the future

?edit pyadd -py
import sys
x = 0
for i in sys.argv[2:]:
     x += int(i)
print("the answer to the add command is: " + str(x))

Removing Commands

Removing commands can be done with ?remove commandname

Whitelisting

Adding users to a whitelist will enable whitelisting, automatically excluding users not in the whitelist Adding can be done with ?whitelist userid Removing can be done with ?rwhitelist userid

If no users are contained within the whitelist, bot will revert to default whitelist-free usage

Protecting Commands

The ability to protect a command is vital to bot security, and while cannot be done within discord, feel free to edit the isProtected function to suit your needs

An Advanced Command

A command to uwu-fy the last message said

?add uwu -py -last 
import re
import sys
string = sys.argv[1]
string = re.sub(r'(?:r|l)', 'w', string)
string = re.sub(r'(?:R|L)', 'W', string)
string = re.sub(r'n([aeiou])', 'ny\1', string)
string = re.sub(r'N([aeiou])', 'Ny\1', string)
string = re.sub(r'N([AEIOU])', 'Ny\1', string)
string = re.sub(r'ove', 'uv', string)
print(string)

User:

Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. If the pattern isn’t found, string is returned unchanged. 
?uwu

Cooke:

Wetuwn the stwing obtainyed by wepwacing the weftmost nyon-uvwwapping occuwwences of pattewn in stwing by the wepwacement wepw. If the pattewn isn�t found, stwing is wetuwnyed unchanged.

About

An extremely modular discord bot. Instead of programming through the bot's internal code, program the bot through discord. Commands can be written in Python through the chat client, and are stored within an internal database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published