本文整理汇总了Python中xchat.prnt函数的典型用法代码示例。如果您正苦于以下问题:Python prnt函数的具体用法?Python prnt怎么用?Python prnt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prnt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: addUser
def addUser(word, word_eol, userdata):
global WATCHLIST
if len(word) < 2:
return xchat.EAT_ALL
user = word[1]
src = "auto"
dest = DEFAULT_LANG
if len(word) > 2 :
src = findLangCode(word[2])
if src is None:
xchat.prnt("The specified language is invalid.")
return xchat.EAT_ALL
pass
if len(word) > 3:
lang = findLangCode(word[3])
if lang is not None:
dest = lang
pass
key = xchat.get_info("channel") + " " + user.lower()
WATCHLIST[key] = (dest, src, 0)
xchat.prnt("Now watching user: " + user + ", source: " + src + ", target: " + dest)
return xchat.EAT_ALL
开发者ID:cngo-github,项目名称:translation-server,代码行数:29,代码来源:xchat-translator-3.X.py
示例2: removeChannel
def removeChannel(word, word_eol, userdata):
channel = xchat.get_info("channel")
if CHANWATCHLIST.pop(channel + " " + channel, None) is not None:
xchat.prnt("Channel %s has been removed from the watch list." %channel)
return xchat.EAT_ALL
开发者ID:cngo-github,项目名称:translation-server,代码行数:7,代码来源:xchat-translator-3.X.py
示例3: isPlayerSpecified
def isPlayerSpecified():
if player == None:
xchat.prnt("No player specified.")
xchat.prnt("Use /player <player name> to specify a default media player.")
return False
else:
return True
开发者ID:duckinator,项目名称:xchat-mpris2,代码行数:7,代码来源:xchat-mpris2.py
示例4: VersionCond
def VersionCond(word, word_eol, userdata):
if word_eol[3] != ":\x01VERSION\x01":
return xchat.EAT_NONE
if CheckCondition(*verCond):
return xchat.EAT_NONE
xchat.prnt("Prevented version request by %s" % word[0].split("!")[0].lstrip(":"))
return xchat.EAT_ALL
开发者ID:GunfighterJ,项目名称:xchat-plugins,代码行数:7,代码来源:ctcp.py
示例5: new_msg
def new_msg(word, word_eol, userdata):
"""Handles normal messages.
Unless this is the first user's message since he joined, the message will
not be altered. Otherwise, a '(logged in Xs ago)' message will be appended.
"""
user = xchat.strip(word[0])
# If the user logged in before we did (which means the Join part of
# filter_msg didn't take effect), add him to the dict.
if user not in last_seen:
last_seen[user]= [time(), 1]
# If the user has never spoken before, let us know when he logged in.
if last_seen[user][1] == 0:
time_diff = time() - last_seen[user][0]
# Bold the username and color the text if it's a hilight
if "Hilight" in userdata:
s_user = "\002" + word[0]
s_msg = "\017\00319" + word[1]
else:
s_user = word[0]
s_msg = "\017" + word[1]
if "Action" in userdata:
s_user = "\00319*\t%s " % s_user
else:
s_user += '\t'
xchat.prnt("%s%s \00307(logged in %ss ago)" % (s_user, s_msg,
int(time_diff)))
last_seen[user]= [time(), 1]
return xchat.EAT_XCHAT
else:
last_seen[user]= [time(), 1]
开发者ID:CrimsonStar,项目名称:hexchat-addons,代码行数:32,代码来源:filter.py
示例6: yt_cb
def yt_cb(word, word_eol, userdata):
global YT_enabled
chan = xchat.find_context(channel="#commie-subs")
if not YT_enabled:
return xchat.EAT_NONE
if chan is None:
return xchat.EAT_NONE
for url in word[1].split(' '):
o = urlparse(url)
if o.netloc is '':
continue
else:
s = o.netloc.lower().split('.')
for part in s:
if part == "youtube" or part == "youtu":
# vid = url[url.find('v=')+2:]
# if vid.find('&') != -1
# vid = vid[:vid.find('&')]
vid = url[url.find('v=')+2:url.find('v=')+13]
service = gdata.youtube.service.YouTubeService()
try:
entry = service.GetYouTubeVideoEntry(video_id=vid)
except gdata.service.RequestError:
xchat.prnt("Invalid Video ID")
return xchat.EAT_NONE
title = entry.media.title.text
chan.command("say YouTube video title: " + title)
return xchat.EAT_NONE
return xchat.EAT_NONE
开发者ID:EliteSoba,项目名称:xchat_scripts,代码行数:29,代码来源:youtube.py
示例7: setcooldown_cb
def setcooldown_cb(word, word_eol, userdata):
global conn
global global_commands
mod = check_mod(word)
if not mod:
return xchat.EAT_NONE
words = word[1].split(' ')
#Will always have at least one element of words
if words[0].lower() == "!setcooldown":
if words[1].lower() in global_commands:
return xchat.EAT_NONE
command = words[1].lower()
try:
cooldown = int(words[2])
update = (cooldown, command)
c = conn.cursor()
c.execute('UPDATE commands SET cooldown=? WHERE command=?', update)
xchat.command('say Cooldown change for ' + command + ' successful')
conn.commit()
except:
xchat.prnt("Unexpected error:" + sys.exc_info()[0])
return xchat.EAT_NONE
return xchat.EAT_NONE
开发者ID:EliteSoba,项目名称:xchat_scripts,代码行数:29,代码来源:bot.py
示例8: colourwheel
def colourwheel(word, word_eol, userdata):
colours = '\k01,0000\k00,0101\k00,0202\k01,0303\k01,0404' \
'\k01,0505\k01,0606\k01,0707\k01,0808\k01,0909\k01,1010' \
'\k01,1111\k01,1212\k01,1313\k01,1414\k01,1515'
colours = colours.replace('\\k', chr(3))
xchat.prnt(colours)
return xchat.EAT_ALL
开发者ID:ward,项目名称:xchat-scripts,代码行数:7,代码来源:colourwheel.py
示例9: chk_wiki
def chk_wiki(cmd_req, query, xchat_data=None):
if len(cmd_req) < 2:
xchat.prnt('Usage: /WIKI <query>, checks wikipedia for information on <query>.')
else:
query = '_'.join(i for i in query[1].split())
make_request(query)
return xchat.EAT_ALL
开发者ID:tijko,项目名称:xchat-plugins,代码行数:7,代码来源:chk_wiki.py
示例10: load_users
def load_users(filename):
global nicknames, voice, voice_pitch, voice_speed
if os.path.exists(filename):
user_data = []
for line in open(filename,'r'):
user_data.append(line)
if len(user_data)%4 == 0:
ctr = 0
while ctr < len(user_data):
nicknames.append(user_data[ctr].rstrip())
voice.append(user_data[ctr+1])
voice_pitch.append(user_data[ctr+2])
voice_speed.append(user_data[ctr+3])
ctr = ctr + 4
else:
os.remove(filename)
if ((len(voice) != len(nicknames)) or (len(voice_pitch) != len(nicknames)) or (len(voice_speed) != len(nicknames))):
del nicknames[:]
del voice[:]
del voice_pitch[:]
del voice_speed[:]
os.remove(filename)
xchat.prnt('No users loaded.')
else:
xchat.prnt('%s Users loaded.' % len(nicknames))
return None
开发者ID:bashrc,项目名称:xctts,代码行数:30,代码来源:xctts.py
示例11: crypto_cb
def crypto_cb(word, word_eol, userdata):
''' Callback for /crypto command '''
global m
global t0
if len(word) < 2:
print "\nAvailable actions:"
print " auth - initiate crypto session and authenticate participants"
elif word[1] == "auth":
m.SetUsers(xchat.get_list("users"))
setup()
if '-p2p' in word_eol:
bcast(xchat.get_list("users"), 1)
else:
synchronize()
elif word[1] == "y":
m.SetUsers(xchat.get_list("users"))
acknowledge()
elif word[1] == "shutdown":
digest = GetChatDigest(m.path)
m.digestTable.update({xchat.get_prefs("irc_nick1"):digest})
bcast(xchat.get_list("users"), 0, "shutdown")
bcast(xchat.get_list("users"), 0, '0x16' + str(digest))
else:
xchat.prnt("Unknown action")
return xchat.EAT_ALL
开发者ID:s0j1r0,项目名称:multipartychat,代码行数:25,代码来源:plugin.py
示例12: rainbow_trigger
def rainbow_trigger(word, word_eol, userdata):
channel = xchat.get_info('channel')
try:
xchat.command("msg %s %s" % (channel, rainbow(word_eol[1])))
except IndexError:
xchat.prnt("/RAINBOW <message> %s" % (rainbow_desc))
return xchat.EAT_ALL
开发者ID:GermainZ,项目名称:HexChat-Scripts,代码行数:7,代码来源:textfx.py
示例13: mpcSpam
def mpcSpam(word, word_eol, userdata):
req = urllib.request.Request('http://'+mpc_host+':'+mpc_port+'/variables.html')
try: response = urllib.request.urlopen(req,timeout=2)
except urllib.error.URLError as e:
xchat.prnt('Server did not respond, maybe mpc-hc isn\'t running: '+str(e.reason))
return xchat.EAT_ALL
parser = MyHTMLParser()
parser.feed(response.read().decode('utf-8'))
filename = args["filepath"]
size = os.path.getsize(filename)
size = int(math.floor(size/1048576))
filename = os.path.basename(filename)
state = args["statestring"]
current_time = args["positionstring"]
total_time = args["durationstring"]
position = float(args["position"])
duration = float(args["duration"])
loops = math.floor(((position/duration)*20))
progress = "6"
for i in range(20):
if loops < i:
progress = progress + "12"
loops = 21
progress = progress + '|'
#variables: size, filename, state, current_time, total_time
#xchat.command("ME 13»»6 MPC-HC 13«»6 ["+progress+"6] " + filename + " 13«»6 " + current_time + "/" + total_time + " 13«»6 "+str(size)+"MB 13«»6 [" + state + "]")
xchat.command("ME 01 MPC-HC 04 " + filename + " 04 " + current_time + "01/04" + total_time + " 04 "+str(size)+"MB")
return xchat.EAT_ALL
开发者ID:killmaster,项目名称:hexchat_scripts,代码行数:31,代码来源:mediaspam_MULTIPLATFORM.py
示例14: add_keyword
def add_keyword(cmd_msg, cmd_slice, xchat_data):
if len(cmd_msg) < 2:
xchat.prnt('Usage: /ADDKW <keyword>, adds a keyword to highlight.')
else:
for kw in cmd_msg[1:]:
KEYWORDS.append(kw)
return xchat.EAT_ALL
开发者ID:tijko,项目名称:xchat-plugins,代码行数:7,代码来源:kw_highlight.py
示例15: ircrypt_init
def ircrypt_init():
global ircrypt_keys, ircrypt_options, ircrypt_ciphers
# Open config file
f = None
try:
f = open('%s/ircrypt.conf' % xchat.get_info('xchatdirfs'), 'r')
except:
pass
if not f :
xchat.prnt('Could not open ircrypt.conf.')
return xchat.EAT_ALL
for line in f:
# Read keys
if line[0:4] == 'key:':
(prefix, target, key) = line.split(':',2)
ircrypt_keys[target] = key[0:-1]
else:
# Read options
if line[0:7] == 'option:':
(prefix, option, value) = line.split(':',2)
ircrypt_options[option] = value[0:-1]
else:
# Read special cipher
if line[0:7] == 'cipher:':
(prefix, target, cipher) = line.split(':',2)
ircrypt_ciphers[target] = cipher[0:-1]
xchat.prnt('IRCrypt re(loaded)')
return xchat.EAT_ALL
开发者ID:lordi,项目名称:ircrypt-xchat,代码行数:32,代码来源:ircrypt.py
示例16: gcalc
def gcalc(word, word_eol, userdata):
baseurl = 'http://www.google.com/search?q=%s'
query = word_eol[1]
debug = False
if word[1] == '--debug':
debug = True
query = word_eol[2]
# TODO: Fix freeze while loading.
opener = MyURL()
content = opener.open(baseurl % query).read()
if debug:
for i in range(len(content)/1000):
print content[i*1000:(i+1)*1000]
return xchat.EAT_ALL
lindex = content.find('<h2 class=r style="font-size:138%">')
if lindex == -1:
xchat.prnt('Nothing found. If this seems wrong, please debug.')
return xchat.EAT_ALL
lindex = lindex + len('<h2 class=r style="font-size:138%"><b>')
rindex = content.find('</b></h2>', lindex)
result = content[lindex:rindex]
result = " ".join(result.split())
result = result.replace(' ', ' ')
result = result.replace('×', '×')
result = re.sub(r'<sup>(\d+)<\/sup>⁄<sub>(\d+)</sub>',
r' \1⁄\2',
result)
result = result.replace('<sup>', '^')
result = result.replace('</sup>', '')
result = result.replace('<font size=-2> </font>', ',')
xchat.prnt("Google Calculator: %s" % result)
return xchat.EAT_ALL
开发者ID:ward,项目名称:xchat-scripts,代码行数:35,代码来源:gcalc.py
示例17: UnVoiceChannel
def UnVoiceChannel(word,word_eol,userdata):
global okChannels
context = xchat.get_context()
cn = context.get_info("channel")
del okChannels[cn]
xchat.prnt("No longer automatically voicing newcomers in "+cn)
return xchat.EAT_ALL
开发者ID:GunfighterJ,项目名称:xchat-plugins,代码行数:7,代码来源:voiceonce.py
示例18: channeloff
def channeloff(word, word_eol, userdata):
"/channeloff hook"
global SPEAK_CHANNEL
SPEAK_CHANNEL=False
XCHAT_FESTIVAL.say('speaking all channels')
xchat.prnt("speaking all channels")
return xchat.EAT_ALL
开发者ID:jbruce12000,项目名称:xchat-speak,代码行数:7,代码来源:xchat-speak.py
示例19: msg
def msg(word, word_eol, userdata):
if xchat.nickcmp(word[1], pirate_host) == 0:
xchat.prnt("They are the same!")
#xchat.prnt(', '.join(word_eol))
#userlist = context.get_list("users")
#xchat.prnt(word)
return xchat.EAT_NONE
开发者ID:OSN64,项目名称:hexchat-addons,代码行数:7,代码来源:pirates-next.py
示例20: speechoff
def speechoff(word, word_eol, userdata):
"/speechoff hook"
global SPEAK
SPEAK=False
XCHAT_FESTIVAL.say('speech disabled')
xchat.prnt("speech disabled")
return xchat.EAT_ALL
开发者ID:jbruce12000,项目名称:xchat-speak,代码行数:7,代码来源:xchat-speak.py
注:本文中的xchat.prnt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论