首页 > 解决方案 > 使用 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()
  }
}

这些消息作为不同的消息相互发送。但是我希望所有文本都以不同的行显示在消息中。

标签: node.js

解决方案


可以先创建多个字符串,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


推荐阅读