Skip to content

Instantly share code, notes, and snippets.

@RoyTakanen
Created July 13, 2020 12:23
Show Gist options
  • Save RoyTakanen/efe70fb114d1fb57ae0b18b52a0948dc to your computer and use it in GitHub Desktop.
Save RoyTakanen/efe70fb114d1fb57ae0b18b52a0948dc to your computer and use it in GitHub Desktop.
Free Game Finder Bot Telegram
import praw
import time
import telebot
import threading
reddit = praw.Reddit(client_id="",
client_secret="",
user_agent="Free Game Finder // praw")
bot = telebot.TeleBot("")
naytetytpelit = []
id = []
@bot.message_handler(func=lambda m: True)
def echo_all(message):
if message.chat.id not in id:
print(f'Uusi chat lisätty id:llä {message.chat.id}')
id.append(message.chat.id)
pollaus = threading.Thread(target=bot.polling)
pollaus.start()
while True:
for submission in reddit.subreddit("FreeGameFindings").hot(limit=10):
if submission.title not in naytetytpelit:
print(f'Uusi peli löydetty: {submission.title}')
for x in id:
bot.send_message(x, f'<b>Uusi peli löydetty:</b> <i><a href="https://reddit.com/{submission.permalink}">{submission.title}</a></i>', parse_mode='HTML')
naytetytpelit.append(submission.title)
time.sleep(30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment