forked from Cryptonit63/provider-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmessage-tel-bot
More file actions
41 lines (31 loc) · 1.58 KB
/
message-tel-bot
File metadata and controls
41 lines (31 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Project telegram bot v0.1
((
This telegram bot will parsing Reddit information about relevant posts from the added groups.
The list of groups is added by the community itself and is included in the lists after 50 positive recommendations
from resource users or already listed recommendations (all community members can influence adding,
excluding, editing). Condition of listing on the resource is a community vote, but can be changed by a majority decision of the community.
))
VisualStudioCode v1.75.1 (Universal)
* python v3.9.6 macos13.1*
import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import praw
def start(update, context):
context.bot.send_message(chat_id=update.effective_chat.id, text="I'm a reddit bot, please no talk to me!")
def get_posts(update, context):
reddit = praw.Reddit(client_id='cryptonit63', client_secret='JKSt08cv1J8GlZTqemKvTJ2njU5ceg', user_agent='n9B33SraBEoiT21XTFKUqg')
subreddit = reddit.subreddit('r/AllCrypto')
for submission in subreddit.hot(limit=10):
if submission.num_comments > 20:
context.bot.send_message(chat_id=update.effective_chat.id, text=submission.title)
def main():
updater = Updater(token='5324647231:AAH8T3itZ-wOOhEHgcbWHHSMTor1Ju0u-9A', use_context=True)
dispatcher = updater.dispatcher
start_handler = CommandHandler('start', start)
post_handler = CommandHandler('get_posts', get_posts)
dispatcher.add_handler(start_handler)
dispatcher.add_handler(post_handler)
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()