node.js - 使用 Visualo Studio 代码发送消息
问题描述
我用这个:
const BaseCommand = require('../../utils/structures/BaseCommand');
module.exports = class ICommand extends BaseCommand {
constructor() {
super('I', 'Shop', ['i','Instructions']);
}
run(client, message, args) {
message.channel.send(':question: **How do i order?** :question: ');
message.channel.send('We try to do it the easiest way. When ordering be as precise as possible, fill out all details');
message.channel.send('**Please fill inn the following:**');
message.channel.send(':one: What item you want. (List everything)/fff');
message.channel.send(':two: Pay the **BANK** the required amount.');
message.channel.send(':three: Give additional information. Do you have gift cards or discount rank you want to use?');
message.channel.send('*When everything is filled out an agent will complete your request.* (7)');
message.delete()
}
}
这些消息作为不同的消息相互发送。但是我希望所有文本都以不同的行显示在消息中。
解决方案
可以先创建多个字符串,newline
然后将所有这些字符串连接到一个字符串,然后只调用一次 message.channel.send() 吗?
也许是这样的:
var str1 = new String( "This is string one\n" );
var str2 = new String( "This is string two\n" );
var str3 = str1.concat(str2.toString());
console.log("str1 + str2 : "+str3)
参考: https ://www.tutorialspoint.com/typescript/typescript_string_concat.htm
推荐阅读
- python - 在烧瓶中获取具有空值的数组,但在 python 笔记本中获取正确的值
- javascript - 我的 Chrome 扩展程序代码是否正确(谷歌拒绝了它,但它在本地工作)?
- django - Nginx + uWSGI + Django 太慢了
- git - 如何在 DAGsHub 上创建新的 Git 实验
- scala - 是否可以在 Scala 3 中导出顶级不透明类型?
- php - Laravel - 在请求对象上更改文件的 mime 类型
- javascript - 在 React 项目中在 typescript 旁边使用 proptypes 的优点
- kubernetes - 每个节点传播特定数量的部署 pod
- python - 如何使用 Django 添加指向我网站另一个页面的链接。我目前收到页面未找到错误
- amazon-web-services - Keycloak 服务器管理控制台使用 Istio 网关和 AWS HTTPS 应用程序负载均衡器阻止 AWS K3S Kubernetes 集群上的混合内容响应