• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python xchat.hook_server函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中xchat.hook_server函数的典型用法代码示例。如果您正苦于以下问题:Python hook_server函数的具体用法?Python hook_server怎么用?Python hook_server使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了hook_server函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __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


示例2: 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


示例3: ghostcb

def ghostcb(word, word_eol, userdata):
    c = xchat.get_context()
    nick = word[3] #use this instead of preferred nick, I guess.
    pw = c.get_info("nickserv")
    u = {"context":c, "nick":nick}
    u["hook"] = xchat.hook_server("NOTICE", noticecb, userdata=u)
    xchat.command("msg nickserv ghost {} {}".format(nick, pw))
    return xchat.EAT_NONE
开发者ID:Santiclause,项目名称:autoghost,代码行数:8,代码来源:autoghost.py


示例4: noticecb

def noticecb(word, word_eol, userdata):
    match = NICKPATTERN.match(word[0])
    matchtxt = 'Ghost with your nick has been killed.'
    if not match or xchat.nickcmp(match.group(1), 'NickServ') != 0:
        return xchat.EAT_NONE
    if word_eol[-2][1:] == 'Access denied.':
        xchat.unhook(userdata["hook"])
    elif len(word_eol) > 7 and word_eol[-7][1:] == matchtxt:
        u = {}
        u.update(userdata)
        c = u["context"]
        c.command("nick " + u["nick"])
        u["hook"] = xchat.hook_server("", identifycb,
                                             userdata=u)
        xchat.unhook(userdata["hook"])
    return xchat.EAT_NONE
开发者ID:Santiclause,项目名称:autoghost,代码行数:16,代码来源:autoghost.py


示例5: __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


示例6: 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


示例7: msg

import xchat

__module_name__ = "Pirates-next"
__module_author__ = "OSN64"
__module_version__ = "1"
__module_description__ = "Bot to play pirates game"


#__fetch_interval = 47 * 60  # 47 minutes
pirate_channel = "#smp"
pirate_server = "criten"
pirate_host = "JeromeTheBaller"
cnc = xchat.find_context(channel=pirate_channel)


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


xchat.hook_server("PRIVMSG", msg)
#xchat.hook_timer(__fetch_interval * 1000, dig)
xchat.prnt(__module_name__ + ' version ' + __module_version__ + ' loaded.')
开发者ID:OSN64,项目名称:hexchat-addons,代码行数:27,代码来源:pirates-next.py


示例8: DidJoin

import xchat

didJoin = {}
def DidJoin(word,word_eol,userdata):
	global didJoin
	didJoin[xchat.get_info("server") + "/" + word[1]] = True
#enddef

def fc(word): return word[1:] if word[0] == ":" else word

def OrDidI(word,word_eol,userdata):
	global didJoin
	nick = word[0]
	nick = nick[1:nick.find("!")]
	if nick == xchat.get_info("nick"):
		chan = fc(word[2])
		if chan[0] == ":": chan = chan[1:]
		servChan = xchat.get_info("server") + "/" + chan
		if servChan not in didJoin:
			xchat.command("part " + chan)
			return xchat.EAT_ALL
		else:
			del didJoin[servChan]
		#endif
	#endif
#enddef

xchat.hook_server("JOIN",OrDidI)
xchat.hook_command("join",DidJoin)
xchat.prnt("Loaded %s version %s." % (__module_name__,__module_version__))
开发者ID:logicplace,项目名称:xchat-plugins,代码行数:30,代码来源:nosajoin.py


示例9: WhoLoopStart

	global dInfo
	sServ=xchat.get_info("network")
	if sServ in dInfo and dInfo[sServ]["on"] == 3:
		lChannels = xchat.get_list("channels")
		for i in lChannels:
			if i.type == 2:
				lUsers = i.context.get_list("users")
				for j in lUsers:
					if j.nick == dInfo[sServ]["nick"]:
						dInfo[sServ]["on"] = 5 # Wait for quit
						return
					#endif
				#endfor
			#endif
		#endfor
		WhoLoopStart()
	#endif
#enddef

xchat.hook_print("Notice", DoNick)
xchat.hook_print("Your Nick Changing", DoIdentify)
xchat.hook_print("Join", CheckJoin)
xchat.hook_print("Quit", CheckQuit)
xchat.hook_print("Part", CheckPart)
xchat.hook_print("You Join", CheckUserList)

