How to use tell method in avocado

Best Python code snippet using avocado_python

warpR.py

Source:warpR.py Github

copy

Full Screen

...38 args = info.content.split(' ')39 if len(args) == 1:40 if enable_warp_teleport == True:41 for line in help_msg.splitlines():42 server.tell(info.player, line)43 server.tell(info.player, "§b!!warp tp [名称] §f- §c传送至坐标点")44 else:45 for line in help_msg.splitlines():46 server.tell(info.player, line)47 elif args[1] == 'help':48 if enable_warp_teleport == True:49 for line in help_msg.splitlines():50 server.tell(info.player, line)51 server.tell(info.player, "§b!!warp tp [名称] §f- §c传送至坐标点")52 else:53 for line in help_msg.splitlines():54 server.tell(info.player, line)55 elif args[1] == 'add':56 warp_add(args, server, info)57 saveJson()58 elif args[1] == 'update':59 warp_update(args, server, info)60 saveJson()61 elif args[1] == 'list':62 warp_print(server, info)63 elif args[1] == 'search':64 warp_search(args, server, info)65 elif args[1] == 'del':66 warp_delete(args, server, info)67 saveJson()68 elif args[1] == 'tp':69 warp_teleport(server, info, args)70 else:71 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c参数错误,请输入!!warp help 查看帮助信息")72def warp_teleport(server, info, args):73 if enable_warp_teleport == True:74 if args[2] in warp_list:75 if len(warp_list[args[2]]) == 5:76 if info.player == warp_list[args[2]][4]:77 server.tell(info.player, "§7[§1WARP§f/§aINFO§7] §b将在3秒后传送至坐标点 {}".format(args[2]))78 dim = warp_list[args[2]][0]79 x = warp_list[args[2]][1]80 y = warp_list[args[2]][2]81 z = warp_list[args[2]][3]82 time.sleep(3)83 server.execute('execute in {} run tp {} {} {} {}'.format(tp_tran[dim], info.player, x, y, z))84 else:85 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c坐标点为私密,非创建人无法传送")86 else:87 server.tell(info.player, "§7[§1WARP§f/§aINFO§7] §b将在3秒后传送至坐标点 {}".format(args[2]))88 dim = warp_list[args[2]][0]89 x = warp_list[args[2]][1]90 y = warp_list[args[2]][2]91 z = warp_list[args[2]][3]92 time.sleep(3)93 server.execute('execute in {} run tp {} {} {} {}'.format(tp_tran[dim], info.player, x, y, z))94 else:95 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c坐标点不存在")96 else:97 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c服务器未开启坐标点传送")98# 删除坐标点99def warp_delete(args, server, info):100 if len(args) == 3:101 if args[2] in warp_list:102 if len(warp_list[args[2]]) == 5:103 if warp_list[args[2]][4] == info.player:104 del warp_list[args[2]]105 server.tell(info.player, "§7[§1WARP§f/§aINFO§7] §b成功删除坐标点 §e{}".format(args[2]))106 else:107 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c私密坐标点,只有创建人可以操作")108 else:109 del warp_list[args[2]]110 server.tell(info.player, "§7[§1WARP§f/§aINFO§7] §b成功删除坐标点 §e{}".format(args[2]))111 else:112 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c未找到坐标名,请检查拼写")113 else:114 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c参数错误,请输入您要删除的坐标名")115# 搜索坐标点116def warp_search(args, server, info):117 i = 0118 if len(args) == 3:119 server.tell(info.player, "§7[§1WARP§f/§aSEARCH§7] §b含有关键词 §e{} 的坐标有: ".format(args[2]))120 for key in warp_list.keys():121 if args[2] in key:122 i = 1123 if len(warp_list[key]) == 5:124 if warp_list[key][4] == info.player:125 server.tell(info.player, "§7[§1WARP§f/§aSEARCH§7] §b私密坐标点: §e{} §b坐标: §r{} §e{}§b, §e{}§b, §e{}".format(key, dim_tran[warp_list[key][0]], warp_list[key][1], warp_list[key][2], warp_list[key][3]))126 elif len(warp_list[key]) == 4:127 server.tell(info.player, "§7[§1WARP§f/§aSEARCH§7] §b坐标点: §e{} §b坐标: §r{} §e{}§b, §e{}§b, §e{}".format(key, dim_tran[warp_list[key][0]], warp_list[key][1], warp_list[key][2], warp_list[key][3]))128 if i == 1:129 i = 0130 else:131 server.tell(info.player, "§7[§1WARP§f/§aINFO§7] §b呀,啥都没有")132 else:133 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c参数错误,请输入需要查找的坐标名")134# 打印坐标点135def warp_print(server, info):136 server.tell(info.player, "§7[§1WARP§f/§aLIST§7] §b坐标点列表")137 for key, values in warp_list.items():138 dim = values[0]139 x = values[1]140 y = values[2]141 z = values[3]142 try:143 if len(values) == 5:144 player = values[4]145 if player == info.player:146 server.tell(info.player, "§7[§1WARP§f/§aLIST§7] §b私密坐标点: §e{} §b坐标: §r{} §e{}, {}, {}".format(key, dim_tran[dim], x, y, z))147 finally:148 if len(values) == 4:149 server.tell(info.player, "§7[§1WARP§f/§aLIST§7] §b公共坐标点: §e{} §b坐标: §r{} §e{}, {}, {}".format(key, dim_tran[dim], x, y, z))150# 更新坐标点151def warp_update(args, server, info):152 if len(args) == 3:153 if args[2] in warp_list:154 if len(warp_list[args[2]]) == 5:155 if warp_list[args[2]][4] == info.player:156 PlayerInfoAPI = server.get_plugin_instance('PlayerInfoAPI')157 pos = PlayerInfoAPI.getPlayerInfo(server, info.player, path='Pos')158 x = int(pos[0])159 y = int(pos[1])160 z = int(pos[2])161 dim = PlayerInfoAPI.getPlayerInfo(server, info.player, path='Dimension')162 warp_list[args[2]] = [dim, x, y, z, info.player]163 server.tell(info.player, "§7[§1WARP§f/§bINFO§7] §b已成功更新坐标点 §e{}".format(args[2]))164 else:165 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c私密坐标点,只有创建人可以操作")166 else:167 PlayerInfoAPI = server.get_plugin_instance('PlayerInfoAPI')168 pos = PlayerInfoAPI.getPlayerInfo(server, info.player, path='Pos')169 x = int(pos[0])170 y = int(pos[1])171 z = int(pos[2])172 dim = PlayerInfoAPI.getPlayerInfo(server, info.player, path='Dimension')173 warp_list[args[2]] = [dim, x, y, z]174 server.tell(info.player, "§7[§1WARP§f/§bINFO§7] §b已成功更新坐标点 §e{}".format(args[2]))175 else:176 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c坐标点不存在,请检查拼写")177 else:178 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c参数错误,请输入需要更新的坐标点名称")179# 添加坐标点180def warp_add(args, server, info):181 if len(args) == 3:182 if args[2] in warp_list:183 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c坐标点已存在")184 else:185 PlayerInfoAPI = server.get_plugin_instance('PlayerInfoAPI')186 pos = PlayerInfoAPI.getPlayerInfo(server, info.player, path='Pos')187 x = int(pos[0])188 y = int(pos[1])189 z = int(pos[2])190 dim = PlayerInfoAPI.getPlayerInfo(server, info.player, path='Dimension')191 warp_list[args[2]] = [dim, x, y, z]192 server.tell(info.player, "§7[§1WARP§f/§bINFO§7] §b已成功添加坐标点 §e{}".format(args[2]))193 elif len(args) == 4:194 if args[2] in warp_list:195 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c坐标点已存在")196 else:197 if args[3] == 'True':198 PlayerInfoAPI = server.get_plugin_instance('PlayerInfoAPI')199 pos = PlayerInfoAPI.getPlayerInfo(server, info.player, path='Pos')200 x = int(pos[0])201 y = int(pos[1])202 z = int(pos[2])203 dim = PlayerInfoAPI.getPlayerInfo(server, info.player, path='Dimension')204 warp_list[args[2]] = [dim, x, y, z, info.player]205 server.tell(info.player, "§7[§1WARP§f/§bINFO§7] §b已成功添加私密坐标点 §e{}".format(args[2]))206 else:207 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c只能为True私密坐标点或留空公共坐标点")208 else:209 server.tell(info.player, "§7[§1WARP§f/§cWARN§7] §c参数错误,请创建坐标点的名称")210def on_load(server, old):211 global warp_list212 server.register_help_message('!!warp', '坐标点插件帮助')213 try:214 with open(json_filename) as f:215 warp_list = json.load(f, encoding='utf8')216 except:217 saveJson()218def on_unload(server):219 saveJson()220#保存字典至JSON221def saveJson():222 with open(json_filename, 'a+') as f:223 json.dump(warp_list, f, indent=4)

