More docs to the discord bot

This commit is contained in:
klemek
2020-04-26 22:22:47 +02:00
parent 27a3ef87c5
commit 345ad32664
5 changed files with 53 additions and 33 deletions
+12
View File
@@ -15,6 +15,18 @@ Depending of the number of `"text"` arguments, several behavior occurs:
> * You don't have to use all texts shown on templates
> * You can use an empty text argument ( `""` ) to skip a text and keep it blank
## Discord features
Tag the bot and use the above syntax to get started. In addition, you can use the following commands:
* Use `help` to get a simple help message
* Use `list` to get a list of all meme ids
* Use `delete` to delete the last message sent by the bot (directed to you)
Enjoy the full experience of this bot by using direct messages to keep your server free of spam.
## List of templates
You can find here the full list of templates.
+23 -24
View File
@@ -31,7 +31,7 @@ def make_empty(target_dir):
make_empty(dst_dir)
make_empty(prev_dir)
ids = sorted(meme_db.DATA.keys())
ids = sorted(meme_db.LIST)
doc_content = "|" * (COLUMNS + 1) \
+ "\n|" + ":---:|" * COLUMNS
@@ -42,29 +42,28 @@ img_line = None
i = None
for i, meme_id in enumerate(ids):
meme = meme_db.get_meme(meme_id)
if meme is not None:
img = imgf.make(meme.template, meme.texts, debug=True)
if img is not None:
img.save(path.join(dst_dir, meme.template))
size = (round(img.size[0] * IMG_HEIGHT / img.size[1]), IMG_HEIGHT)
img2 = img.resize(size, resample=PIL.Image.LANCZOS)
img2.save(path.join(prev_dir, meme.template))
if i % COLUMNS == 0:
if info_line is not None and img_line is not None:
doc_content += info_line + img_line
info_line = "\n|"
img_line = "\n|"
info_line += f"**{meme_id}**"
if len(meme.aliases) > 0:
info_line += f"<br>alt: {', '.join(meme.aliases)}"
if meme.info is not None:
info_line += f"<br><a href='{meme.info}' target='_blank'>more info</a>"
info_line += "|"
img_line += f"" \
f"<a href='./templates/{meme.template}' target='_blank'>" \
f"<img alt='enlarge' src='./preview/{meme.template}'/>" \
f"</a>|"
print(i, meme_id)
img = imgf.make(meme.template, meme.texts, debug=True)
if img is not None:
img.save(path.join(dst_dir, meme.template))
size = (round(img.size[0] * IMG_HEIGHT / img.size[1]), IMG_HEIGHT)
img2 = img.resize(size, resample=PIL.Image.LANCZOS)
img2.save(path.join(prev_dir, meme.template))
if i % COLUMNS == 0:
if info_line is not None and img_line is not None:
doc_content += info_line + img_line
info_line = "\n|"
img_line = "\n|"
info_line += f"**{meme_id}**"
if len(meme.aliases) > 0:
info_line += f"<br>alt: {', '.join(meme.aliases)}"
if meme.info is not None:
info_line += f"<br><a href='{meme.info}' target='_blank'>more info</a>"
info_line += "|"
img_line += f"" \
f"<a href='./templates/{meme.template}' target='_blank'>" \
f"<img alt='enlarge' src='./preview/{meme.template}'/>" \
f"</a>|"
print(i, meme_id)
doc_content += "|" * (COLUMNS - (i % COLUMNS))