import requests,plugin,traceback,sys from bot import IRCLine BOT = None def say(target,msg): if not BOT: return BOT.socket.send(IRCLine("PRIVMSG",target,":"+msg)) def shorten(url): r = requests.post("https://ttm.sh",data=dict(url=url)) r.raise_for_status() return r.text.strip() def fixUp(text): if not text: return "_" # escape empty string text = text.replace("_","__") # escape underscores text = text.replace(" ","_") # escape spaces text = text.replace("-","--") # escape dashes text = text.replace("''",'"') # escape double quote text = text.replace("?","~q") # escape question marks text = text.replace("%","~p") # escape question marks text = text.replace("#","~h") # escape question marks text = text.replace("/","~s") # escape question marks return text def memegen(bot,channel,nick,template="help",*msg): if template=="help": say(channel,f"{nick}: Usage: {bot.prefix}memegen