Browse Source

changed cat and dog image source to reddit

cleaned requirements
updated help + command list
master
Angerstoner 6 years ago
parent
commit
a15b4e427e
  1. 16
      misc/commandlist
  2. 1
      misc/requirements.txt
  3. 8
      reddit.py
  4. 46
      schneiderbot.py

16
misc/commandlist

@ -1,18 +1,18 @@
mensa - [TAG/full/veggy/fleisch/fisch] essen in der mensa, filter möglich mensa - [TAG/full/veggy/fleisch/fisch] essen in der mensa, filter möglich
cat - cat pic
dog - dog pic
wrongdog - post from /r/whatswrongwithyourdog
hamster - hamster pic
cat - random cat image (using reddit.com/r/cats)
dog - random dog image (using reddit.com/r/dogs)
hamster - random dog image (using reddit.com/r/hamsters)
wrongdog - random wrongdog image (using reddit.com/r/whatswrongwithyourdog)
catdog - catdog pic catdog - catdog pic
reddit - [subreddit] random submission from reddit.com/r/[subreddit]
reddit_img - [subreddit] random image submission from reddit.com/r/[subreddit]
codinglove - random gif from the coding love codinglove - random gif from the coding love
reddit - [sub] random post from given subreddit
reddit_img - [sub] random image post from given subreddit
manta - boah ey, geile Karre! manta - boah ey, geile Karre!
magie - Magie ist Physik durch wollen magie - Magie ist Physik durch wollen
goodlife - gimme some goodlife
kill - kill me pls kill - kill me pls
revive - unkill me pls revive - unkill me pls
goodlife - gimme some goodlife
shrug - ¯\_(ツ)_/¯ shrug - ¯\_(ツ)_/¯
simon - bitte haustier oder andere Beschäftigung suchen simon - bitte haustier oder andere Beschäftigung suchen
sudo - kill/revive for real pls sudo - kill/revive for real pls
graveyard - show me the dead people
graveyard - show me the dead people

1
misc/requirements.txt

@ -1,5 +1,4 @@
python-telegram-bot python-telegram-bot
telegram telegram
requests requests
git+git://github.com/xNinjaKittyx/pydog.git#egg=pydog
praw praw

8
reddit.py

@ -80,6 +80,14 @@ def hamster(bot, update):
reddit_img(bot, update, ['hamsters']) reddit_img(bot, update, ['hamsters'])
def cat(bot, update):
reddit_img(bot, update, ['cats'])
def dog(bot, update):
reddit_img(bot, update, ['dogs'])
def reddit(bot, update, args): def reddit(bot, update, args):
if not args: if not args:
update.message.reply_text("Geile, sag sub") update.message.reply_text("Geile, sag sub")

46
schneiderbot.py

