久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

基本的一條消息骰子滾輪?

Basic one-message dice roller?(基本的一條消息骰子滾輪?)
本文介紹了基本的一條消息骰子滾輪?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

這是我在這里,我想添加一個(gè)簡(jiǎn)單的骰子滾動(dòng)功能,它不會(huì)占用多條消息,所以我不會(huì)向我所在的服務(wù)器發(fā)送垃圾郵件.

This is the same discord bot I've asked about in the last question I posted here, and I want to add a simple dice rolling function that doesn't take up multiple messages so I don't spam the server I'm in.

到目前為止,我的擲骰子本身的準(zhǔn)系統(tǒng)代碼在這里工作:

So far, I have the barebones code for the dice roller itself working here:

if (message.content.toLowerCase().includes("rei!d100")) {
    var response = [Math.floor(Math.random() * ((100 - 1) + 1) + 1)];

   message.channel.send(response).then().catch(console.error);
}

現(xiàn)在它只是吐出像這樣的數(shù)字

And as of right now it just spits out the number like

96

這...對(duì)于我賦予了如此多個(gè)性的這個(gè)機(jī)器人來(lái)說(shuō)非常不合時(shí)宜.我想要的是在它吐出的數(shù)字之前和之后有文字,就像這樣.

which is... very out of character for this bot I've given so much personality. What I want is for there to be text before and after the number it spits out, like so.

你得到了... 96!

如果我將這樣的內(nèi)容放入代碼中,它會(huì)產(chǎn)生部分相同的效果,它只會(huì)發(fā)送非常尷尬的兩條不同的消息,這不是我想要的.

If I put something like this into the code it has partially the same effect, it just sends really awkwardly and in two different messages, which isn't what I want.

if (message.content.toLowerCase().includes("rei!d100")) {
    message.channel.send("You got...");
    var response = [Math.floor(Math.random() * ((100 - 1) + 1) + 1)];

   message.channel.send(response).then().catch(console.error);
}

感謝您提供故障排除幫助!謝謝!

Any help troubleshooting is appreciated! Thanks!

推薦答案

我認(rèn)為您本質(zhì)上是在問(wèn)如何將字符串連接在一起.這是通過(guò)加號(hào)運(yùn)算符完成的.如果任何操作數(shù)是字符串,它將所有變量都視為字符串:

I think you are essentially asking how to concatenate strings together. That is done with the plus sign operator. If any of the operands are strings, it treats all the variables as strings:

if (message.content.toLowerCase().includes("rei!d100")) {
    var response = [Math.floor(Math.random() * ((100 - 1) + 1) + 1)];

   message.channel.send("You got... " + response + "!").then().catch(console.error);  // "You got... 96!"
}

或者,您可以像這樣使用模板參數(shù)(那些是反引號(hào),而不是引號(hào)):

Alternatively, you can use template params like so (those are backticks, not quotes):

message.channel.send(`You got... ${response}!`);

這篇關(guān)于基本的一條消息骰子滾輪?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機(jī)器人提及發(fā)出該機(jī)器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來(lái)加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來(lái)自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時(shí)的歡迎消息)
主站蜘蛛池模板: 成人在线免费网站 | 久久久久久国产精品久久 | 国产美女自拍视频 | 免费一区二区三区 | 在线视频一区二区三区 | 午夜影院普通用户体验区 | 国产福利在线播放麻豆 | 久久99蜜桃综合影院免费观看 | 伊人色综合久久久天天蜜桃 | 一区二区三区视频 | 国产伦精品一区二区三区精品视频 | 日本三级电影在线观看视频 | 狠狠操狠狠搞 | 国产999精品久久久久久 | 久久综合一区二区 | 黑人巨大精品欧美一区二区一视频 | 久久中文字幕一区 | 久久99精品久久久久久 | 狠狠ri| 亚洲欧美日韩精品久久亚洲区 | 一区二区免费在线观看 | 国产一级特黄aaa大片评分 | 国产精品视频综合 | 男女网站免费观看 | 久久久久久久久久性 | 秋霞a级毛片在线看 | 亚洲免费在线 | 国产成人精品久久二区二区91 | 精品在线观看一区二区 | 男女网站视频 | 国产色婷婷久久99精品91 | 99热播精品| 国产目拍亚洲精品99久久精品 | 成人免费看片网 | 中文字幕视频在线观看 | 欧美高清性xxxxhd | 亚洲国产成人精品女人久久久 | 视频一区二区国产 | 久久国产精品视频 | www日韩欧美 | 亚洲一区二区在线视频 |