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

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

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

問題描述

這是我在這里,我想添加一個簡單的骰子滾動功能,它不會占用多條消息,所以我不會向我所在的服務器發送垃圾郵件.

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.

到目前為止,我的擲骰子本身的準系統代碼在這里工作:

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);
}

現在它只是吐出像這樣的數字

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

96

這...對于我賦予了如此多個性的這個機器人來說非常不合時宜.我想要的是在它吐出的數字之前和之后有文字,就像這樣.

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!

如果我將這樣的內容放入代碼中,它會產生部分相同的效果,它只會發送非常尷尬的兩條不同的消息,這不是我想要的.

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!

推薦答案

我認為您本質上是在問如何將字符串連接在一起.這是通過加號運算符完成的.如果任何操作數是字符串,它將所有變量都視為字符串:

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!"
}

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

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

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

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

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

相關文檔推薦

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(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 天天躁日日躁狠狠很躁 | 久草欧美 | 人人九九| 久久精品日产第一区二区三区 | 天天干天天玩天天操 | 99久久精品国产麻豆演员表 | 国产一区二区在线播放 | 国产视频中文字幕 | 欧美日韩精品中文字幕 | 在线中文字幕视频 | 91成人免费观看 | 成人免费一区二区三区牛牛 | 国产欧美精品一区 | 欧美亚洲另类在线 | 久久久久一区二区三区 | 激情欧美一区二区三区中文字幕 | 羞羞色视频 | 亚洲欧美综合精品久久成人 | 亚洲精品乱码久久久久久蜜桃91 | a级黄色毛片免费播放视频 国产精品视频在线观看 | 欧美激情五月 | 久久久精品综合 | 精品在线一区二区三区 | 国产成人网| 精品久久久久久久久久久院品网 | 亚洲视频免费观看 | 国产小视频在线观看 | 欧美精品一区二区免费 | 国产伦精品一区二区三区高清 | 国产91丝袜在线18 | 高清成人av | av手机免费在线观看 | 色狠狠桃花综合 | 国产精品久久久久久一区二区三区 | 日韩黄色av| 欧美精品中文字幕久久二区 | 日韩中文字幕在线 | 网站黄色av | 夜夜草 | 国产日韩91 | 国产精品日韩一区二区 |