So, I am super new to this, and I’ve been trying to connect my Discord bot to a MySQL Database. I will need to do so in the future. So, because I’m still learning, I downloaded a pre-made bot off of GitHub (Link). And when I tried to execute the code, I got:
/home/zodiac/Documents/DiscordJS-MySQL-master/app.js:47
if (message.guild && !message.member) await message.guild.fetch.members(message.author);
^^^^^
SyntaxError: await is only valid in async function
The part of the code it is referring to (Line number 6):
let prefix = row[0].value;
let args = message.content.slice(prefix.length).trim().split(/ +/g);
let command = args.shift().toLowerCase();
if (!message.content.startsWith(prefix)) return;
if (message.guild && !message.member) await message.guild.fetch.members(message.author);
let member = message.guild.member(message.mentions.users.first() || args[0]);
I know this isn’t my code, but I would really like to see it working.
Awaiting a reply