本文整理汇总了Python中xchat.prnt函数的典型用法代码示例。如果您正苦于以下问题:Python prnt函数的具体用法?Python prnt怎么用?Python prnt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prnt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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
示例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
示例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
示例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]
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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