xchat.hook_server("376",GhostThatFucker,True) #MOTD End
xchat.hook_server("422",GhostThatFucker,True) #MOTD Missing
xchat.hook_command("gnick",GhostThatFucker,False)
xchat.prnt("Loaded %s version %s." % (__module_name__,__module_version__))
开发者ID:logicplace,项目名称:xchat-plugins,代码行数:30,代码来源:autoghost.py


示例10: make_ip

import dns.exception
import dns.resolver
import dns.reversename
import re
import socket
import struct
import xchat

__module_name__ = "gateway_identify"
__module_description__ = "Print the IP of users joining from gateways"
__module_version__ = "1.0"

hex_ip_regex = re.compile(r'^~?[0-9a-f]{8}$')
def make_ip(s):
    return socket.inet_ntoa(struct.pack('!I',eval('0x'+s)))

def identify_gateway(word, word_eol, userdata):
    id = word[0][1:]
    nick, ident, host = re.split('[@!]', id)
    if not (hex_ip_regex.match(ident) and host.startswith('gateway/')):
        return
    channel = word[-1][1:]
    ip = make_ip(ident[-8:])
    try:
        host = dns.resolver.query(dns.reversename.from_address(ip), 'PTR').response.answer[0][0].to_text()[:-1]
    except (dns.resolver.NXDOMAIN, dns.exception.Timeout):
        host = 'unknown hostname'
    xchat.find_context(channel=channel).emit_print('Server Notice', "%s is coming from %s (%s)" % (nick, ip, host))
xchat.hook_server('JOIN', identify_gateway, priority=xchat.PRI_LOWEST)
开发者ID:ahelsley,项目名称:hacks,代码行数:29,代码来源:gateway_identify.py


示例11: Host

				if k == "Part":
					if args[3]: msgid = "Part with Reason"
					else: msgid = "Part"
				# We want to keep if it's a highlight intact, so pass the event along.
				elif k == "Message" or k == "Action":
					if k == "Action": msg = "\x01ACTION " + args[1] + "\x01"
					else: msg = args[1]
					# Emulate the message so that it will promote the channel status appropriately.
					nick, host = args[0].split("@")
					xchat.command("RECV :%s PRIVMSG %s :%s" % (
						nick + "@" + host + "!" + Host(host), word[2], msg
					))
					return xchat.EAT_XCHAT
				# Otherwise use the key.
				else: msgid = k

				# Emit the actual message.
				xchat.emit_print(msgid, *args)

				# Tell xchat not to print H-tan's Channel Message.
				return xchat.EAT_XCHAT
			#endif
		#endfor

		return xchat.EAT_NONE
#enddef

xchat.hook_server("PRIVMSG", ProxyMessage)

xchat.prnt("Loaded %s version %s." % (__module_name__,__module_version__))
开发者ID:GunfighterJ,项目名称:xchat-plugins,代码行数:30,代码来源:h-tan.py


示例12: megapart

 def megapart(self, word, word_eol, userdata):
   self.whoishook = xchat.hook_server("319",self.got_319)
   self.timer = xchat.hook_timer(120000,self.reset)
   user = word[1]
   xchat.command("QUOTE whois %s" % user)
开发者ID:shibumi,项目名称:IRCollection,代码行数:5,代码来源:megapart.py


示例13: rem_server

#         servers.add(server)
#     print "Suggestible servers are:", " ".join(map(repr, servers))
#     return xchat.EAT_ALL

# xchat.hook_command("SUGGEST_ADD", add_server,
#                    help="/SUGGEST_ADD <server> become suggestible on server.")

# def rem_server(word, word_eol, userdata=None):
#     for server in word[1:]:
#         if server in servers:
#             servers.remove(server)
#         else:
#             print "%r is not in servers." % server
#     print "Suggestible servers are:", " ".join(map(repr, servers))
#     return xchat.EAT_ALL

# xchat.hook_command("SUGGEST_REM", rem_server,
#                    help="/SUGGEST_REM <server> be not suggestible on server.")


def suggestible(word, word_eol, userdata=None):
    context = xchat.get_context()
    connected_to = context.get_info("server").lower()
    context.command("JOIN " + word[3])
    return xchat.EAT_XCHAT


xchat.hook_server("INVITE", suggestible)

