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

Python xchat.find_context函数代码示例

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

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



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

示例1: get_highlight_out

 def get_highlight_out(self):
     server = xchat.get_info('server')
     channel = xchat.get_context().get_info('channel')
     query = xchat.find_context(server, HIGHLIGHT_CHANNEL_PREFIX + channel)
     if not query:
         highlight_out = self._create_highlight_out(channel)
         query = xchat.find_context(server, highlight_out)
     return query
开发者ID:theY4Kman,项目名称:yakhilite,代码行数:8,代码来源:yakhilite.py


示例2: acquire_context

 def acquire_context(self):
     self.context = xchat.find_context(server=self.name)
     if not self.context:
         xchat.find_context().set()
         if self.is_server:
             xchat.command('newserver -noconnect "{}"'.format(self.name))
         else:
             xchat.command('query "{}"'.format(self.name))
         self.context = xchat.find_context(server=self.name)
开发者ID:Xuerian,项目名称:xchat_overwatch,代码行数:9,代码来源:overwatch.py


示例3: identify_gateway

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))
开发者ID:ahelsley,项目名称:hacks,代码行数:12,代码来源:gateway_identify.py


示例4: catch_highlight

def catch_highlight(word, word_eol, userdata):
    # Input string ends up being
    # NICK line of text USERMODE
    nick = word[0]
    text = word[1]
    channel = xchat.get_info('channel')
    server = xchat.get_info('server')
    highlighttab = xchat.find_context(channel='@highlights')
    if not highlighttab:
        xchat.command('NEWSERVER -noconnect @highlights')
        highlighttab = xchat.find_context(channel='@highlights')
    highlighttab.prnt('%s/%s <%s> %s' % (server, channel, nick, text))
    return xchat.EAT_NONE
开发者ID:ward,项目名称:xchat-scripts,代码行数:13,代码来源:highlightlog.py


示例5: pm_cb

def pm_cb(word, word_eol, userdata):
	global muted
	global ops
	if word[0].lower() in ops:
		if word[1][0:4] == "mute":
			muted = True
			chan = xchat.find_context(channel="#interns")
			chan.command("say Muted")
			xchat.command("msg " + word[0] + " Muted")
		elif word[1][0:6] == "unmute":
			muted = False
			chan = xchat.find_context(channel="#interns")
			chan.command("say Unmuted")
			xchat.command("msg " + word[0] + " Unmuted")
	return xchat.EAT_NONE
开发者ID:EliteSoba,项目名称:xchat_scripts,代码行数:15,代码来源:quotes.py


示例6: on_text

def on_text(word, word_eol, userdata):
    if option["service"] != True:
        return
    counter = 0
    destination = xchat.get_context()
    network = destination.get_info('network').lower()
    channel = destination.get_info('channel').lower()
    triggernick = word[0].lower()
    if option["service"] == True and option["relayonly"] == True and triggernick not in option["relaynicks"]:
        return
    
    for badword in option["badwords"]:
        if re.search(badword, word[1], re.I):
            counter += 1
    for relaypair in option["relaypairs"]:
        if relaypair[0] == network and relaypair[1] == channel:
            destination = xchat.find_context(server=relaypair[2], channel=relaypair[3])
            try:
                if counter == 0:
                    for key in option["replacements"].keys():
                        word_eol[1] = string.replace(word_eol[1],key,option["replacements"][key])
                    destination.command("say " + "<"+triggernick+"> " + word_eol[1])
                elif option["relaydefaultmsg"] == True:
                    destination.command("say " + "<"+triggernick+"> " + option["defaultmsg"])
            except AttributeError:
                print color["red"], "It appears you have not joined the relay destination channel", relaypair[3], "on", relaypair[2]
开发者ID:KnightRobby,项目名称:cancelbot,代码行数:26,代码来源:relaybot.py


示例7: sharedchannels_cb

