Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

宣傳指令, 循環宣傳, loop example #3

Open
AsherJingkongChen opened this issue Oct 13, 2021 · 1 comment
Open

宣傳指令, 循環宣傳, loop example #3

AsherJingkongChen opened this issue Oct 13, 2021 · 1 comment

Comments

@AsherJingkongChen
Copy link

                        case "anncloop": //自動循環
                            clearInterval(anncinterval);
                            var i=0;
                            bot.chat(`${settings.trade_content[i]}`)
                            anncinterval = setInterval(()=>{
                                i+=1;
                                if(i==settings.trade_content.length){
                                    i=0;
                                }
                                if(settings.trade_content[i].startsWith("/")){
                                    bot.chat(`'${settings.trade_content[i]}`)
                                } else {
                                    bot.chat(`${settings.trade_content[i]}`)
                                }
                            },cooldown(settings.trade_content[i].slice(0,1)));
                            break;
@AsherJingkongChen
Copy link
Author

AsherJingkongChen commented Oct 13, 2021

放在最外面(全域變數):
縮排失敗
var anncinterval
//
const cooldown = (prefix) => { //頻道冷卻時間
cd = -1
switch(prefix){
case "!":
cd = 87*1000;
break;
case "@":
cd = (20+5)*1000;
break;
case "$":
cd = (600+5)*1000;
break;
default: //local channel
cd = 1728;
break;
}
return cd;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant