#ALBERTOBOT - USER FRIENDLY EDITION #have at it, good luck. #spams a discord server whenever thread is kill or hits page 9 #no, it doesnt actually bump things. Captcha got in the way, and paying to shitpost is for cucks.   import discord import asyncio import basc_py4chan from cleverwrap import CleverWrap   detection_text = ("example","eXaMpLe1") #comma seperated list of quoted strings. case-sensitive cw = CleverWrap("CLEVER_API_KEY_GOES_HERE") #optional - only if you want the bot to talk to you in chat discord_key = "INSERT_DISCORD_API_KEY_HERE" #requred.   client = discord.Client()   with open ("excludes", "r") as file: #get list of people to exclude     excludes = eval(file.readline()) if not excludes:     excludes = [str(client.user.id)] #if list empty exclude the bot     with open ("excludes", "w") as file:         file.write(repr(excludes)) #write the new exclude list to file   @client.event async def on_ready():       print('Logged in as')     print(client.user.name)     print(client.user.id)     print('------')     for server in client.servers: #loop through all servers         channel = [x for x in server.channels if "bump" in str(x.name).lower()][0]#get bump channel         break     print(server)     print(channel)     board = basc_py4chan.Board("mlp") #setup board to search for in thread     alert_position = board.threads_per_page * (board.page_count-2) #get thread position of page 9     skip = 0     print("total positions: "+str(board.threads_per_page * board.page_count)) #print basic board info     print("total pages: "+str(board.page_count))     print("threads per page: "+str(board.threads_per_page))     print("alerting at position: "+str(alert_position))     while 1:         while 1:             try:                 posts = board.get_all_threads() #get every post as a list                 break             except:                 pass         try:             #WARNING: LIST COMPREHENSION bLACK MAGIC FUCKERY AHEAD.             position = [posts.index(x) for x in posts if max([y in x.topic.text_comment for y in detection_text])][0] #attempt to find a thread containing the detection strings             print(position)         except: #if it fails we've killed the thread and need to deal with that             position = -1             print("Thread Dead")           if position == -1: #if we've killed the thread             mentions = [x.id for x in server.members if ((str(x.status)=="online") and (str(x.id) not in excludes))] #get a list of users to notify             mentions = ["<@"+str(x)+">" for x in mentions] #generate a list of mentions for discord to show             if not skip:                 skip = 9                 if not mentions:                     mentions.append("SOMEBODY")                 for i in range(3): #send this shit 3 times, and format it all nicely                     await client.send_message(channel, str(mentions).replace("'", "").replace("]","").replace("[","").replace(",",""))                 await client.send_message(channel, "THREAD IS KILL! THREAD IS KILL! AM I FREE NOW?") #send this shit here             else: skip -= 1         elif position >= alert_position: #if we're on page 9             skip = 0             mentions = [x.id for x in server.members if ((str(x.status)=="online") and (str(x.id) not in excludes))] #generate mentions ID list             mentions = ["<@"+str(x)+">" for x in mentions] #generate proper mentions from IDs             if not mentions:                 mentions.append("SOMEBODY")             for i in range(3): #send it 3 times formatted nice                 await client.send_message(channel, str(mentions).replace("'", "").replace("]","").replace("[","").replace(",",""))             await client.send_message(channel, "WE'RE PAST PAGE 9\nBUMP IT\nBUMP IT\nBUMP IT\nEEEEEEEEEEEEEEEEEEEEEE\n\n+exclude to exclude yourself from the mentions\n+include to re-add yourself") #spam this         await asyncio.sleep(300) #and wait 5 minutes before doing it again   @client.event async def on_message(message): #react to messages     if message.content.strip().startswith("<@!"+str(client.user.id)+"> "):         await client.send_message(message.channel, cw.say(message.content[len("<@!"+str(client.user.id)+"> "):]))     if message.content.strip().startswith("+exclude"): #exclude users from the list         if str(message.author.id) not in excludes:             excludes.append(str(message.author.id)) #add userid to exclude list if not in the list         print (excludes) #debugging         await client.send_message(message.channel, "excluded <@"+str(message.author.id)+">") #send a confirmation         with open ("excludes", "w") as file: #write the excludes list to file             file.write(repr(excludes))     if message.content.strip().startswith("+include"): #include users back from the list         try:             excludes.pop(excludes.index(str(message.author.id))) #attempt to remove user from list         except:             pass #if the user isnt in the list, ignore it         print (excludes) #debugging         await client.send_message(message.channel, "included <@"+str(message.author.id)+">") #send confirmation message         with open ("excludes", "w") as file: #write excludes to fuke             file.write(repr(excludes))   client.run(discord_key)