def sharedchannels_cb(word, word_eol, userdata):
    mynickname = xchat.get_context().get_info("nick")
    excluded_users = [mynickname, 'ChanServ']      # a list of users to ignore, including your nickname(s)
    if len(word) < 2 or word[1][0] != '#':
        usage(); return xchat.EAT_XCHAT
    chan1 = word[1]
    cc = xchat.find_context(channel=chan1)
    if not cc:
        print "Oops - you don't seem to be in channel", chan1
        return xchat.EAT_XCHAT

    chan1server = cc.get_info('server')
    userlist = {}
    for chan in xchat.get_list('channels'):
        if chan.server == chan1server and chan.type == chantype['channel']:
            for user in chan.context.get_list('users'):
                if user.nick not in excluded_users:
                    userlist.setdefault(chan.channel, []).append(user.nick)

    print "###############################################################################"  # 79
    print "# " + ("The users in %s share the following channels with you (%s)" % (chan1, mynickname)).center(79-4) + " #"
    print "###############################################################################"  # 79
    for chan in sorted(userlist.keys()):
        if chan != chan1:
            usersincommon = sorted(set(userlist[chan1]) & set(userlist[chan]))
            if usersincommon:
                print "%15s:\t%s" % (chan, ', '.join(usersincommon))
    print "###############################################################################"  # 79

    return xchat.EAT_XCHAT
开发者ID:Anaerin,项目名称:hexchat-addons,代码行数:30,代码来源:sharedchannels.py


示例8: process

 def process(self, word, word_eol, userdata):
   partchannel = word[1]
   joinchannel = word[2]
   cnc = xchat.find_context(channel = partchannel)
   for user in cnc.get_list("users"):
     cnc.command("QUOTE sapart %s %s " % (user.nick , partchannel))
     cnc.command("QUOTE sajoin %s %s " % (user.nick , joinchannel))
开发者ID:shibumi,项目名称:IRCollection,代码行数:7,代码来源:masstransfer.py


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


示例10: BanTimerGo

def BanTimerGo(newInfo=None,newTime=None,onYouJoin=False):
	global banTimer,nextBanInfo,nextBanTime
	if onYouJoin:
		newInfo = None
		newTime = None
	#endif
	curTime = time()
	if not newTime:
		for servChan in banTimes:
			serv,chan = tuple(servChan.split("/",1))
			if xchat.find_context(serv,chan):
				remove = []
				for mask in banTimes[servChan]:
					thTime = banTimes[servChan][mask]
					if thTime <= curTime: remove.append((servChan,mask,thTime))
					elif not nextBanTime or thTime < nextBanTime:
						newInfo = (servChan,mask)
						newTime = thTime
					#endif
				#endfor
				for x in remove: BanTimerTick(x)
			#endif
		#endfor
	#endif
	if newInfo and newTime and (not nextBanTime or newTime < nextBanTime):
		nextBanInfo = newInfo
		nextBanTime = newTime
		if banTimer: xchat.unhook(banTimer)
		banTimer = xchat.hook_timer((newTime-int(time()))*1000, BanTimerTick)
开发者ID:GunfighterJ,项目名称:xchat-plugins,代码行数:29,代码来源:betterkb.py


示例11: command_np

def command_np(word=None, word_eol=None, userdata=None):
    global nowplaying
    global chan
    global cnc
    chan = xchat.get_info("channel")
    cnc = xchat.find_context(channel = chan)
    clem = get_clem()
    if clem <> "stop":
       clemp = bus.get_object('org.mpris.clementine', '/Player')
       clemmd = clemp.GetMetadata()
       if clem:
	   pos = clem.PositionGet()
	   album=""
	   artist=""
	   if 'artist' in clemmd:
		artist = " by " + unicode(clemmd['artist']).encode('utf-8')
	   if 'album' in clemmd:
		album = " on " + unicode(clemmd['album']).encode('utf-8')
	   if ('title' in clemmd) and (pos <> 0):
		nowplaying = unicode(clemmd['title'])
	        pos = clem.PositionGet()
		listeningto = "me is listening to " + nowplaying.encode('utf-8')
		if artist <> "":
		    listeningto = listeningto + artist
		if album <> "":
		    listeningto = listeningto + album

		posM='%02d'%(int)(pos/60000);
		posS='%02d'%(int)((pos/1000)%60);

		cnc.command(listeningto+" @ "+unicode(posM).encode('utf-8')+':'+unicode(posS).encode('utf-8')+" [Clementine]")
	   else:
		print "\x02No song is currently playing."
    return xchat.EAT_ALL