Full Screen

Full Screen

vote.py

Source:vote.py Github

copy

Full Screen

...19 if info.content.startswith('!!vote'):20 args = info.content.split(' ')21 if len(args) == 1:22 for line in help_msg.splitlines():23 server.tell(info.player, line)24 elif args[1] == 'help':25 for line in help_msg.splitlines():26 server.tell(info.player, line)27 elif args[1] == 'list':28 server.tell(info.player, "§7[§1VOTE§f/§aLIST§7] §b进行中的投票列表")29 for key in event_list.keys():30 server.tell(info.player, "§7[§1VOTE§f/§aLIST§7] §bID: §e{}".format(key))31 elif args[1] == 'add':32 add_event(args, server, info)33 elif args[1] == 'remove':34 remove_event(args, server, info)35 elif args[1] == 'result':36 result(args, server, info)37 elif args[1] == 'agree':38 agree_vote(args, server, info)39 elif args[1] == 'disagree':40 disagree_vote(args, server, info)41 else:42 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请输入!!vote help 查看帮助信息")43#反对投票44def disagree_vote(args, server, info):45 if len(args) == 3: 46 if args[2] in event_list:47 if info.player in event_list[args[2]][3]:48 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c您不能为自己的项目投票哦")49 elif info.player in event_list[args[2]]:50 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c您已为此项目投票,不能重复投票哦")51 else:52 event_list[args[2]][1] = event_list[args[2]][1] + 153 event_list[args[2]].append(info.player)54 server.tell(info.player, "§7[§1VOTE§f/§aINFO§7] §b您已成功为此项目投票")55 else:56 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请求ID不存在")57 else:58 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请输入赞成的项目的ID")59# 赞成投票60def agree_vote(args, server, info):61 if len(args) == 3: 62 if args[2] in event_list:63 if info.player in event_list[args[2]][3]:64 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c您不能为自己的项目投票哦")65 elif info.player in event_list[args[2]]:66 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c您已为此项目投票,不能重复投票哦")67 else:68 event_list[args[2]][0] = event_list[args[2]][0] + 169 event_list[args[2]].append(info.player)70 server.tell(info.player, "§7[§1VOTE§f/§aINFO§7] §b您已成功为此项目投票")71 else:72 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请求ID不存在")73 else:74 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请输入赞成的项目的ID")75# 显示结果76def result(args, server, info):77 if len(args) == 3:78 if args[2] in event_list:79 if event_list[args[2]][2] == True:80 if event_list[args[2]][3] == info.player:81 server.tell(info.player, "§7[§1VOTE§f/§aRESULT§7] §b项目 §e{} §b截止到目前为止的票数为:".format(args[2]))82 server.tell(info.player, "§7[§1VOTE§f/§aRESULT§7] §b赞成: §e{} 票".format(event_list[args[2]][0]))83 server.tell(info.player, "§7[§1VOTE§f/§aRESULT§7] §b反对: §e{} 票".format(event_list[args[2]][1]))84 server.tell(info.player, "§7[§1VOTE§f/§aINFO§7] §b可以输入!!vote remove 移除此项目")85 else:86 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c非常抱歉,项目创建者禁止他人查看结果")87 else:88 server.tell(info.player, "§7[§1VOTE§f/§aRESULT§7] §b项目 §e{} §b截止到目前为止的票数为:".format(args[2]))89 server.tell(info.player, "§7[§1VOTE§f/§aRESULT§7] §b赞成: §e{} 票".format(event_list[args[2]][0]))90 server.tell(info.player, "§7[§1VOTE§f/§aRESULT§7] §b反对: §e{} 票".format(event_list[args[2]][1]))91 server.tell(info.player, "§7[§1VOTE§f/§aINFO§7] §b可以输入!!vote remove 移除此项目")92 else:93 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请求ID不存在")94 else:95 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请输入需要查看项目的ID")96# 移除投票项目97def remove_event(args, server, info):98 if len(args) == 3:99 if args[2] in event_list:100 if info.player == event_list[args[2]][3]:101 del event_list[args[2]]102 server.tell(info.player, "§7[§1VOTE§f/§bINFO§7] §b已成功移除项目 §e{}".format(args[2]))103 else:104 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c只有项目创建人可以删除项目")105 else:106 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请求ID不存在")107 else:108 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请输入需要删除项目的ID")109# 添加投票项目 110def add_event(args, server, info):111 if len(args) == 3:112 if args[2] in event_list:113 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c项目名称已存在")114 else:115 event_list['{}'.format(args[2])] = [0, 0, False, info.player]116 server.tell(info.player, "§7[§1VOTE§f/§bINFO§7] §b已成功添加项目 §e{}".format(args[2]))117 elif len(args) == 4:118 if args[3] == 'True':119 if args[2] in event_list:120 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c项目名称已存在")121 else:122 event_list['{}'.format(args[2])] = [0, 0, True, info.player]123 server.tell(info.player, "§7[§1VOTE§f/§bINFO§7] §b已成功添加项目 §e{} §b投票结果将对外隐藏".format(args[2]))124 else:125 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,只能为True对外隐藏或对外开放")126 else:127 server.tell(info.player, "§7[§1VOTE§f/§cWARN§7] §c参数错误,请输入创建项目的名称")128# 玩家加入提醒129def on_player_joined(server, player):130 i = 0131 if event_list:132 for item in event_list:133 if player not in event_list[item] and i == 0:134 i = 1135 time.sleep(0.5)136 server.tell(player, "§7[§1VOTE§f/§bINFO§7] §b又有了新的投票项目哦,快去看看吧!")137 server.tell(player, "§7[§1VOTE§f/§bINFO§7] §b输入!!vote list 查看所有投票项目")138def on_load(server, old):139 global event_list140 server.register_help_message('!!vote', '投票系统帮助')141 try:142 with open(json_filename, 'r') as f:143 event_list = json.load(f, encoding='utf8')144 except:145 saveJson()146def on_unload(server):147 saveJson()148#保存字典至JSON149def saveJson():150 with open(json_filename, 'w') as f:151 json.dump(event_list, f, indent=4)...

