commit fb877988691ba378fc7b82a3c3b8cb99973c502c Author: gallant Date: Thu May 19 18:40:31 2022 -0500 init diff --git a/autoascii.py b/autoascii.py new file mode 100644 index 0000000..994debe --- /dev/null +++ b/autoascii.py @@ -0,0 +1,75 @@ +#-*- coding: utf-8 -*- +# Copyright (c) 2013 Anton Vilhelm Ásgeirsson +# +# Everyone is permitted to copy and distribute verbatim or modified +# copies of this license document, and changing it is allowed as long +# as the name is changed. +# +# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +# +# 0. You just DO WHAT THE FUCK YOU WANT TO. + +# Greentext: +# ---------- +# Modifies any messages starting with '>' to display green text, similar to +# the way popular imageboards do. + +import weechat as w +import re +import requests +import os + +# Registstration variables. +SCRIPT_NAME = "autottm" +SCRIPT_AUTHOR = "God" +SCRIPT_VERSION = "0.1" +SCRIPT_LICENSE = "WTFPL" +SCRIPT_DESC = "Modify messages starting with 'https://cdn.discordapp.com' to display better link." + +# Registration function. +w.register( + SCRIPT_NAME, + SCRIPT_AUTHOR, + SCRIPT_VERSION, + SCRIPT_LICENSE, + SCRIPT_DESC, + "","" +) + +# Greentext callback function. +def greentext_cb(data, modifier, modifier_data, string): + try: + nick, msg = string.split('\t') + except ValueError as e: #Get rid of those python error messages. + return string + try: + discordindex = msg.index('https://') + except: + return string + wackindex = len(msg) -1 + if msg.find('.png') > -1: + wackindex = msg.index('.png') + elif msg.find('.jpg') > -1: + wackindex = msg.index('.jpg') + else: + return string + msg = msg[discordindex:wackindex+4] + + #print(discordindex) + #print(msg[discordindex:]) + + data = { + 'url': msg + } + r = requests.post(url = 'https://ttm.sh', data = data) + print(r.text) + r = os.system("kitty +kitten icat " + r.text) + return "%s\t%s%s" % (nick, w.color('green'), r) + #return r.text + + + + +#w.hook_modifier("weechat_print", "greentext_cb", "") +w.hook_modifier("irc_in2_privmsg", "greentext_cb", "") \ No newline at end of file diff --git a/autottm.py b/autottm.py new file mode 100644 index 0000000..38a4c12 --- /dev/null +++ b/autottm.py @@ -0,0 +1,71 @@ +#-*- coding: utf-8 -*- +# Copyright (c) 2013 Anton Vilhelm Ásgeirsson +# +# Everyone is permitted to copy and distribute verbatim or modified +# copies of this license document, and changing it is allowed as long +# as the name is changed. +# +# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +# +# 0. You just DO WHAT THE FUCK YOU WANT TO. + +# Greentext: +# ---------- +# Modifies any messages starting with '>' to display green text, similar to +# the way popular imageboards do. + +import weechat as w +import re +import requests + +# Registstration variables. +SCRIPT_NAME = "autottm" +SCRIPT_AUTHOR = "God" +SCRIPT_VERSION = "0.1" +SCRIPT_LICENSE = "WTFPL" +SCRIPT_DESC = "Modify messages starting with 'https://cdn.discordapp.com' to display better link." + +# Registration function. +w.register( + SCRIPT_NAME, + SCRIPT_AUTHOR, + SCRIPT_VERSION, + SCRIPT_LICENSE, + SCRIPT_DESC, + "","" +) + +# Greentext callback function. +def greentext_cb(data, modifier, modifier_data, string): + try: + nick, msg = string.split('\t') + except ValueError as e: #Get rid of those python error messages. + return string + try: + discordindex = msg.index('https://') + except: + return string + wackindex = len(msg) -1 + if msg.find('.png') > -1: + wackindex = msg.index('.png') + elif msg.find('.jpg') > -1: + wackindex = msg.index('.jpg') + else: + return string + msg = msg[discordindex:wackindex+4] + + #print(discordindex) + #print(msg[discordindex:]) + + data = { + 'url': msg + } + r = requests.post(url = 'https://ttm.sh', data = data) + print(r.text) + return "%s\t%s%s" % (nick, w.color('green'), r.text) + #return r.text + + + +w.hook_modifier("weechat_print", "greentext_cb", "") \ No newline at end of file diff --git a/cdntottm.py b/cdntottm.py new file mode 100644 index 0000000..745ce2e --- /dev/null +++ b/cdntottm.py @@ -0,0 +1,9 @@ +import requests + +data = { + 'url':"https://upload.wikimedia.org/wikipedia/en/thumb/5/50/Goofy_Duckipedia.png/220px-Goofy_Duckipedia.png" +} + +r = requests.post(url = 'https://ttm.sh', data = data) + +print(r.text) \ No newline at end of file