猫史档案馆


啾咪啾咪!

啾咪啾咪!

Lv.1

dianmao12171682

获赞:115收藏:54浏览:1154作品收藏:25
回复帖子评论
上一页1 页 / 共 1下一页

【教程】如何让管喵在聊天区执行代码时可以用await 中回复

const adminList=["这里是管喵列表,填名字"];
world.onChat(async({entity:{player:{name:name}},message:message})=>{
    if(message.startsWith("$")&&adminList.includes(name)){
        let c=message.slice(1);
        world.say(`~> ${c}`);
        try{
            c=await eval(`!async function(){${c}}`)
        }
        catch(a){
            c=a
        }
        finally{
            world.say(`<~ ${c}`)
        }
    }
});

2022-08-03T10:59:14 点赞:0