Skip to content

Commit

Permalink
Merge pull request #95 from emuio/feat/add-plugin-food_selector
Browse files Browse the repository at this point in the history
feat: 增加“选外卖”插件,中午吃啥?为选择困难症选个外卖品种.
  • Loading branch information
HenryXiaoYang authored Dec 8, 2024
2 parents aafe4e2 + 7b3f9e5 commit 8be4cd9
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
39 changes: 39 additions & 0 deletions plugins/command/food_selector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from loguru import logger
from wcferry import client
from utils.plugin_interface import PluginInterface
from wcferry_helper import XYBotWxMsg
import random
import yaml

class food_selector(PluginInterface):
def __init__(self):
config_path = "plugins/command/food_selector.yml"
with open(config_path, "r", encoding="utf-8") as f:
config = yaml.safe_load(f.read())

self.food_options = config["food_options"]
self.command_format_menu = config["command_format_menu"]

async def run(self, bot: client.Wcf, recv: XYBotWxMsg):
selected_food = random.choice(self.food_options)
message = (
f"-----XYBot-----\n"
f"🍽️随机选择的外卖品种是:{selected_food}\n\n"
f"💝温馨提示:\n"
f"🌟 记得吃饭要细嚼慢咽哦\n"
f"🌟 工作再忙也要按时吃饭\n"
f"🌟 注意营养均衡,保重身体\n"
f"祝您用餐愉快!😊"
)

await self.send_friend_or_group(bot, recv, message)
logger.info(f"[食物选择] wxid: {recv.sender} | 选择结果: {selected_food}")

async def send_friend_or_group(self, bot: client.Wcf, recv: XYBotWxMsg, out_message="null"):
if recv.from_group():
out_message = f"@{recv.sender}\n{out_message}"
logger.info(f'[发送@信息]{out_message}| [发送到] {recv.roomid}')
bot.send_text(out_message, recv.roomid, recv.sender)
else:
logger.info(f'[发送信息]{out_message}| [发送到] {recv.roomid}')
bot.send_text(out_message, recv.roomid)
53 changes: 53 additions & 0 deletions plugins/command/food_selector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
keywords: ["选外卖"]
plugin_name: "food_selector"

command_format_menu: "🍽️选择外卖品种:\n选外卖\n示例:选外卖"

food_options:
- "宫保鸡丁饭"
- "麻婆豆腐饭"
- "红烧肉饭"
- "糖醋里脊饭"
- "鱼香肉丝饭"
- "回锅肉饭"
- "黄焖鸡米饭"
- "卤肉饭"
- "叉烧饭"
- "烤肉拌饭"
- "干炒牛河"
- "扬州炒饭"
- "披萨"
- "寿司套餐"
- "汉堡套餐"
- "意大利肉酱面"
- "奶油蘑菇意面"
- "泰式打抛猪肉饭"
- "泰式咖喱鸡饭"
- "印度咖喱鸡饭"
- "印度烤肉饭"
- "韩式石锅拌饭"
- "韩式烤肉饭"
- "日式天妇罗盖饭"
- "日式炸猪排饭"
- "越南牛肉河粉"
- "墨西哥卷饼套餐"
- "烤肉饭"
- "麻辣香锅"
- "水煮鱼饭"
- "酸菜鱼饭"
- "铁板牛肉饭"
- "三杯鸡饭"
- "辣子鸡饭"
- "葱爆羊肉饭"
- "蒜苔炒肉饭"
- "青椒肉丝饭"
- "土豆烧牛肉饭"
- "酱爆茄子饭"
- "尖椒炒牛肉饭"
- "蔬菜色拉"
- "米线"
- "味千拉面"
- "寿喜锅"
- "麻辣烫"
- "拌将"
- "毛血旺"

0 comments on commit 8be4cd9

Please sign in to comment.