init
This commit is contained in:
commit
fb87798869
75
autoascii.py
Normal file
75
autoascii.py
Normal file
|
@ -0,0 +1,75 @@
|
|||
#-*- coding: utf-8 -*-
|
||||
# Copyright (c) 2013 Anton Vilhelm Ãsgeirsson <anton@antonvilhelm.is>
|
||||
#
|
||||
# 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", "")
|
71
autottm.py
Normal file
71
autottm.py
Normal file
|
@ -0,0 +1,71 @@
|
|||
#-*- coding: utf-8 -*-
|
||||
# Copyright (c) 2013 Anton Vilhelm Ãsgeirsson <anton@antonvilhelm.is>
|
||||
#
|
||||
# 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", "")
|
9
cdntottm.py
Normal file
9
cdntottm.py
Normal file
|
@ -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)
|
Loading…
Reference in a new issue