开发者ID:jpmeijers,项目名称:scripts,代码行数:34,代码来源:clementine.py


示例12: log

 def log(self, msg):
     ctx = xchat.find_context(channel=">>python<<")
     if ctx:
         # using emit_print results in an infinite loop with activity_cb
         # even when filtering by channel != >>python<<
         #ctx.emit_print("Channel Message", "treenumbers", msg)
         ctx.prnt("treenumbers: %s" % msg)
开发者ID:CrimsonStar,项目名称:hexchat-addons,代码行数:7,代码来源:treenumbers.py


示例13: log

 def log(self, msg):
     ctx = xchat.find_context(channel=">>python<<")
     if ctx:
         # using emit_print results in an infinite loop with activity_cb
         # with anything we hook_print
         # even when filtering by channel != >>python<<
         ctx.emit_print("Notice", "treenumbers", msg)
开发者ID:Draken98,项目名称:hexchat-addons,代码行数:7,代码来源:treenumbers.py


示例14: chanopmsg

def chanopmsg(word, word_eol, userdata):
    if word[2][0] in ['@', '%', '+']:
        nick = word[0][1:].split('!')[0]
        # What about the same channel name on two different servers?
        channel = xchat.find_context(channel = word[2][1:])
        channel.emit_print('Channel Notice', nick, word[2], word_eol[3][1:])
        return xchat.EAT_ALL
开发者ID:ward,项目名称:xchat-scripts,代码行数:7,代码来源:chanopmsg.py


示例15: __init__

	def __init__(self):
		self.destinations = []
		channels = ["#asdf","#kancollewiki"]
		for channel in channels:
			dest = xchat.find_context(channel=channel) 
			#dest = None
			print dest
			self.destinations.append(dest)
开发者ID:remiscarlet,项目名称:RandomKCWikiScripts,代码行数:8,代码来源:tweeters.py


示例16: chan_scan

def chan_scan(userdata):
    global thecontext
    for chan in option["opin"]:
        thecontext = xchat.find_context(channel=chan)
        userlist = thecontext.get_list("users")
        for user in userlist:
            xchat.command("whois " + user.nick)
    return 1
开发者ID:KnightRobby,项目名称:cancelbot,代码行数:8,代码来源:opbot.py


示例17: init_cb

def init_cb(arg):
    global game
    game = XC.find_context(channel='#gridcoin-games')
    
    if game is not None:
        game.prnt('-= scrambler bot loaded =-')
    else:
        XC.hook_timer(4000, init_cb)
开发者ID:Tahvok,项目名称:hexchat-game-bots,代码行数:8,代码来源:scramble_bot.py


示例18: check_hl

def check_hl(word, word_eol, userdata):
    server_tab = xchat.find_context(channel=server_name)
    r2 = re.compile(regexp_already_hl, re.IGNORECASE)
    if len(word_eol) > 1:
        if r2.search(word_eol[1]):
            server_tab.prnt('02[%s02] 05<%s> %s' % (xchat.get_info('channel'), word[0], word_eol[1]))
        else:
            return xchat.EAT_NONE
开发者ID:seb26,项目名称:testpy,代码行数:8,代码来源:hl_regex.py


示例19: sayOnChannels

def sayOnChannels(channels, message):
  lines = None
  for channel in channels:
    context = xchat.find_context(channel=channel)
    if context:
      if lines is None:
        lines = [line.encode('utf-8') for line in message.split('\n')]
      for line in lines:
        context.command('say %s' % line)
开发者ID:jiqingtang,项目名称:jiqingtang,代码行数:9,代码来源:JiqingBot.py


示例20: check_channel

def check_channel(userdata):
    global cnh
    global channel
    cn = xchat.find_context(channel='#%s' % channel)
    if cn is not None:
        xchat.unhook(cnh)
    else:
        xchat.command("join #" + channel)
    return xchat.EAT_ALL
开发者ID:Hackr5,项目名称:py-xchat-twitter,代码行数:9,代码来源:xchat_twitter.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python xchat.get_context函数代码示例发布时间:2022-05-26
下一篇:
Python xchat.command函数代码示例发布时间: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