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

Python xchat.command函数代码示例

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

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



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

示例1: showGUI

def showGUI(word, word_eol, userdata):
   #path = raw(path)
   if __name__ == "__main__":
       app = wx.PySimpleApp(0)
       wx.InitAllImageHandlers()
       try:
           if word[1] == "derp":
               frame_1 = AdvancedWindow(None, -1, "")
               app.SetTopWindow(frame_1)
               frame_1.Show()
               app.MainLoop()
           if word[1] == "update":
               latest = urlopen("http://xvicario.us/gar/latest")
               latest = int(latest.read())
               if version == latest:
                   xchat.prnt("GarGUI: No Updates Found...")
               elif version < latest:
                   xchat.prnt("GarGUI: Update Found... Downloading.")
                   garLatest = urlopen("http://xvicario.us/gar/GarGUI.py")
                   xchat.prnt("GarGUI: Downloaded... Applying Update.")
                   garLatest = garLatest.read()
                   GarGUI = open(path2 + "/GarGUI.py", "w")
                   GarGUI.write(garLatest)
                   GarGUI.close()
                   xchat.prnt("GarGUI: Updated... Unloading module.  Please load GarGUI to finish the update.")
                   xchat.command("py unload GarGUI")
       except IndexError:
           frame_1 = SimpleWindow(None, -1, "")
           app.SetTopWindow(frame_1)
           frame_1.Show()
           app.MainLoop()
开发者ID:XVicarious,项目名称:GarGUI,代码行数:31,代码来源:GarGUI.py


示例2: handle_rpl_endofrsachallenge2

def handle_rpl_endofrsachallenge2(word, word_eol, userdata):
	global challenge, keyphrase, respond_path, private_key_path

	print("ratbox-challenge: Received challenge, generating response.")

	if not os.access(respond_path, os.X_OK):
		print("ratbox-challenge: Unable to execute respond from " + respond_path + "\n")
		return xchat.EAT_ALL

	if not os.access(private_key_path, os.R_OK):
		print("ratbox-challenge: Unable to open " + private_key_path + "\n")
		return xchat.EAT_ALL

	p = Popen([respond_path, private_key_path], stdin=PIPE, stdout=PIPE, bufsize=1)
	p.stdin.write(keyphrase + "\n")
	p.stdin.write(challenge + "\n")
	output = p.stdout.readline().rstrip()

	if output.startswith("Error:"):
		print("ratbox-challenge: " + output + "\n")
		return xchat.EAT_ALL

	print("ratbox-challenge: Received response, opering..\n")

	keyphrase = None
	challenge = None

	xchat.command("QUOTE CHALLENGE +{}".format(output));

    	return xchat.EAT_ALL
开发者ID:ManiacTwister,项目名称:xchat-scripts,代码行数:30,代码来源:challresp.py


示例3: shout

def shout(word, word_eol, userdata):
     global bold_char, audtool_prog
     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
开发者ID:evanniedojadlo,项目名称:snippets,代码行数:26,代码来源:audacious.py


示例4: messagebuffer

def messagebuffer(dunno):
    global list_

    #Makes sure we have locked the list so that we start on a new list if we send messages during execution
    tmplist = list_
    list_ = None

    #Get's the current channel, so we know where we should send messages
    channel = xchat.get_info('channel')

    #If the list is shorter than the pastelimit, just send them one by one to the irc-server
    if len(tmplist) <= settings['limit']:
        for i in tmplist:
            #send the actual string
            xchat.command("PRIVMSG %s :%s" % (channel, i))

            #recreate the output from a regular message, as this is just a regular message
            xchat.emit_print("Your Message", xchat.get_info('nick'), i, "@")
    else:
        #Add all the lines together into a string
        str_ = ""
        for i in tmplist:
            str_ += i + "\n"

        # do the paste
        pastie_url = do_pastie(str_[:-1])

        xchat.command("PRIVMSG %s :%s" % (xchat.get_info('channel'), pastie_url))
        xchat.emit_print("Your Message", xchat.get_info('nick'), pastie_url, "@")

        return 0  # Return 0 so we don't repeat the timer.