@ -4,13 +4,11 @@ import datetime
import logging import logging
import random import random
import pydog
import requests
from telegram import ParseMode from telegram import ParseMode
from telegram.ext import Updater, CommandHandler from telegram.ext import Updater, CommandHandler
from coding_love import send_coding_love_gif from coding_love import send_coding_love_gif
from reddit import wrong_dog, hamster, reddit, reddit_img, toggle_four_twenty, four_twenty
from reddit import wrong_dog, hamster, reddit, reddit_img, toggle_four_twenty, four_twenty, cat, dog
from schneiderbot_twitter import toggle_pepito_for_group, check_pepito_and_post_auto, check_pepito_and_post_manually from schneiderbot_twitter import toggle_pepito_for_group, check_pepito_and_post_auto, check_pepito_and_post_manually
from db import Db from db import Db
from mensa import mensa from mensa import mensa
@ -40,43 +38,41 @@ with open("res/simon.txt", "r") as tmp_file:
def start(bot, update): def start(bot, update):
"""Was ist das hier für eins Bot?""" """Was ist das hier für eins Bot?"""
update.message.reply_text("""Hallo, ich bin ein Bot. update.message.reply_text("""Hallo, ich bin ein Bot.
Ich liefere tolle Informationen über die Mensa. Die Infos kommen von
Ich liefere tolle Informationen über die Mensa, Katzenbilder, Hundebilder und andere _tolle_ Sachen. Die Infos kommen von
https://mensa.schneider-hosting.de https://mensa.schneider-hosting.de
Mhmm, lecker. Guten Appetit!""")
Mhmm, lecker. Guten Appetit!""", parse_mode=ParseMode.MARKDOWN)
def help(bot, update): def help(bot, update):
"""Send a message when the command /help is issued.""" """Send a message when the command /help is issued."""
update.message.reply_text("""Commands:
reply_text = """Commands:
*Mensa*: *Mensa*:
/mensa _mensa_ - prints filtered list of meals for _mensa_ (if no _mensa_ given, zentralmensa is used) /mensa _mensa_ - prints filtered list of meals for _mensa_ (if no _mensa_ given, zentralmensa is used)
/mensa _mensa_ full - prints full list of meals for _mensa_ (if no _mensa_ given, zentralmensa is used) /mensa _mensa_ full - prints full list of meals for _mensa_ (if no _mensa_ given, zentralmensa is used)
*Fun*:
/cat - random cat (using thecatapi.com)
/dog - random dog (using dog.ceo/dog-api)
/codinglove - random gif from the coding love (https://thecodinglove.com)
*Reddit*:
/cat - random cat image (using reddit.com/r/cats)
/dog - random dog image (using reddit.com/r/dogs)
/hamster - random dog image (using reddit.com/r/hamsters)
/wrongdog - random wrongdog image (using reddit.com/r/whatswrongwithyourdog)
/reddit subreddit - random submission from reddit.com/r/subreddit
/reddit\_img subreddit - random image submission from reddit.com/r/subreddit
*Quotes*:
/magie - random Axel Stoll quote /magie - random Axel Stoll quote
/manta - random Opel Manta joke /manta - random Opel Manta joke
/goodlife - random good life quote /goodlife - random good life quote
*Other fun stuff*:
/codinglove - random gif from the coding love (https://thecodinglove.com)
/shrug - prints shrug /shrug - prints shrug
/kill - kills you /kill - kills you
/revive - revives you /revive - revives you
/sudo kill/revive - force kill/revive /sudo kill/revive - force kill/revive
/graveyard - shows the dead people /graveyard - shows the dead people
/help - this help text""", parse_mode=ParseMode.MARKDOWN)
def send_cat(bot, update):
"""CUTE"""
cat_file = requests.get('http://aws.random.cat/meow').json()['file']
bot.send_photo(chat_id=update.message.chat_id, photo=cat_file)
def send_dog(bot, update):
"""CUTE 2.0"""
dog = pydog.PyDog()
bot.send_photo(chat_id=update.message.chat_id, photo=dog.get_random_image())
/help - this help text"""
print(reply_text)
update.message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN)
def kill(bot, update, sudocall=False): def kill(bot, update, sudocall=False):
@ -194,8 +190,8 @@ def init_commands(dp):
dp.add_handler(CommandHandler("goodlife", goodlife)) dp.add_handler(CommandHandler("goodlife", goodlife))
dp.add_handler(CommandHandler("mensa", mensa, pass_args=True)) dp.add_handler(CommandHandler("mensa", mensa, pass_args=True))
dp.add_handler(CommandHandler("sudo", sudo, pass_args=True)) dp.add_handler(CommandHandler("sudo", sudo, pass_args=True))
dp.add_handler(CommandHandler("cat", send_cat))
dp.add_handler(CommandHandler("dog", send_dog))
dp.add_handler(CommandHandler("cat", cat))
dp.add_handler(CommandHandler("dog", dog))
dp.add_handler(CommandHandler("catdog", send_cat_dog)) dp.add_handler(CommandHandler("catdog", send_cat_dog))
dp.add_handler(CommandHandler("shrug", shrug)) dp.add_handler(CommandHandler("shrug", shrug))
dp.add_handler(CommandHandler("kill", kill)) dp.add_handler(CommandHandler("kill", kill))

Loading…
Cancel
Save