Full Screen

Full Screen

tpa.py

Source:tpa.py Github

copy

Full Screen

...13def on_user_info(server, info):14 if info.content == '!!tpaccept':15 if info.player in request_list.values():16 tp_player = list (request_list.keys()) [list (request_list.values()).index (info.player)]17 server.tell(info.player, "§7[§3TPA§f/§aINFO§7] §b对方正在传送")18 server.tell(tp_player, "§7[§3TPA§f/§aINFO§7] §b对方已接受传送请求,将在3秒后传送,请不要移动")19 sleep(3)20 del request_list[tp_player]21 server.execute('tp {} {}'.format(tp_player, info.player))22 else:23 server.tell(info.player, "§7[§3TPA§f/§cWARN§7] §c无传送请求等待处理")24 elif info.content.startswith('!!tpa'):25 args = info.content.split(' ')26 if len(args) == 1:27 for line in help_msg.splitlines():28 server.tell(info.player, line)29 elif len(args) == 2:30 tp_request(server, info, args)31 else:32 server.tell(info.player, "§7[§3TPA§f/§cWARN§7] §c参数错误,请输入 §e!!tpa §c查看帮助")33 elif info.content == '!!tpcancel':34 if info.player in request_list.keys():35 another_player = request_list[info.player]36 server.tell(another_player, "§7[§3TPA§f/§aINFO§7] §b对方已取消传送请求")37 server.tell(info.player, "§7[§3TPA§f/§aINFO§7] §b传送请求已取消")38 del request_list[info.player]39 else:40 server.tell(info.player, "§7[§3TPA§f/§cWARN§7] §c无传送请求等待处理")41 elif info.content == '!!tpdeny':42 if info.player in request_list.values():43 tp_player = list (request_list.keys()) [list (request_list.values()).index (info.player)]44 server.tell(info.player, "§7[§3TPA§f/§aINFO§7] §b已拒绝传送请求")45 server.tell(tp_player, "§7[§3TPA§f/§aINFO§7] §b对方已拒绝传送请求")46 del request_list[tp_player]47 else:48 server.tell(info.player, "§7[§3TPA§f/§cWARN§7] §c无传送请求等待处理")49def tp_request(server, info, args):50 if args[1] in player_list:51 if args[1] == info.player:52 server.tell(info.player, "§7[§3TPA§f/§cWARN§7] §c请不要原地TP")53 else:54 if args[1] in request_list.values():55 server.tell(info.player, "§7[§3TPA§f/§cWARN§7] §c请稍等, 玩家正在处理另一传送请求")56 else:57 if info.player in request_list.keys():58 server.tell(info.player, "§7[§3TPA§f/§cWARN§7] §c上一传送请求尚未处理完成")59 else:60 server.tell(info.player, RTextList(61 RText(' --------------------------------------\n'),62 RText('§b传送请求已发送至玩家 §e{}\n'.format(args[1])),63 RText('[取消传送请求]\n', color=RColor.gold).h('§b点击取消传送请求').c(RAction.run_command, '!!tpcancel'),64 RText('--------------------------------------')65 ))66 request_list[info.player] = args[1]67 server.tell(args[1], RTextList(68 RText(' --------------------------------------\n'),69 RText('§b 玩家 §e{} §b想传送到你身边\n\n'.format(info.player)),70 RText(' [同意] ', color=RColor.green).h('§b点击同意传送请求').c(RAction.run_command, '!!tpaccept'),71 RText('[拒绝]\n', color=RColor.red).h('§b点击拒绝传送请求').c(RAction.run_command, '!!tpdeny'),72 RText('--------------------------------------')73 ))74 else:75 server.tell(info.player, "§7[§3TPA§f/§cWARN§7] §c玩家不在线")76def on_player_joined(server, player, Info):77 player_list.append(player)78def on_player_left(server, player):79 if player in player_list:80 player_list.remove(player)81 if player in request_list.keys():82 tell_player = request_list[player]83 server.tell(tell_player, "§7[§3TPA§f/§aINFO§7] §b玩家 §e{} §b已退出, 传送请求自动取消".format(player))84 del request_list[player]85 if player in request_list.values():86 tell_player = list (request_list.keys()) [list (request_list.values()).index (player)]87 server.tell(tell_player, "§7[§3TPA§f/§aINFO§7] §b玩家 §e{} §b已退出, 传送请求自动取消".format(player))88 del request_list[tell_player]89def on_load(server, old_module):90 server.register_help_message('!!tpa', '传送插件帮助信息')91 if old_module is not None:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful