本文整理汇总了Python中xchat.hook_command函数的典型用法代码示例。如果您正苦于以下问题:Python hook_command函数的具体用法?Python hook_command怎么用?Python hook_command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hook_command函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: initialize
def initialize():
print "initialize"
global original_nick, timer_begins, timer_ends
global uppercase_hook, action_hook, nick_hook, heretic_hook
global ACF_BEGIN_TIME, ACF_END_TIME, has_joined
has_joined = True
hooks = [timer_begins, timer_ends, uppercase_hook, action_hook, nick_hook, heretic_hook]
for h in hooks:
if h is not None:
xchat.unhook(h)
h = None
timer_begins = xchat.hook_timer(time_to(ACF_BEGIN_TIME), ACF_begin)
timer_ends = xchat.hook_timer(time_to(ACF_END_TIME), ACF_end)
uppercase_hook = xchat.hook_command("", to_uppercase)
action_hook = xchat.hook_command("me", to_uppercase_action)
nick_hook = xchat.hook_command("nick", change_nick)
heretic_hook = xchat.hook_server("PRIVMSG", heretic_patrol)
xchat.hook_command("leave", leave_dc801)
original_nick = xchat.get_info("nick")
if all_caps_friday() and original_nick.islower():
new_nick = original_nick.upper()
cmd = "nick %s" % new_nick
xchat.command(cmd)
return xchat.EAT_ALL
return xchat.EAT_NONE
开发者ID:DoktorUnicorn,项目名称:xchatscripts,代码行数:25,代码来源:allcapsfriday.py
示例2: setup
def setup(self):
self._process = self._create_pipe()
# Register timed check of screensaver status.
self._hook = self._register_hook()
xchat.hook_unload(self.unload_cb)
# Register some commands.
xchat.hook_command("xs_start_polling", self.on_start)
xchat.hook_command("xs_stop_polling", self.on_stop)
xchat.prnt('%s version %s by %s loaded' % (
__module_name__, __module_version__, __author__))
开发者ID:dsoulayrol,项目名称:config,代码行数:14,代码来源:xchat-xscreensaver.py
示例3: __init__
def __init__(self):
# fix find a way to remove use of globals
self.festival=festival()
self.vocalized_channels = set()
self.vocalized_nicks = set()
self.muted_nicks_in_channels = set()
self.actors = {
"caleb" : "(voice_kal_diphone)",
"ken" : "(voice_ked_diphone)",
"randal" : "(voice_rab_diphone)",
"alan" : "(voice_cmu_us_awb_arctic_clunits)",
"brett" : "(voice_cmu_us_bdl_arctic_clunits)",
"carmen" : "(voice_cmu_us_clb_arctic_clunits)",
"jerry" : "(voice_cmu_us_jmk_arctic_clunits)",
"roger" : "(voice_cmu_us_rms_arctic_clunits)",
"sarah" : "(voice_cmu_us_slt_arctic_clunits)",
}
self.unpack()
self.substitutions={
}
xchat.hook_command("unmute", self.unmute, help="/unmute [speaker] Turn on speech for this window or a specific speaker in this channel")
xchat.hook_command("mute", self.mute, help="/mute [speaker] Turn off speech for this window, or mute a specific speaker in this channel")
xchat.hook_command("pronounce", self.pronounce, help="'/pronounce word [pronunciation]' - Fix pronunciation for a word, or delete the pronunciation if it exists.")
xchat.hook_command("cast", self.cast, help="'/cast nick [actor]' cast an actor as a particular nick, or clear that casting.")
xchat.hook_server("PRIVMSG", self.chat_hook)
开发者ID:mikegraham,项目名称:xchat-speak,代码行数:28,代码来源:xchat-speak.py
示例4: __init__
def __init__(self) :
self.start_time = time.time()
for event in XchatSoundHandler.EVENTS :
xchat.hook_print(event, self.handle_message, event)
xchat.hook_command("chatsounds", self.handle_prefs)
xchat.hook_command("cs", self.handle_prefs)
self.player = SoundPlayer()
self.sound_dir = os.path.expanduser("~/.xchat2/sounds/")
self.silenced_channels = SILENCED_CHANNELS
debugprint("Loaded chatsounds.py")
开发者ID:veryalien,项目名称:scripts,代码行数:15,代码来源:chatsounds.py
示例5: load
def load(*args):
groups_load_from_settings()
compile_strings()
for event in chat_events:
xchat.hook_print(event, dispatch_message, event)
xchat.hook_print("Key Press", dispatch_key)
xchat.hook_command("", dispatch_command)
xchat.hook_command("ov", command_handler)
for event in ["You Join", "You Kicked", "You Part", "you Part with Reason"]:
xchat.hook_print(event, dispatch_channels_change, event)
print(__module_name__, __module_version__, 'loaded')
开发者ID:Xuerian,项目名称:xchat_overwatch,代码行数:15,代码来源:overwatch.py
示例6: __init__
def __init__(self):
self.id_dh = {}
self.hooks = [
xchat.hook_command('', self.on_send_message),
xchat.hook_command('ME', self.on_send_me),
xchat.hook_command('MSG', self.on_send_msg),
xchat.hook_command('NOTICE', self.on_send_notice),
xchat.hook_server('notice', self.on_recv_notice, priority=xchat.PRI_HIGHEST),
xchat.hook_print('Change Nick', self.on_change_nick),
xchat.hook_unload(self.unload),
]
for name in (
'Channel Action', 'Private Action to Dialog', 'Private Action', 'Channel Message',
'Private Message to Dialog', 'Private Message'
):
xchat.hook_print(name, self.on_recv_message, name, priority=xchat.PRI_HIGHEST),
开发者ID:simonzack,项目名称:hexfish,代码行数:16,代码来源:plugin.py
示例7: bind_xchat
def bind_xchat():
'''
Bind to XChat
'''
xm = XchatMemory()
xchat.hook_command('remember',xm.remember)
xchat.hook_command('lookup',xm.lookup)
xchat.hook_command('remembered',xm.remembered)
xchat.hook_command('forget',xm.forget)
开发者ID:brettviren,项目名称:xchat-scripts,代码行数:9,代码来源:memory.py
示例8: enfab_callback
def enfab_callback(word, word_eol, user_data):
global fab_hook
if fab_hook is None:
fab_hook = hexchat.hook_command('', fab_passthru_callback)
hexchat.prnt('Fabulous mode on')
return hexchat.EAT_ALL
开发者ID:Jake0720,项目名称:XChat-Scripts,代码行数:8,代码来源:rainbowtext.py
示例9: __init__
def __init__(self):
""" Costruttore """
self.pattern = []
self.stats = {}
self.pattern_stats = [0, (0, 0)]
self.debug = False
self.label = "Mp3 filter"
self.load_config()
for evnt in filter_event:
xchat.hook_print(evnt, self.ignore_mp3_notification)
xchat.hook_command("mp3filter_reload", self.reload_config,
help="Carica nuovamente i filtri dalla config")
xchat.hook_command("mp3filter_stats", self.pattern_status,
help="Statistiche sui filtri usati")
xchat.hook_command("mp3filter_debug", self.debug_swap,
help="Stampa i messaggi che vengono \
bloccati; Utile per capire \
quali messaggi bloccano gli attuali filtri")
xchat.command('MENU ADD "%s"' % self.label)
xchat.command('MENU ADD "%s/Ricarica filtri" "mp3filter_reload"' %
self.label)
xchat.command('MENU ADD "%s/Statistiche filtri" "mp3filter_stats"' %
self.label)
xchat.command('MENU ADD "%s/Debug" "mp3filter_debug None"' %
self.label)
print "Filtro mp3 caricato su: \x0304%s\x03" % ', '.join(filter_event)
s=self.pattern_stats
print "%d/%d filtri caricati!" % (s[1][0], s[0])
开发者ID:hiryu85,项目名称:xchat_filter_mp3_advices,代码行数:33,代码来源:mp3filter.py
示例10: __init__
def __init__(self):
#Decode hooks
xchat.hook_print("Private Message", self.decode, "Private Message")
xchat.hook_print("Private Message to Dialog", self.decode, "Private Message to Dialog")
xchat.hook_print("Quit", self.quithook, "Quit")
xchat.hook_print("Connected", self.resetconversationshook, "Connected")
xchat.hook_print("Your Nick Changing", self.resetconversationshook,
"Your Nick Changing")
#Generic encode hook
self.allhook = xchat.hook_command("", self.encode)
#TODO RandomPool is know to be broken
#Random generator
self.randfunc = get_random_bytes
#Initialize configuration directory
confDir = xchat.get_info("xchatdirfs") + "/cryptochati.conf"
if not os.path.isdir(confDir):
os.makedirs(confDir, 0700)
#Friends file
self.friendsPath = os.path.join(confDir, "friends.txt")
#Private key file
self.myKeyPath = os.path.join(confDir, "my.key")
#Friends' public keys file
self.keysPath = os.path.join(confDir, "public.keys")
#Create/load configuration
self.openConfiguration()
#Friend management hook
xchat.hook_command("Friend", self.friendhook, "Friend", help=
"""Usage:
FRIEND ADD <nick> - adds <nick> as a trusted friend
FRIEND DEL <nick> - deletes <nick> from trusted friends
FRIEND LIST - lists current trusted friends""")
开发者ID:dertalai,项目名称:cryptochati,代码行数:38,代码来源:cryptochati.py
示例11: enable
def enable(self):
self.is_enabled = True
#read in config
self.config = ConfigParser.RawConfigParser()
self.config.read('config.conf')
#set menus
self.setup_nick_menu()
#create list of channels
try:
for channel in xchat.get_list("channel"):
dir(channel)
except KeyError:
pass
#watch for new channels joined
xchat.hook_command("join", self.on_channel_join)
#watch for channels left
xchat.hook_command("part", self.on_channel_part)
#set hooks for joti/join/part/messages
xchat.hook_command("joti", self.dispatch)
xchat.hook_print('Channel Message', self.on_text)
xchat.hook_print('Join', self.on_join)
xchat.hook_print('Part', self.on_part)
开发者ID:HomingHamster,项目名称:scoutlink-joti-xchat-op-script,代码行数:22,代码来源:JOTIop.py
示例12: len
if len(word) >= 3 and word[2] != '--network':
if word_eol[2]=="1" or word_eol[2]=="True" or word_eol[2]=="true":
key.aes = True
if word_eol[2]=="0" or word_eol[2]=="False" or word_eol[2]=="false":
key.aes = False
KEY_MAP[id_] = key
elif len(word) >= 5 and word[2] == '--network':
if word_eol[4]=="1" or word_eol[4]=="True" or word_eol[4]=="true":
key.aes = True
if word_eol[4]=="0" or word_eol[4]=="False" or word_eol[4]=="false":
key.aes = False
print 'Key aes', id_, 'set', key.aes
return xchat.EAT_ALL
import xchat
xchat.hook_command('key', key, help='show information or set key, /key <nick> [<--network> <network>] [new_key]')
xchat.hook_command('key_exchange', key_exchange, help='exchange a new key, /key_exchange <nick>')
xchat.hook_command('key_list', key_list, help='list keys, /key_list')
xchat.hook_command('key_load', key_load, help='load keys, /key_load')
xchat.hook_command('key_pass', key_pass, help='set key file pass, /key_pass password')
xchat.hook_command('aes', aes, help='aes #channel/nick 1|0 or True|False')
xchat.hook_command('key_remove', key_remove, help='remove key, /key_remove <nick>')
xchat.hook_server('notice', dh1080)
xchat.hook_print('Channel Message', decrypt_print, 'Channel Message')
xchat.hook_print('Change Nick', change_nick)
xchat.hook_print('Private Message to Dialog', decrypt_print, 'Private Message to Dialog')
xchat.hook_server('332', server_332)
xchat.hook_command('', encrypt_privmsg)
xchat.hook_unload(unload)
load()
开发者ID:Sharker,项目名称:XChat-FiSH-AES,代码行数:30,代码来源:XChat_AES.py
示例13: chooseSong
except dbus.exceptions.DBusException as Err:
xchat.prnt("An error occured, but xchat crashes when it gets printed.")
#xchat.prnt(Err.get_dbus_message()) # Unsafe *cough*
def chooseSong(word, word_eol, next):
if next:
if os.system("exaile -n") == 0:
xchat.prnt("Song changed")
else:
xchat.prnt("Song changing failed")
else:
if os.system("exaile -p") == 0:
xchat.prnt("Song changed")
else:
xchat.prnt("Song changing failed")
def playPause(word, word_eol, ud):
if os.system("exaile -t") == 0:
xchat.prnt("Pause/play")
else:
xchat.prnt("Pause/play failed")
xchat.prnt("Exaile script initialized")
xchat.prnt("Use /np to announce the currently played song")
xchat.hook_command("np", printSong, False)
xchat.hook_command("npc", printSong, True)
xchat.hook_command("exaile_ver", printExaileVersion)
xchat.hook_command("exnext", chooseSong, True)
xchat.hook_command("exprev", chooseSong, False)
xchat.hook_command("pause", playPause)
开发者ID:duckinator,项目名称:xchat-exaile-script,代码行数:30,代码来源:xchat_exaile.py
示例14: askpw_cb
_gnupgdir = '/home/YOUR_USERNAME/.xchat2/'
sys.path.append(_gnupgdir)
import gnupg
gpg = gnupg.GPG(gnupghome=_gpghome)
def askpw_cb(word, word_eol, userdata):
pw = word_eol[0]
xchat.pw = pw[6:]
if xchat.pw == "":
xchat.pw = None
response_data = str(gpg.decrypt(xchat.challenge_data, passphrase = xchat.pw)).rstrip()
xchat.command('msg gribble ;;everify '+response_data)
return xchat.EAT_ALL
xchat.hook_command('ASKPW', askpw_cb, help="/ASKPW Ask user for gpg passphrase.")
def detect_eauth_challenge(word, word_eol, userdata):
is_challenge = False
if word[0] == ':[email protected]/nanotube/bot/gribble' and re.search('hostmask %s!' % (xchat.get_info('nick'),), word_eol[0]):
challenge_url = word[-1]
if challenge_url[:-16] == 'http://bitcoin-otc.com/otps/':
xchat.challenge_data = urllib.urlopen(challenge_url).read()
xchat.command('GETSTR "your gpg passphrase" ASKPW "Enter gpg passphrase"')
return xchat.EAT_NONE
xchat.hook_server('PRIVMSG', detect_eauth_challenge)
def eauth_cb(word, word_eol, userdata):
xchat.command('msg gribble ;;eauth ' + _otcnick)
return xchat.EAT_ALL
开发者ID:Mqrius,项目名称:supybot-bitcoin-marketmonitor,代码行数:31,代码来源:bitcoin-otc-gpg-eauth.xchat.py
示例15: dccStall
cmd.file = split[2]
cmd.queued = False
cmd.transfering = True
def dccStall(split, full, data):
global CommandQueue, Active
botname = str(split[2])
for cmd in (c for c in Active if c.bot == botname):
print_error("Requested file \"%s\" has stalled during transport." % (split[1]))
ret = cmd.retry()
if ret:
print_info("Re-requesting file \"%s\" (%d of 3 retries)" % (split[1], Active.retries))
else:
print_error("Retry limit reached for file \"%s\". Stopping the queue." % (split[1]))
__unhook__ = xchat.hook_command("xdccq", dispatch, help=USAGE_STR)
print_info("XdccQ-TNG loaded successfully")
usage()
noticeHook = xchat.hook_print("Notice", notice, "data")
dccRecvCompleteHook = xchat.hook_print("DCC RECV Complete", dccComplete, "data")
dccRecvConnectHook = xchat.hook_print("DCC RECV Connect", dccConnect, "data")
dccRecvStallHook = xchat.hook_print("DCC Stall", dccStall, "data")
if __name__ == "__main__":
def tests():
"""
>>> numToList("1")
[1]
>>> numToList("1,2,4")
开发者ID:archlinuxaur,项目名称:aur-mirror-migration,代码行数:31,代码来源:xdccq.py
示例16: deadbeef_current_track
#
__module_name__ = "XChat-DeaDBeeF"
__module_author__ = "iceTwy / mwgg"
__module_description__ = "DeaDBeeF integration in XChat and HexChat."
__module_version__ = "1.0"
__module_deadbeef_version__ = "0.5.6"
############################
import xchat
import subprocess
from threading import Thread
from time import sleep
############################
def deadbeef_current_track(word, word_eol, userdata):
read_track = subprocess.check_output('/usr/bin/deadbeef --nowplaying "%a - (%b) - %t [%@:[email protected] / %@:[email protected] / %@:[email protected]]"',shell=True).decode("utf-8")
xchat.command("me is listening to " + read_track)
return xchat.EAT_ALL
def unload(userdata):
print("XChat-DeaDBeeF %s unloaded!" % (__module_version__))
return xchat.EAT_ALL
if __name__ == '__main__':
print("XChat-DeaDBeeF %s loaded successfully! - by %s" % (__module_version__,__module_author__))
#Display the current track
xchat.hook_command('tellnp',deadbeef_current_track)
开发者ID:mwgg,项目名称:xchat-deadbeef-stripped,代码行数:30,代码来源:XChat-DeaDBeeF-py3.py
示例17: __init__
def __init__(self):
xchat.hook_command("hostcheck", self.check_process, help="/hostcheck <channel>")
开发者ID:shibumi,项目名称:IRCollection,代码行数:2,代码来源:hostcheck.py
示例18: randchan
import string
import random
import xchat
__module_name__ = "HexChat random channel plugin"
__module_version__ = "0.0.1"
__module_description__ = "randchan cmd"
__author__ = "Rylee Elise Fowler"
def randchan (word, word_eol, userdata):
xchat.command('join #' + ''.join(random.sample(string.ascii_lowercase, 10)))
xchat.hook_command("randchan", randchan)
xchat.prnt(__module_name__ + ' version ' + __module_version__ + ' loaded.')
开发者ID:skyhighwings,项目名称:hexchat-randchan,代码行数:14,代码来源:randchan.py
示例19: open
return xchat.EAT_NONE
command = word[1].split(' ')[0].lower()
if command == "!since":
#Command not particularly useful if stream is live
if monitoring["monotonetim"][0] is Status.online:
xchat.command("say MonotoneTim is live right now!")
timer = xchat.hook_timer(60000, cooldown_cb)
cooldown = True
return xchat.EAT_NONE
if lastStreamTime == -1:
file = open(filename, "r")
lastStreamTime = float(file.read())
file.close()
delta = TimeDelta(time.time() - lastStreamTime)
xchat.command("say " + delta.readableTime())
timer = xchat.hook_timer(60000, cooldown_cb)
cooldown = True
return xchat.EAT_NONE
def cooldown_cb(userdata):
global cooldown
#There should only be one cooldown in this script,
#as the other script covers cooldown commands
cooldown = False
return 0
xchat.hook_print("Channel Message", since_cb)
xchat.hook_command("monitor", monitor_cb, help = "/MONITOR Alerts when Tim is live")
xchat.hook_command("unmonitor", unmonitor_cb, help = "/UNMONITOR Stop monitoring")
开发者ID:EliteSoba,项目名称:xchat_scripts,代码行数:31,代码来源:tim.py
示例20: audacious_check
current = xchat.get_context()
if audacious_check():
#playing?
playing = commands.getstatusoutput(audtool_prog + " playback-playing")
if (playing[0] == 0):
song = commands.getoutput(audtool_prog + " current-song")
artist = commands.getoutput(audtool_prog + " current-song-tuple-data artist")
total = commands.getoutput(audtool_prog + " current-song-length")
output = commands.getoutput(audtool_prog + " current-song-output-length")
final = bold_char + "Now Playing: " + bold_char + song + (" - ") + artist + " (" + output + "/" + total + ")"
#make sure it's not in a server window
if ((current.get_info("channel") != current.get_info("server")) and (current.get_info("channel") != current.get_info("network"))):
#Say it.
xchat.command("msg " + current.get_info("channel") + " " + final)
else:
#Print it
current.prnt(final)
else:
current.prnt("Check that Audacious is playing!")
else:
current.prnt("Check that you have Audacious installed and audtool_prog set properly!")
#accept the command no matter what happens, to prevent unknown command messages
return xchat.EAT_XCHAT
if audacious_check():
xchat.hook_command("audacious", shout, help="/audacious - Sends currently playing information to current context.")
xchat.prnt("Audacious Shout plugin loaded!")
else:
xchat.prnt("Please check that Audacious is installed and audtool_prog is set properly. Plugin not loaded!")
开发者ID:evanniedojadlo,项目名称:snippets,代码行数:30,代码来源:audacious.py
注:本文中的xchat.hook_command函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论