Creates markov-chains from text gathered in a discord server to then post them or write them on images. And lots more…
Uses discord.py, markovify, python-pillow and pyfiglet
replace token on the last line
client.run('token')
with your bot token
make sure you have the correct libraries installed
start with python3.5 ebooks.py
or just invite the bot to your server with:
https://discordapp.com/oauth2/authorize?client_id=189772464161685506&scope=bot
set username to change my username (this only works twice per hour)
@ebooks set username newusername
set avatar to change my avatar
@ebooks set avatar http(s)://website.tld/imageurl
settings set to change an option
@ebooks settings set option value
settings show shows the currently set options
@ebooks settings show
meme text to get a dank meme (if no text is given a random sentence will be generated)
@ebooks meme_text sentence
meme image to get a meme_image (uses the last posted image on the server)
@ebooks meme_image meme
animated send an animated text message
@ebooks animated animation
ascii turns your message into huge ascii letters
@ebooks ascii string
information sends the current stats
@ebooks info
say sends a message to all mentioned channels
@ebooks say string #channel-mention1 #channel-mention2 … #channel-mentionN
invite to receive an invite link for another server
@ebooks invite
Set the slot machine items with
@ebooks settings set slot_machine emoji1 emoji2 emoji3 … emojiN
Yeah i know…
Alias: meme_txt, meme_text
Alias: meme_img, meme_image
Alias: info
Turns text into ascii:
When sadpanda
is set to true
the bot will post the info
when fakku
is set to true
the bot will post the info
If farewell
or greetings
is set to true
the bot will post a configurable message as soon as a new member joins/leaves.
set this message with
@ebooks settings set farewell_text/greetings_text **Hope to see you soon again, $member <3**
possible variables are:
-
$member will be replaced with the name of the new/leaving member
-
$mention will be replaced with a mention of that user
-
$server will be replaced with the name of that server
Mention @ebooks
and he will respond with a random sentence based on previous messages on the server (markov-chains).
You need to exchange a few dozen messages for this to properly work.
Questions are messages with a bot mention and ending on a ?
If the question contains an or
the bot will decide between the choices. You can add more choices with a ,
.
If no or
is included the bot presumes this is a yes/no question and sends an image-url to an anime girl saying either yes or no.
If a message contains the word sleep
or night
, the bot will respond with an image-url to a kagapost
If you include the word rate
in your message the bot will give a rating from 1 to 10.
For commands that only a certain role should be able to use, you can just use a role mention.
Every role that is higher in the role hierarchy will also have access to that command.
Currently those are:
- info (settings command)
- meme_img
- meme_txt
- image (the deprecated pic command)
- help
- ascii
- animated
- say
You can disable certain context cues by setting them to false
.
Currently those are:
The other options are:
If you don't give any further arguments every option will be displayed:
If you add the name of one option only that will be shown:
If you only want mentions and raw text add a quiet
at the end:
If you're hosting an instance yourself and want to manually edit the settings for a server, you can find a settings.json in every server directory (the directories are named after the server ids) Example:
{
"info": "236706075779268609",
"meme_img": "236706075779268609",
"question": true,
"greetings_text": "**Welcome $mention to __$server__**!",
"version": 6,
"image": "236706075779268609",
"slot_machine": [":pizza:", ":frog:", ":alien:", ":green_apple:", ":heart:"],
"fakku": true,
"sadpanda": true,
"farewell_text": "**Hope to see you soon again, $member <3**",
"meme_txt": "236706075779268609",
"help": "236706075779268609",
"options": "236806163763560449",
"rate": true,
"farewell": false,
"ascii": "236706075779268609",
"greetings": false,
"animated": "236706075779268609",
"sleep": true,
"say": "236806163763560449"
}
the version key is need to add new options to the settings file.
the long numbers resemble the role id.
Besides the usual code cleaning I should do and new memes, both commands meme image and meme text both use this json file: info.json
You can easily create new memes for these two commands by make pull requests for this file.
To add a new image for meme text add an entry in this form: (play around with the size, it's not pixel based.=
{
"memes_text": [
{
"image": "image name",
"image_url": "image url",
"style": "choose a style",
"size": {
"up": border top (integer),
"left": border left (integer),
"bottom": border bottom (integer),
"right": border right (integer),
"center": center point (integer)
}
}
]
}
If you want to use a different font, you can define a new style like this:
{
"styles": {
"manga00": {
"font": "font name",
"font_size": font size,
"font_color": "font color in hex-decimal",
"font_url": "a link to the font"
}
}
To add a new meme for meme image add an entry in this form: (if background
is set to true
the original image will be placed on top. background_color
defines a background color for transparent images in RGBA notation.)
{
"memes_images": {
"name of meme": {
"image": "image name",
"image_url": "image url",
"background" : bool
"background_color" : [0,0,0,0]
}
}
}
#License ebooks uses a gpl license available here