🍱 更新角色昵称

This commit is contained in:
xtaodada 2022-09-09 23:50:10 +08:00
parent 321e4e7aac
commit 310f82e180
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
4 changed files with 108 additions and 198 deletions

View File

@ -2,194 +2,88 @@ from typing import Optional
# noinspection SpellCheckingInspection # noinspection SpellCheckingInspection
roles = { roles = {
10000002: [
"神里绫华", "Kamisato Ayaka", "Ayaka", "ayaka", "神里", "绫华", "神里凌华", "凌华", "白鹭公主", "神里大小姐"
],
10000003: [
"", "Jean", "jean", "团长", "代理团长", "琴团长", "蒲公英骑士"
],
10000005: [
"", "男主", "男主角", "龙哥", "空哥"
],
10000006: [
"丽莎", "Lisa", "lisa", "图书管理员", "图书馆管理员", "蔷薇魔女"
],
10000007: [
"", "女主", "女主角", "", "", "黄毛阿姨", "荧妹"
],
10000014: [
"芭芭拉", "Barbara", "barbara", "巴巴拉", "拉粑粑", "拉巴巴", "内鬼", "加湿器", "闪耀偶像", "偶像"
],
10000015: [
"凯亚", "Kaeya", "kaeya", "盖亚", "凯子哥", "凯鸭", "矿工", "矿工头子", "骑兵队长", "凯子", "凝冰渡海真君"
],
10000016: [
"迪卢克", "diluc", "Diluc", "卢姥爷", "姥爷", "卢老爷", "卢锅巴", "正义人", "正e人", "正E人", "卢本伟",
"暗夜英雄", "卢卢伯爵", "落魄了", "落魄了家人们"
],
10000020: [
"雷泽", "razor", "Razor", "狼少年", "狼崽子", "狼崽", "卢皮卡", "小狼", "小狼狗"
],
10000021: [
"安柏", "Amber", "amber", "安伯", "兔兔伯爵", "飞行冠军", "侦查骑士", "点火姬", "点火机", "打火机", "打火姬"
],
10000022: [
"温迪", "Venti", "venti", "温蒂", "风神", "卖唱的", "巴巴托斯", "巴巴脱丝", "芭芭托斯", "芭芭脱丝", "干点正事",
"不干正事", "吟游诗人", "诶嘿", "唉嘿", "摸鱼"
],
10000023: [
"香菱", "Xiangling", "xiangling", "香玲", "锅巴", "厨师", "万民堂厨师", "香师傅"
],
10000024: [
"北斗", "Beidou", "beidou", "大姐头", "大姐", "无冕的龙王", "龙王"
],
10000025: [
"行秋", "Xingqiu", "xingqiu", "秋秋人", "秋妹妹", "书呆子", "水神", "飞云商会二少爷"
],
10000026: [
"", "Xiao", "xiao", "杏仁豆腐", "打桩机", "插秧", "三眼五显仙人", "三眼五显真人", "降魔大圣", "护法夜叉",
"快乐风男", "无聊", "靖妖傩舞", "矮子仙人", "三点五尺仙人", "跳跳虎"
],
10000027: [
"凝光", "Ningguang", "ningguang", "富婆", "天权星"
],
10000029: [
"可莉", "Klee", "klee", "嘟嘟可", "火花骑士", "蹦蹦炸弹", "炸鱼", "放火烧山", "放火烧山真君", "蒙德最强战力",
"逃跑的太阳", "啦啦啦", "哒哒哒", "炸弹人", "禁闭室"
],
10000030: [
"钟离", "Zhongli", "zhongli", "摩拉克斯", "岩王爷", "岩神", "钟师傅", "天动万象", "岩王帝君", "未来可期",
"帝君", "拒收病婿"
],
10000031: [
"菲谢尔", "Fischl", "fischl", "皇女", "小艾米", "小艾咪", "奥兹", "断罪皇女", "中二病", "中二少女", "中二皇女",
"奥兹发射器"
],
10000032: [
"班尼特", "Bennett", "bennett", "点赞哥", "点赞", "倒霉少年", "倒霉蛋", "霹雳闪雷真君", "班神", "班爷", "倒霉",
"火神", "六星真神"
],
10000033: [
"达达利亚", "Tartaglia", "tartaglia", "Childe", "childe", "Ajax", "ajax", "达达鸭", "达达利鸭", "公子",
"玩具销售员", "玩具推销员", "钱包", "鸭鸭", "愚人众末席"
],
10000034: [
"诺艾尔", "Noelle", "noelle", "女仆", "高达", "岩王帝姬"
],
10000035: [
"七七", "Qiqi", "qiqi", "僵尸", "肚饿真君", "度厄真君", "77"
],
10000036: [
"重云", "Chongyun", "chongyun", "纯阳之体", "冰棍"
],
10000037: [
"甘雨", "Ganyu", "ganyu", "椰羊", "椰奶", "王小美"
],
10000038: [
"阿贝多", "Albedo", "albedo", "可莉哥哥", "升降机", "升降台", "电梯", "白垩之子", "贝爷", "白垩", "阿贝少",
"花呗多", "阿贝夕", "abd", "阿师傅"
],
10000039: [
"迪奥娜", "Diona", "diona", "迪欧娜", "dio", "dio娜", "冰猫", "猫猫", "猫娘", "喵喵", "调酒师"
],
10000041: [
"莫娜", "Mona", "mona", "穷鬼", "穷光蛋", "", "莫纳", "占星术士", "占星师", "讨龙真君", "半部讨龙真君",
"阿斯托洛吉斯·莫娜·梅姬斯图斯", "梅姬斯图斯", "梅姬斯图斯卿"
],
10000042: [
"刻晴", "Keqing", "keqing", "刻情", "氪晴", "刻师傅", "刻师父", "牛杂", "牛杂师傅", "斩尽牛杂", "免疫",
"免疫免疫", "屁斜剑法", "玉衡星", "阿晴", "啊晴"
],
10000043: [
"砂糖", "Sucrose", "sucrose", "雷莹术士", "雷萤术士", "雷荧术士"
],
10000044: [
"辛焱", "Xinyan", "xinyan", "辛炎", "黑妹", "摇滚"
],
10000045: [
"罗莎莉亚", "Rosaria", "rosaria", "罗莎莉娅", "白色史莱姆", "白史莱姆", "修女", "罗莎利亚", "罗莎利娅",
"罗沙莉亚", "罗沙莉娅", "罗沙利亚", "罗沙利娅", "萝莎莉亚", "萝莎莉娅", "萝莎利亚", "萝莎利娅", "萝沙莉亚",
"萝沙莉娅", "萝沙利亚", "萝沙利娅"
],
10000046: [
"胡桃", "Hu Tao", "hu tao", "HuTao", "hutao", "Hutao", "胡淘", "往生堂堂主", "火化", "抬棺的", "蝴蝶", "核桃",
"堂主", "胡堂主", "雪霁梅香"
],
10000047: [
"枫原万叶", "Kaedehara Kazuha", "Kazuha", "kazuha", "万叶", "叶天帝", "天帝", "叶师傅"
],
10000048: [
"烟绯", "Yanfei", "yanfei", "烟老师", "律师", "罗翔"
],
10000049: [
"宵宫", "Yoimiya", "yoimiya", "霄宫", "烟花", "肖宫", "肖工", "绷带女孩"
],
10000050: [
"托马", "Thoma", "thoma", "家政官", "太郎丸", "地头蛇", "男仆", "拖马"
],
10000051: [
"优菈", "Eula", "eula", "优拉", "尤拉", "尤菈", "浪花骑士", "记仇", "劳伦斯"
],
10000052: [
"雷电将军", "Raiden Shogun", "Raiden", "raiden", "雷神", "将军", "雷军", "巴尔", "阿影", "", "巴尔泽布",
"煮饭婆", "奶香一刀", "无想一刀", "宅女"
],
10000053: [
"早柚", "Sayu", "sayu", "小狸猫", "狸猫", "忍者"
],
10000054: [
"珊瑚宫心海", "Sangonomiya Kokomi", "Kokomi", "kokomi", "心海", "军师", "珊瑚宫", "书记", "观赏鱼", "水母",
"", "美人鱼"
],
10000055: [
"五郎", "Gorou", "gorou", "柴犬", "土狗", "希娜", "希娜小姐"
],
10000056: [
"九条裟罗", "Kujou Sara", "Sara", "sara", "九条", "九条沙罗", "裟罗", "沙罗", "天狗"
],
10000057: [
"荒泷一斗", "Arataki Itto", "Itto", "itto", "荒龙一斗", "荒泷天下第一斗", "一斗", "一抖", "荒泷", "1斗", "牛牛",
"斗子哥", "牛子哥", "牛子", "孩子王", "斗虫", "巧乐兹", "放牛的"
],
10000058: [
"八重神子", "Yae Miko", "Miko", "miko", "八重", "神子", "狐狸", "想得美哦", "巫女", "屑狐狸", "骚狐狸",
"八重宫司", "婶子", "小八"
],
10000059: [
"鹿野院平藏", "shikanoin heizou", "Heizou", "heizou", "heizo", "鹿野苑", "鹿野院", "平藏", "鹿野苑平藏", "鹿野",
"小鹿"
],
10000060: [
"夜兰", "Yelan", "yelan", "夜阑", "叶澜", "腋兰", "夜天后"
],
10000062: [
"埃洛伊", "Aloy", "aloy"
],
10000063: [
"申鹤", "Shenhe", "shenhe", "神鹤", "小姨", "小姨子", "审鹤"
],
10000064: [
"云堇", "Yun Jin", "yunjin", "yun jin", "云瑾", "云先生", "云锦", "神女劈观"
],
10000065: [
"久岐忍", "Kuki Shinobu", "Kuki", "kuki", "Shinobu", "shinobu", "97忍", "小忍", "久歧忍", "97", "茄忍", "阿忍",
"忍姐"
],
10000066: [
"神里绫人", "Kamisato Ayato", "Ayato", "ayato", "绫人", "神里凌人", "凌人", "0人", "神人", "零人", "大舅哥"
],
10000067: [
"柯莱", "Collei", "collei", "克莱", "科莱", "须弥飞行冠军"
],
10000068: [
"多莉", "Dori", "dori", "多利", "多丽"
],
10000069: [
"提纳里", "Tighnari", "tighnari", "巡林官", "小提", "缇娜里", "提哪里", "提那里"
],
20000000: [ 20000000: [
"主角", "旅行者", "卑鄙的外乡人", "荣誉骑士", "", "风主", "岩主", "雷主", "草主", "履刑者", "抽卡不歪真君" '主角', '旅行者', '卑鄙的外乡人', '荣誉骑士', '', '风主', '岩主', '雷主', '草主', '履刑者', '抽卡不歪真君'
] ],
10000002: ['神里绫华', 'Kamisato Ayaka', 'Ayaka', 'ayaka', '神里', '绫华', '神里凌华', '凌华', '白鹭公主',
'神里大小 姐'],
10000003: ['', 'Jean', 'jean', '团长', '代理团长', '琴团长', '蒲公英骑士'],
10000005: ['', '男主', '男主角', '龙哥', '空哥'],
10000006: ['丽莎', 'Lisa', 'lisa', '图书管理员', '图书馆管理员', '蔷薇魔女'],
10000007: ['', '女主', '女主角', '', '', '黄毛阿姨', '荧妹'],
10000014: ['芭芭拉', 'Barbara', 'barbara', '巴巴拉', '拉粑粑', '拉巴巴', '内鬼', '加湿器', '闪耀偶像', '偶像'],
10000015: ['凯亚', 'Kaeya', 'kaeya', '盖亚', '凯子哥', '凯鸭', '矿工', '矿工头子', '骑兵队长', '凯子',
'凝冰渡海真君'],
10000016: ['迪卢克', 'diluc', 'Diluc', '卢姥爷', '姥爷', '卢老爷', '卢锅巴', '正义人', '正e人', '正E人', '卢本伟',
'暗夜英雄', '卢卢伯爵', '落魄了', '落魄了家人们'],
10000020: ['雷泽', 'razor', 'Razor', '狼少年', '狼崽子', '狼崽', '卢皮卡', '小狼', '小狼狗'],
10000021: ['安柏', 'Amber', 'amber', '安伯', '兔兔伯爵', '飞行冠军', '侦查骑士', '点火姬', '点火机', '打火机',
'打火姬'],
10000022: ['温迪', 'Venti', 'venti', '温蒂', '风神', '卖唱的', '巴巴托斯', '巴巴脱丝', '芭芭托斯', '芭芭脱丝',
'干点正事', '不干正事', '吟游诗人', '诶嘿', '唉嘿', '摸鱼'],
10000023: ['香菱', 'Xiangling', 'xiangling', '香玲', '锅巴', '厨师', '万民堂厨师', '香师傅'],
10000024: ['北斗', 'Beidou', 'beidou', '大姐头', '大姐', '无冕的龙王', '龙王'],
10000025: ['行秋', 'Xingqiu', 'xingqiu', '秋秋人', '秋妹妹', '书呆子', '水神', '飞云商会二少爷'],
10000026: ['', 'Xiao', 'xiao', '杏仁豆腐', '打桩机', '插秧', '三眼五显仙人', '三眼五显真人', '降魔大圣',
'护法夜叉', '快乐风男', '无聊', '靖妖傩舞', '矮子仙人', '三点五尺仙人', '跳跳虎'],
10000027: ['凝光', 'Ningguang', 'ningguang', '富婆', '天权星'],
10000029: ['可莉', 'Klee', 'klee', '嘟嘟可', '火花骑士', '蹦蹦炸弹', '炸鱼', '放火烧山', '放火烧山真君',
'蒙德最强战力', '逃跑的太阳', '啦啦啦', '哒哒哒', '炸弹人', '禁闭室'],
10000030: ['钟离', 'Zhongli', 'zhongli', '摩拉克斯', '岩王爷', '岩神', '钟师傅', '天动万象', '岩王帝君', '未来可期',
'帝君', '拒收病婿'],
10000031: ['菲谢尔', 'Fischl', 'fischl', '皇女', '小艾米', '小艾咪', '奥兹', '断罪皇女', '中二病', '中二少女',
'中二皇女', '奥兹发射器'],
10000032: ['班尼特', 'Bennett', 'bennett', '点赞哥', '点赞', '倒霉少年', '倒霉蛋', '霹雳闪雷真君', '班神', '班爷',
'倒霉', '火神', '六星真神'],
10000033: ['达达利亚', 'Tartaglia', 'tartaglia', 'Childe', 'childe', 'Ajax', 'ajax', '达达鸭', '达达利鸭', '公子',
'玩具销售员', '玩具推销员', '钱包', '鸭鸭', '愚人众末席'],
10000034: ['诺艾尔', 'Noelle', 'noelle', '女仆', '高达', '岩王帝姬'],
10000035: ['七七', 'Qiqi', 'qiqi', '僵尸', '肚饿真君', '度厄真君', '77'],
10000036: ['重云', 'Chongyun', 'chongyun', '纯阳之体', '冰棍'],
10000037: ['甘雨', 'Ganyu', 'ganyu', '椰羊', '椰奶', '王小美'],
10000038: ['阿贝多', 'Albedo', 'albedo', '可莉哥哥', '升降机', '升降台', '电梯', '白垩之子', '贝爷', '白垩',
'阿贝少', '花呗多', '阿贝夕', 'abd', '阿师傅'],
10000039: ['迪奥娜', 'Diona', 'diona', '迪欧娜', 'dio', 'dio娜', '冰猫', '猫猫', '猫娘', '喵喵', '调酒师'],
10000041: ['莫娜', 'Mona', 'mona', '穷鬼', '穷光蛋', '', '莫纳', '占星术士', '占星师', '讨龙真君', '半部讨龙真君',
'阿斯托洛吉斯·莫娜·梅姬斯图斯', '梅姬斯图斯', '梅姬斯图斯卿'],
10000042: ['刻晴', 'Keqing', 'keqing', '刻情', '氪晴', '刻师傅', '刻师父', '牛杂', '牛杂师傅', '斩尽牛杂', '免疫',
'免疫免疫', '屁斜剑法', '玉衡星', '阿晴', ' 啊晴'],
10000043: ['砂糖', 'Sucrose', 'sucrose', '雷莹术士', '雷萤术士', '雷荧术士'],
10000044: ['辛焱', 'Xinyan', 'xinyan', '辛炎', '黑妹', '摇滚'],
10000045: ['罗莎莉亚', 'Rosaria', 'rosaria', '罗莎莉娅', '白色史莱姆', '白史莱姆', '修女', '罗莎利亚', '罗莎利娅',
'罗沙莉亚', '罗沙莉娅', '罗沙利亚', '罗沙利娅', '萝莎莉亚', '萝莎莉娅', '萝莎利亚', '萝莎利娅',
'萝沙莉亚', '萝沙莉娅', '萝沙利亚', '萝沙利娅'],
10000046: ['胡桃', 'Hu Tao', 'hu tao', 'HuTao', 'hutao', 'Hutao', '胡 淘', '往生堂堂主', '火化', '抬棺的', '蝴蝶',
'核桃', '堂主', '胡堂主', '雪霁梅香'],
10000047: ['枫原万叶', 'Kaedehara Kazuha', 'Kazuha', 'kazuha', '万叶', '叶天帝', '天帝', '叶师傅'],
10000048: ['烟绯', 'Yanfei', 'yanfei', '烟老师', '律师', '罗翔'],
10000049: ['宵宫', 'Yoimiya', 'yoimiya', '霄宫', '烟花', '肖宫', '肖工', '绷带女孩'],
10000050: ['托马', 'Thoma', 'thoma', '家政官', '太郎丸', '地头蛇', '男仆', '拖马'],
10000051: ['优菈', 'Eula', 'eula', '优拉', '尤拉', '尤菈', '浪花骑士', '记仇', '劳伦斯'],
10000052: ['雷电将军', 'Raiden Shogun', 'Raiden', 'raiden', '雷神', '将军', '雷军', '巴尔', '阿影', '',
'巴尔泽布', '煮饭婆', '奶香一刀', '无想一刀', '宅女'],
10000053: ['早柚', 'Sayu', 'sayu', '小狸猫', '狸 猫', '忍者'],
10000054: ['珊瑚宫心海', 'Sangonomiya Kokomi', 'Kokomi', 'kokomi', '心海', '军师', '珊瑚宫', '书记', '观赏鱼',
'水母', '', '美人鱼'],
10000055: ['五郎', 'Gorou', 'gorou', '柴犬', '土狗', '希娜', '希娜小姐'],
10000056: ['九条裟罗', 'Kujou Sara', 'Sara', 'sara', '九条', '九条沙罗', '裟罗', '沙罗', '天狗'],
10000057: ['荒泷一斗', 'Arataki Itto', 'Itto', 'itto', '荒龙一斗', '荒泷天下第一斗', '一斗', '一抖', '荒泷', '1斗',
'牛牛', '斗子哥', '牛子哥', '牛子', '孩子 王', '斗虫', '巧乐兹', '放牛的'],
10000058: ['八重神子', 'Yae Miko', 'Miko', 'miko', '八重', '神子', '狐狸', '想得美哦', '巫女', '屑狐狸', '骚狐狸',
'八重宫司', '婶子', '小八'],
10000059: ['鹿野院平藏', 'shikanoin heizou', 'Heizou', 'heizou', 'heizo', '鹿野苑', '鹿野院', '平藏', '鹿野苑平藏',
'鹿野', '小鹿'],
10000060: ['夜兰', 'Yelan', 'yelan', '夜阑', '叶 澜', '腋兰', '夜天后'],
10000062: ['埃洛伊', 'Aloy', 'aloy'],
10000063: ['申鹤', 'Shenhe', 'shenhe', '神鹤', '小姨', '小姨子', '审鹤'],
10000064: ['云堇', 'Yun Jin', 'yunjin', 'yun jin', '云瑾', '云先生', '云锦', '神女劈观'],
10000065: ['久岐忍', 'Kuki Shinobu', 'Kuki', 'kuki', 'Shinobu', 'shinobu', '97忍', '小忍', '久歧忍', '97', '茄忍',
'阿忍', '忍姐'],
10000066: ['神里绫人', 'Kamisato Ayato', 'Ayato', 'ayato', '绫人', '神里凌人', '凌人', '0人', '神人', '零人',
'大舅哥'],
10000067: ['柯莱', 'Collei', 'collei', '克莱', '科莱', '须弥飞行冠军', '草安伯'],
10000068: ['多莉', 'Dori', 'dori', '多利', '多丽'],
10000069: ['提纳里', 'Tighnari', 'tighnari', '巡林官', '小提', '缇娜里', '提哪里', '提那里']
} }
weapons = { weapons = {
"磐岩结绿": ["绿箭", "绿剑"], "磐岩结绿": ["绿箭", "绿剑"],

View File

@ -5,6 +5,7 @@ from telegram.ext import filters, ConversationHandler, CommandHandler, MessageHa
from core.baseplugin import BasePlugin from core.baseplugin import BasePlugin
from core.game.services import GameMaterialService from core.game.services import GameMaterialService
from core.plugin import Plugin, handler from core.plugin import Plugin, handler
from metadata.shortname import roleToName
from utils.bot import get_all_args from utils.bot import get_all_args
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts
@ -39,6 +40,7 @@ class Material(Plugin, BasePlugin):
self._add_delete_message_job(context, message.chat_id, message.message_id) self._add_delete_message_job(context, message.chat_id, message.message_id)
self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id) self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id)
return return
character_name = roleToName(character_name)
url = await self.game_material_service.get_material(character_name) url = await self.game_material_service.get_material(character_name)
if not url: if not url:
reply_message = await message.reply_text(f"没有找到 {character_name} 的培养素材", reply_message = await message.reply_text(f"没有找到 {character_name} 的培养素材",

View File

@ -19,6 +19,7 @@ from core.plugin import Plugin, handler
from core.template import TemplateService from core.template import TemplateService
from core.user import UserService from core.user import UserService
from core.user.error import UserNotFoundError from core.user.error import UserNotFoundError
from metadata.shortname import roleToName
from modules.playercards.helpers import ArtifactStatsTheory from modules.playercards.helpers import ArtifactStatsTheory
from utils.bot import get_all_args from utils.bot import get_all_args
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
@ -64,12 +65,13 @@ class PlayerCards(Plugin, BasePlugin):
if len(args) == 1: if len(args) == 1:
character_name = args[0] character_name = args[0]
else: else:
reply_message = await message.reply_text("请回复角色名参数") character_name = "all"
if filters.ChatType.GROUPS.filter(reply_message): # reply_message = await message.reply_text("请回复角色名参数")
self._add_delete_message_job(context, message.chat_id, message.message_id) # if filters.ChatType.GROUPS.filter(reply_message):
self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id) # self._add_delete_message_job(context, message.chat_id, message.message_id)
return # self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id)
logger.info(f"用户 {user.full_name}[{user.id}] 角色卡片查询命令请求 || character_name[{character_name}] uid[{uid}]") # return
character_name = roleToName(character_name)
try: try:
data = await self.client.fetch_user(uid) data = await self.client.fetch_user(uid)
except EnkaServerError: except EnkaServerError:
@ -90,12 +92,22 @@ class PlayerCards(Plugin, BasePlugin):
if data.characters is None: if data.characters is None:
await message.reply_text("请先将角色加入到角色展柜并允许查看角色详情") await message.reply_text("请先将角色加入到角色展柜并允许查看角色详情")
return return
for characters in data.characters: characters_map = {character.name: character for character in data.characters}
if characters.name == character_name: reply_message = None
break if character_name == "all":
else: reply_message = await message.reply_text(
await message.reply_text(f"角色展柜中未找到 {character_name}") "请输入角色名来查询,目前你的角色展柜有以下角色:" +
"".join(characters_map.keys()))
elif character_name not in characters_map:
reply_message = await message.reply_text(f"角色展柜中未找到 {character_name}")
if reply_message:
if filters.ChatType.GROUPS.filter(reply_message):
self._add_delete_message_job(context, message.chat_id, message.message_id)
self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id)
return return
characters = characters_map[character_name]
logger.info(
f"用户 {user.full_name}[{user.id}] 角色卡片查询命令请求 || character_name[{character_name}] uid[{uid}]")
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
pnd_data = await RenderTemplate(uid, characters, self.template_service).render() pnd_data = await RenderTemplate(uid, characters, self.template_service).render()
await message.reply_photo(pnd_data, filename=f"player_card_{uid}_{character_name}.png") await message.reply_photo(pnd_data, filename=f"player_card_{uid}_{character_name}.png")

View File

@ -8,6 +8,7 @@ from telegram.ext import MessageHandler, filters
from core.baseplugin import BasePlugin from core.baseplugin import BasePlugin
from core.game.services import GameStrategyService from core.game.services import GameStrategyService
from core.plugin import Plugin, handler from core.plugin import Plugin, handler
from metadata.shortname import roleToName
from utils.bot import get_all_args from utils.bot import get_all_args
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts
@ -40,6 +41,7 @@ class StrategyPlugin(Plugin, BasePlugin):
self._add_delete_message_job(context, message.chat_id, message.message_id) self._add_delete_message_job(context, message.chat_id, message.message_id)
self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id) self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id)
return return
character_name = roleToName(character_name)
url = await self.game_strategy_service.get_strategy(character_name) url = await self.game_strategy_service.get_strategy(character_name)
if url == "": if url == "":
reply_message = await message.reply_text(f"没有找到 {character_name} 的攻略", reply_message = await message.reply_text(f"没有找到 {character_name} 的攻略",