print "Becoming suggestible"
开发者ID:RichardBarrell,项目名称:snippets,代码行数:30,代码来源:xchat_join_invite.py


示例14: enable

 def enable(self, *args):
   dprint("enable()")
   if not self.privmsg_hook:
     self.privmsg_hook = xchat.hook_server("PRIVMSG", self.responder)
开发者ID:10crimes,项目名称:code,代码行数:4,代码来源:tkadserv.py


示例15: otcauth_gpg_decrypt

			# Link Good! cURL our string and decrypt.
			curl = pycurl.Curl()
			curl.setopt(curl.URL, url)
			curl.setopt(curl.USERAGENT, """Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)""")
			curl.setopt(curl.WRITEFUNCTION, buf.write)
			curl.perform()

			# Decrypt and message gribble back the verify string.
			auth_string = buf.getvalue()
			buf.close()
			xchat.command("MSG gribble everify %s" % otcauth_gpg_decrypt(auth_string))
			eauthCheck = False
			
	return xchat.EAT_NONE
# Hook the server event when gribble messages us.
xchat.hook_server("PRIVMSG", otcauth_gpg_auth)

	
# The callback function to our hook that ties it all together	
def otcauth_cb(word, word_eol, userdata):
	if len(word) < 2:
		switch = "help"
	else:
		switch = str(word[1]).lower()
	
	if switch == "help":
		otcauth_help(word[1:])
	elif switch == "version":
		otcauth_ver()
	elif switch == "eauth":
		nick = xchat.get_info('nick')
开发者ID:Ex0deus,项目名称:xchat_otc_toolkit,代码行数:31,代码来源:otc_tk.py


示例16: strip_pronouns

    if capture_whois:
        return xchat.EAT_NONE

    # Response format:
    # :server 311 yournick othersnick ~othersuser others/host * :Other's Realname

    _, _, _, nickname, username, host = word[0:6]
    raw_real_name = word_eol[7][1:]

    # Get the real name without pronouns. If they don't have their pronouns
    # specified in their WHOIS information, it simply shows their real name
    # string as-is.
    real_name = strip_pronouns(raw_real_name)

    # Get their pronouns, or None.
    pronouns = get_pronouns(raw_real_name)

    # Print the first line of the WHOIS response, sans pronouns snippet at the end,
    # exactly how XChat would print it otherwise.
    xchat.emit_print("WhoIs Name Line", nickname, username, host, real_name)

    # Print their pronouns as the second line of the WHOIS information,
    # if they specified anything. Otherwise, do nothing.
    if pronouns is not None:
        xchat.emit_print("WhoIs Identified", nickname, "Pronouns: " + pronouns)

    # Stop XChat from printing the default first WHOIS line.
    return xchat.EAT_XCHAT

xchat.hook_server("311", whois_callback)
开发者ID:duckinator,项目名称:xchat-pronouns,代码行数:30,代码来源:xchat-pronouns.py


示例17: float

            else:
                temp_db_size = 0
            db_file = xchat.get_info("xchatdir") + "/seen.db"
            temp_db_file = xchat.get_info("xchatdir") + "/seen.db-journal"
        xchat.prnt(
            "\x02\x0313Seen database info\x02:\n"
            "\x0313\x02Size\x02: %.2fKB\n"      #1
            "\x0313\x02Temp Size\x02: %.2fKB\n" #2
            "\x0313\x02Entries\x02: %d\n"       #3
            "\x0313\x02File\x02: %s\n"          #4
            "\x0313\x02Temp File\x02: %s\n"     #5
            "\x0313\x02Version\x02: %s\n"       #6
            %(
            float(db_size/1024.0),              #1
            float(temp_db_size/1024.0),         #2
            int(num_of_entrys),                 #3
            db_file,                            #4
            temp_db_file,                       #5
            __module_version__                  #6
            ))

seen = Seen()
xchat.hook_unload(seen.on_unload)
xchat.hook_server("PRIVMSG", seen.parse)
xchat.hook_command("seen", seen.lastseen)
xchat.hook_command("seen->info", seen.info)
xchat.hook_command("seen->commit", seen.commit)
xchat.prnt("%s version %s by %s has been loaded." % (__module_name__, __module_version__, __module_author__))
seen.info();
# xchat.prnt("\x02\x0304Note: NEVER LOAD THIS MORE THEN ONCE! IF YOU NEED TO RELOAD IT MAKE SURE TO UNLOAD IT FIRST!!\x02\x03")
开发者ID:AwwCookies,项目名称:xchat-plugin-seen,代码行数:30,代码来源:seen.py


示例18: OffsetTime

    return xchat.EAT_ALL


# enddef

retime = re.compile("(?:(-?\d+)d)?(?:(-?\d+)h)?(?:(-?\d+)m)?(?:(-?\d+)s)?")


def OffsetTime(word, word_eol, userdata):
    d, h, m, s = tuple(map(lambda x: int(x) if x else 0, retime.match(word[2]).groups()))
    # XChat's format example: Sat Dec 15 19:38:08
    form = word_eol[3] if len(word_eol) > 3 else "%a %b %d %H:%M:%S"
    time = datetime.datetime.now() + datetime.timedelta(days=d, hours=h, minutes=m, seconds=s)
    xchat.command("nctcp %s TIME %s" % (word[1], time.strftime(form)))
    return xchat.EAT_XCHAT


# enddef

xchat.hook_command("face", DoFace)
xchat.hook_command("dump", DumpFile)
xchat.hook_command("vercond", SetVerCond)
xchat.hook_command("offtime", OffsetTime)
xchat.hook_server("privmsg", VersionCond)
for x in ["ifuser", "ifnotuser"]:
    xchat.hook_command(x, IfCondition, x)
# endfor
xchat.hook_unload(SaveVerCond)

xchat.prnt("Loaded %s version %s." % (__module_name__, __module_version__))
开发者ID:GunfighterJ,项目名称:xchat-plugins,代码行数:30,代码来源:ctcp.py


示例19: group

def group(n):
    return (','.join(re.findall(r"\d{1,3}", str(n)[::-1])))[::-1]

def privmsg_cb(word, word_eol, userdata):
    id = get_id_from_url(word_eol[3])
    if len(id) == 0:
        return xchat.EAT_NONE
    info = get_yt_info(id)
    if len(info) == 0:
        return xchat.EAT_NONE
    show_yt_info(info)
    return xchat.EAT_NONE

def ytcmd_cb(word, word_eol, userdata):
    if len(word) < 2:
        print "/yt <url> to get video info"
        return xchat.EAT_NONE
    id = get_id_from_url(word_eol[0])
    if len(id) == 0:
        return xchat.EAT_NONE
    info = get_yt_info(id)
    if len(info) == 0:
        return xchat.EAT_NONE
    show_yt_info(info)
    return xchat.EAT_NONE

xchat.hook_command("yt", ytcmd_cb, help="/yt <url> to get video info")
xchat.hook_server("PRIVMSG", privmsg_cb)

print "\0034", __module_name__, __module_version__, "has been loaded\003"
开发者ID:Poorchop,项目名称:xchat-scripts,代码行数:30,代码来源:get-youtube-video-info.py


示例20: print

import string
import xchat

__module_name__ = "Auto Ghost"
__module_version__ = "0.20"
__module_description__ = "Ghost the default nick and change/identify as that user."

display = (__module_name__ + " " + __module_version__ + " has been loaded.",
        "    Module URL: https://github.com/Sepero/xchat_auto_ghost/",
        "    Author: Sepero 2013 - sepero 111 @ gmx . com",
        "         Remote Python developer and Linux administrator for hire.",)

for line in display:
    print("\0034" + line + "\003")

def set_nick(word, word_eol, userdata):
    desired_nick = xchat.get_prefs("irc_nick1")
    password = xchat.get_info("nickserv")
    
    if word[3] == desired_nick and password:
        randstring = ''.join(choice(string.ascii_lowercase) for i in range(16))
        xchat.command("nick %s" % randstring)
        xchat.command("nickserv ghost %s %s" % (desired_nick, password))
        xchat.command("nick %s" % desired_nick)
        xchat.command("nickserv identify %s" % password)
        return xchat.EAT_XCHAT
    
    return xchat.EAT_NONE

xchat.hook_server("433", set_nick, priority=xchat.PRI_HIGHEST)
开发者ID:Sepero,项目名称:xchat_auto_ghost,代码行数:30,代码来源:auto_ghost.py



注:本文中的xchat.hook_server函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python xchat.hook_timer函数代码示例发布时间:2022-05-26
下一篇:
Python xchat.hook_print函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap