pawhauo
pawhauo

Reputation: 1

SyntaxError: Invalid left-hand side in assignment

When I make event with "guildMemberAdd" I`m get err: SyntaxError: Invalid left-hand side in assignment. Code:

const Discord = require('discord.js')
const fs = require('fs')

bot.on('GUILD_MEMBER_ADD' = async (bot, message, guild) => {
    let nameserv = guild.name
    let emb = new Discord.MessageEmbed()
        .setTitle('Приветствие.')
        .setDescription(`Добро пожаловать на сервер **${nameserv}**!`)
        .setColor('BLUE')
        .setTimestamp()
        .setFooter('EVENT SYSTEM')
    guild.member.send(emb)
})

Upvotes: 0

Views: 353

Answers (1)

Eli Spiegel
Eli Spiegel

Reputation: 39

You should not be attempting to set "bot.on('GUILD_MEMBER_ADD'" to the async function. Both 'GUILD_MEMBER_ADD' and the async function are arguments to the bot.on function and should be separated by a , not an =.

const Discord = require('discord.js')
const fs = require('fs')

bot.on('GUILD_MEMBER_ADD', async (bot, message, guild) => {
    let nameserv = guild.name
    let emb = new Discord.MessageEmbed()
        .setTitle('Приветствие.')
        .setDescription(`Добро пожаловать на сервер **${nameserv}**!`)
        .setColor('BLUE')
        .setTimestamp()
        .setFooter('EVENT SYSTEM')
    guild.member.send(emb)
})

Upvotes: 1

Related Questions