Saturday 13 May 2017

Bad Request in Discord.js (Node) and cant find out whats causing it

Im coding a bot in Discord.js (Node) and i'm trying to send an embed with the server info, i've got all the code but it keeps causing a Bad Request and i've tried everything i know here's the code:

var FieldsData = [{ name: "Channels", value: msg.guild.channels.size }, { name: "Emojis", value: msg.guild.emojis.size }, { name: "Members", value: msg.guild.members.size }, { name: "Owner", value: msg.guild.owner }, { name: "Roles", value: msg.guild.roles.size }, { name: "Region", value: msg.guild.region }, { name: "Id", value: msg.guild.id }, { name: "Icon", value: msg.guild.iconURL }, { name: "Created At", value: msg.guild.createdAt }];
msg.channel.send('', {
    embed: {
        color: 37119,
        title: "Server info for " + msg.guild.name,
        fields: FieldsData
    }
});

i've tried the message with just one field and it works, i've tried it will each field by themselves and it works but when i put them all together they make a Bad Request, i've checked every line, every character and im just stumped at what could possibly be causing this, the max fields is 25 and i don't have that many, all the variables are valid, none produce 'Null' or 'Undefined', i've tried different setups of the code layout, i've tried adding/removing parts, editing parts, replacing bits here and there but to no avail i cant get it to work at all.

i've been trying to figure this out for 2 hours, i've searched online, docs, etc

Please Note: im not that advanced with javascript so if i've made a big mistake then dont be surprised.

"msg" is the object of the message, Example:

Bot.on('message', function (msg) { /*Stuff*/ });

I hope i've explained this enough, im using the LATEST version of Discord.js at the time of posting this and im not using ANY other extensions, packages, etc



via DEG0029

No comments:

Post a Comment