Add /hmmmm
This commit is contained in:
		
							
								
								
									
										11
									
								
								bot.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								bot.py
									
									
									
									
									
								
							| @@ -12,12 +12,12 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - \ | ||||
|                     %(message)s', level=logging.INFO) | ||||
|  | ||||
|  | ||||
| def cursed(bot, update, args): | ||||
| def cursed(bot, update, args, subreddit): | ||||
|     try: | ||||
|         lim = args[0] | ||||
|     except(IndexError): | ||||
|         lim = 1 | ||||
|     url = f"https://www.reddit.com/r/cursedimages/top.json?limit={lim}" | ||||
|     url = f"https://www.reddit.com/r/{subreddit}/top.json?limit={lim}" | ||||
|     headers = { | ||||
|             'user-agent': ('windows / chrome 67 [desktop]: mozilla/5.0 ' | ||||
|                            '(windows nt 10.0; win64; x64)')} | ||||
| @@ -32,5 +32,10 @@ def cursed(bot, update, args): | ||||
| updater = Updater(token=config.api_key) | ||||
| dispatcher = updater.dispatcher | ||||
|  | ||||
| dispatcher.add_handler(CommandHandler('cursed', cursed, pass_args=True)) | ||||
| dispatcher.add_handler(CommandHandler('cursed', lambda x, y, z: | ||||
|                                       cursed(x, y, z, "CursedImages"), | ||||
|                                       pass_args=True)) | ||||
| dispatcher.add_handler(CommandHandler('hmmmm', lambda x, y, z: | ||||
|                                       cursed(x, y, z, "hmmm"), | ||||
|                                       pass_args=True)) | ||||
| updater.start_polling() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user