我正在尝试发送不在一行mysql中的消息

时间:2020-08-01 14:22:07

标签: mysql discord.js

我正在尝试发送不在以下行中的消息:

1
2
3
4

我希望这样 `1、2、3、4

我的代码,我从数据库mysql中获取结果


    const Discord = require("discord.js")
    
    
    
    module.exports.run = async (bot, message, args, con) => {
    
        if(!message.member.hasPermission("MANAGE_MESSAGES")) {
            message.channel.send("You don't have permissions to execute this command.")
        }
    
        if (!message.guild.me.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) {
            return message.reply("I don't have permissions to warn.").then(m => m.delete(5000));
        }
    
        
        var person  = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[1]));
        if(!person) {
            embed = new Discord.MessageEmbed()
            .setTitle("QuackCraft")
            .setColor("#ff0000")
            .setDescription("Invalid Arguments")
            .addField("Please use:", "`-warnings <user>`")
            return message.channel.send(embed)
        }
    
    
    
        con.query(`SELECT * FROM warnings WHERE userid = "${person.id}"`, (err, results) => {
            if(err) throw err;
            if(results.length === 0) {
                message.channel.send("This user has no active warnings!")
            } else {
            
                con.query(`SELECT * FROM warnings WHERE warns != "0"`, (err, results1) => {
                    message.channel.send(`<@${person.id}> has currently ${results1[0].warns} active warnings!`)
                })
    
                con.query(`SELECT * FROM warnings`, (err, rows) => {
                    message.channel.send(`Getting the results from the database!`)
                    rows.forEach(function (row) {  
                        console.log(row.reason); 
                    }) 
                    
                    
                })
            }
    
        
        
            
        })
    
    
    }
    
    module.exports.config = {
        name:"warnings",
        description:"Checks the warns of people people",
        usage:"-warnings <user>",
        aliases: ["warns"]
    }

它只是沿直线发送警告,但我一直在试图弄清楚如何像这样发送警告 1,2,3,4不能成一直线,如果您能帮助我,谢谢您!

0 个答案:

没有答案