本文整理汇总了Python中Interface.Interface.send方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.send方法的具体用法?Python Interface.send怎么用?Python Interface.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interface.Interface
的用法示例。
在下文中一共展示了Interface.send方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Interface import Interface [as 别名]
# 或者: from Interface.Interface import send [as 别名]
def main():
match = re.match(r"((?:\")(.+)(?:\")|([^ ]+))"
"( (removeall|(add|remove) ([^ ]+)|add))?", msg)
if not match:
activator.Controller().DrawInfo(
"Usage: /cmd_permission <[]\"]player name[]\"]>",
color = COLOR_WHITE)
return
player = match.group(2) or match.group(3)
action = match.group(6) or match.group(5)
cmd_permission = match.group(7)
pl = FindPlayer(player)
if not pl:
activator.Controller().DrawInfo("No such player.", color = COLOR_RED)
return
inf = Interface(activator, pl)
if cmd_permission:
cmd_permission = markup_unescape(cmd_permission)
if action == "add":
if cmd_permission:
if not cmd_permission in pl.Controller().cmd_permissions:
pl.Controller().cmd_permissions.append(cmd_permission)
else:
inf.add_msg("{pl.name} already has that permission.",
color = COLOR_RED, pl = pl)
else:
inf.set_text_input(prepend = "/cmd_permission {} add ".format(
pl.name))
elif action == "remove":
try:
pl.Controller().cmd_permissions.remove(cmd_permission)
except ValueError:
inf.add_msg("{pl.name} does not have that permission.",
color = COLOR_RED, pl = pl)
elif action == "removeall":
pl.Controller().cmd_permissions.clear()
inf.add_msg("{pl.name} has the following permissions:\n", pl = pl)
for tmp in pl.Controller().cmd_permissions:
if tmp:
inf.add_msg("\n {perm} [y=-2][a=:/cmd_permission "
"{pl.name} remove {perm}]x[/a]",
perm = markup_escape(tmp), newline = False, pl = pl)
inf.add_link("Add permission",
dest = "/cmd_permission {} add".format(pl.name))
inf.add_link("Remove all permissions",
dest = "/cmd_permission {} removeall".format(pl.name))
inf.send()
示例2: show
# 需要导入模块: from Interface import Interface [as 别名]
# 或者: from Interface.Interface import send [as 别名]
def show (self, ac = None, append = None):
inf = Interface(self.activator, self.activator)
if ac is None:
inf.set_title(self.activator.name + "'s Python Console")
msg = markup_escape("\n".join(self.inf_data))
inf.add_msg("[font=mono 12]{}[/font]".format(msg))
else:
inf.restore()
inf.set_text_input(prepend = "/console \"", allow_tab = True,
allow_empty = True, cleanup_text = False, scroll_bottom = True,
autocomplete = "noinf::ac::",
text = ac if ac else "")
if append:
inf.set_append_text("[font=mono 12]\n{}[/font]".format(append))
inf.send()
示例3: WhoIsActivator
# 需要导入模块: from Interface import Interface [as 别名]
# 或者: from Interface.Interface import send [as 别名]
from Atrinik import *
from Interface import Interface
activator = WhoIsActivator()
me = WhoAmI()
msg = WhatIsMessage().strip().lower()
inf = Interface(activator, me)
def main():
if msg == "hello":
import random
replies = [
"Get away from my *hic* beer *hic*!",
"I can see you! *hic* Don' make me come af'er you! *hic* ... Can ye find my sword? I think I losst it!",
"Bartender, 'nother beer here!",
"[yellow]The " + me.name + " breaks into a song...[/yellow]\n\nI am a guard aaaand I am havin' a beer. Drinky drinky guard, drinky drinky guard.",
"*HIC*",
"I'm *hic!* watchin' you! I bets ye think I'm *hic* off duty but ye be wrong! I'm here guardin' my beer an' no-one iss gonna *hic!* take it from me!",
"It's not fair! *hic!* I gets paid low wages! But I *hic* are super guard! We don' needs so many *hic* guards aroun' here! I can handles this whole *hic* here place meself! Noth'n can *hic* beat me! Hahahaha*hic!*!",
"Ahhh! Stop that... shouting! It's making... people... me... nervous!",
]
inf.add_msg(random.choice(replies))
main()
inf.send()