开发者ID:thecodeassassin,项目名称:xchat-autopaster,代码行数:31,代码来源:xchat-autopaster.py


示例5: WhoStoleIt

def WhoStoleIt(userdata):
	global dInfo
	sServ=xchat.get_info("network")
	if sServ in dInfo:
		xchat.command("whois %s" % dInfo[sServ]["nick"])
		dInfo[sServ]["who1"] = xchat.hook_print("Generic Message", Test)
		dInfo[sServ]["who2"] = xchat.hook_print("WhoIs End", WhoEnd)
开发者ID:logicplace,项目名称:xchat-plugins,代码行数:7,代码来源:autoghost.py


示例6: do_endquiet

def do_endquiet(word, word_eol, userdata):
    """Process end-of-quiet markers"""
    channel = word[3]
    if channel in collecting_bans:
        xchat.command('quote cs akick %s list' % channel)
        return xchat.EAT_ALL
    return xchat.EAT_NONE
开发者ID:grimreaper,项目名称:chanserv.py,代码行数:7,代码来源:chanserv.py


示例7: send_message

def send_message(word, word_eol, userdata):
    """Gets the inputbox's text, replace URL's with shortened URLs.

    This function is called every time a key is pressed. It will stop if that
    key isn't Enter or if the input box is empty.

    KP_Return (keypad Enter key) is ignored, and can be used if you don't want
    a URL to be shortened.
    """
    if not prefs('get'):
        return
    if not(word[0] == "65293"): return
    msg = xchat.get_info('inputbox')
    if msg is None: return
    if msg.startswith('/'): return
    urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[[email protected]&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', msg)
    if not urls: return
    for url in urls:
        try:
            data = shorten(url)
            if not data: continue
            msg = msg.replace(url, str(data))
        except: continue
    xchat.command("settext %s" % msg)
    
    return xchat.EAT_ALL
开发者ID:Jake0720,项目名称:XChat-Scripts,代码行数:26,代码来源:short.py


示例8: OffsetTime

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
开发者ID:GunfighterJ,项目名称:xchat-plugins,代码行数:7,代码来源:ctcp.py


示例9: intercept_print

def intercept_print(word, word_eol, userdata):
    if (word_eol[0][:3] == '###'):
        return xchat.EAT_NONE
    # surely this can be more efficient
    line = word_eol[0] \
        .replace('<3', '♥') \
        .replace('=)', 'ツ') \
        .replace('^^', '^̮^') \
        .replace('!!', '‼') \
        .replace('°C', '℃') \
        .replace('->', '→') \
        .replace('=>', '⇒') \
        .replace('(tm)', '™') \
        .replace('(r)', '®') \
        .replace('(c)', '©') \
        .replace(':dis:', 'ಠ_ಠ') \
        .replace(':cry:', 'ಥ_ಥ') \
        .replace('?!', '‽') \
        .replace(':roll:', '◔_◔') \
        .replace(':commy:', '☭') \
        .replace(':king:', '♔') \
        .replace(':zzz:', '( ̄。 ̄)~zzz') \
        .replace(':hugme:', '(ノ゜,゜)ノ') \
        .replace(':fliptable:', '(╯°□°)╯︵ ┻━┻') \
        .replace('\\infty', '∞') \
        .replace('\\in', '∈') \
        .replace('\\forall', '∀') \
        .replace('\\nin', '∉') \
        .replace('\\sqrt', '√') \
        .replace('\\pm', '±') \
        .replace('+-', '±') \
        .replace('\\neq', '≠')
    xchat.command(' '.join(['msg', xchat.get_info('channel'), line]))
    return xchat.EAT_ALL
开发者ID:ward,项目名称:xchat-scripts,代码行数:34,代码来源:unicode.py


示例10: get_others_pronouns

def get_others_pronouns(handle):
    global capture_whois

    capture_whois = True
    xchat.command("WHOIS " + handle)

    return xchat.EAT_ALL
开发者ID:duckinator,项目名称:xchat-pronouns,代码行数:7,代码来源:xchat-pronouns.py


示例11: pithos

def pithos(word, word_eol, userdata):
	try:
		player = session_bus.get_object('net.kevinmehall.Pithos', '/net/kevinmehall/Pithos')
	except (dbus.exceptions.DBusException, TypeError):
		xchat.prnt('Pithos: Could not find player.')
		return xchat.EAT_XCHAT

	song = player.GetCurrentSong()
	# to be configurable
	msg = 'me is now playing %s by %s on %s.'%(song['title'], song['artist'], song['album'])

	if len(word) > 1:
		# not very useful?
		if word[1] == 'info':
			xchat.prnt(msg[18:])

		elif word[1] == 'next':
			player.SkipSong()

		elif word[1] == 'love':
			player.LoveCurrentSong()

		elif word[1] == 'hate':
			player.BanCurrentSong()

		else:
			xchat.prnt('Pithos: Valid commands are: info, next, love, hate, or without args to announce')
	else:
		xchat.command(msg)
	return xchat.EAT_ALL
开发者ID:BFCatalin,项目名称:plugins,代码行数:30,代码来源:pithos.py


示例12: sublime

def sublime(word, word_eol, userdata):
  p = sub.Popen(os.getenv('APPDATA') + "\\HexChat\\addons\\sublime.exe", stdout=sub.PIPE, stderr=sub.PIPE)
  output, errors = p.communicate()
  if output == "Error":
    XC.command("me " + "isn't working.")
  else:
   XC.command("me " + "is working at " + output.split("- Sublime Text")[0].split("\\")[-1].strip() + ".")
开发者ID:RoxasShadow,项目名称:Sublime-Text-Working-at,代码行数:7,代码来源:sublime.py


示例13: mpc_hc

def mpc_hc(caller, callee, helper):
    data = urllib2.urlopen(MPC_HC_URL).read()
    mpc_hc_np = MPC_HC_REGEXP.findall(data)[0].replace("&laquo;", "«")
    mpc_hc_np = mpc_hc_np.replace("&raquo;", "»")
    mpc_hc_np = mpc_hc_np.replace("&bull;", "•")
    xchat.command("say %s" % mpc_hc_np)
    return xchat.EAT_ALL
开发者ID:ImmortalJ,项目名称:snippets,代码行数:7,代码来源:mpc.hc.np.py


示例14: make_a_rainbow

def make_a_rainbow(word, word_eol, userdata):

  original = XC.strip(word_eol[1])
  sequence = ['04', '07', '08', '03', '12', '02', '06']
  length = len(original)
  counter = len(sequence)
  colored = ''
  COLOR = '\003'
  i = 0
  num = 0

  while(i <= length - 1):

    if(i >= counter):
      num = i - counter

      while(num >= counter):
        num -= counter

    else:
      num = i

    tmp = COLOR + sequence[num] + original[i]
    colored = colored + tmp
    i += 1

  XC.command('say %s' % (colored + COLOR))
开发者ID:b0nk,项目名称:scriptsNconfs,代码行数:27,代码来源:rnb.py


示例15: show_song

def show_song(call, word_eol, userdata):
	'''
	Main-method.
	Returns information about the song.
	If the hook gehts arguments it will pass the command to control_exaile
	'''
	global exa_dbus
	
	try:
		#Connect to DBus
		bus = dbus.SessionBus()
		dbus_object = bus.get_object("org.exaile.Exaile","/org/exaile/Exaile")
		exa_dbus = dbus.Interface(dbus_object,"org.exaile.Exaile")
	except:
		print "DBus can't connect to Exaile!"
		return xchat.EAT_ALL

	#Did we get more than just our hook?
	if len(call) > 1:
		control_exaile(call[1])
		return xchat.EAT_ALL

	if exa_dbus.IsPlaying():
		xchat.command ("me is listening to " + getTrackInfo())
	else:
		print getTrackInfo()
	return xchat.EAT_ALL
开发者ID:okin,项目名称:Exaile---XChat---Now-Playing,代码行数:27,代码来源:exaile_now_playing.py


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


示例17: parse

def parse(word, word_eol, userdata):
	try:
		trigger = word[1]
	except:
		trigger = ''
	if trigger == "show":
		xchat.command("ME listening to {0}".format(get_info()))
	elif trigger == "next":
		subprocess.call("mocp -f", shell=True)
		print("Now playing: {0}".format(get_info()))
	elif trigger == "prev":
		subprocess.call("mocp -r", shell=True)
		print("Now playing: {0}".format(get_info()))
	elif trigger == "pause":
		subprocess.call("mocp -G", shell=True)
		print("Triggered pause")
	elif trigger == "stop":
		subprocess.call("mocp -s", shell=True)
		print("Stopping: {0}".format(get_info()))
	elif trigger == "play":
		subprocess.call("mocp -p", shell=True)
		print("Now playing: {0}".format(get_info()))
	elif trigger == "quit" or trigger == "kill":
		subprocess.call("mocp -x", shell=True)
		print("Killing MoC")
	elif trigger == "vol":
		if word[2].isdigit():
			subprocess.call("mocp -v {0}".format(word[2]), shell=True)
		else:
			print("You must specify a volume level, 0-100.")
	elif trigger == "help":
		help()
	else:
		print("You need to pass an argument to this command")
	return xchat.EAT_ALL
开发者ID:hackerzzgroup,项目名称:IRC_Scripts,代码行数:35,代码来源:mocp-xchat.py


示例18: nowPlaying2

def nowPlaying2(word, word_eol, userdata):
	if getNpInfo():	 
		if len(title) < 1:
			text = "me is playing nothing on Audacious"
		else:
			text = "me > "

			if artist != None:
				text += '%s - ' % artist
			elif album != None:
				text += 'Unknown artist - '

			text += '%s ' % title

			if album != None:
				if tracknumber > 0:
					text += ' - [ %s #%d ] ' % (album, tracknumber)
				else:
					text += ' - [ %s ] ' % (album)

			text += '- [ %s / %s ] ' % (formatTime(position), formatTime(length))

		xchat.command(text)

	return xchat.EAT_ALL
开发者ID:Spaghetti-Cat,项目名称:Scripts,代码行数:25,代码来源:hexchat-audacious.py


示例19: weapon_activate

def weapon_activate(ctx):
    context = ctx['context']
    if ctx["wasop"]:
        weapon_continue(ctx)
    else:
        xchat.command("msg ChanServ OP %s %s" % (context.get_info('channel'), context.get_info('nick')))
        xchat.hook_timer(500, weapon_timer, userdata=ctx)
开发者ID:lsanscombe,项目名称:random,代码行数:7,代码来源:hammer.py


示例20: nowPlaying

def nowPlaying(word, word_eol, userdata):
	if getNpInfo():	 
		if len(title) < 1:
			text = "me is playing nothing on Audacious"
		else:
			text = "me is playing on Audacious: "
			text += '[ %s / %s ] ' % (formatTime(position), formatTime(length))

			text += '\"' + title + '\" '
			if artist != None:
				text += 'by "%s" ' % artist
			elif album != None:
				text += 'by "Unknown artist" '

			if album != None:
				if tracknumber > 0:
					text += '(track #%d' % tracknumber + ' of album \"' + album + '\") '
				else:
					text += '(album \"' +  album + '\") '

			text += '| ' + fmt + ' | ' + samplerate + ' | ' + bitrate

		xchat.command(text)

	return xchat.EAT_ALL
开发者ID:Spaghetti-Cat,项目名称:Scripts,代码行数:25,代码来源:hexchat-audacious.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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