Update .env variable names
This commit is contained in:
parent
87fa9e762d
commit
9bc73d2630
|
@ -1,6 +1,6 @@
|
||||||
clientId=
|
discordClientId=
|
||||||
guildId=
|
discordGuildId=
|
||||||
token=
|
discordToken=
|
||||||
igdbClientId=
|
igdbClientId=
|
||||||
igdbClientSecret=
|
igdbClientSecret=
|
||||||
igdbAccessToken=
|
igdbAccessToken=
|
25
dbObjects.js
25
dbObjects.js
|
@ -19,4 +19,29 @@ BeatenGames.belongsTo(Users);
|
||||||
Games.hasMany(BeatenGames);
|
Games.hasMany(BeatenGames);
|
||||||
BeatenGames.belongsTo(Games);
|
BeatenGames.belongsTo(Games);
|
||||||
|
|
||||||
|
Reflect.defineProperty(Users.prototype, 'addUser', {
|
||||||
|
value: async function addUser(userData) {
|
||||||
|
const user = await Users.findOne({
|
||||||
|
where: { user_id: userData.id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return Users.create({ user_id: userData.discord_id, username: userData.username });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Reflect.defineProperty(Users.prototype, 'getUser', {
|
||||||
|
value: function getUser(userData) {
|
||||||
|
return Users.findAll({
|
||||||
|
where: { user_id: userData.discord_id },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
sequelize.sync({ alter: true })
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = { Users, Games, BeatenGames };
|
module.exports = { Users, Games, BeatenGames };
|
|
@ -27,7 +27,7 @@ for (const folder of commandFolders) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct and prepare an instance of the REST module
|
// Construct and prepare an instance of the REST module
|
||||||
const rest = new REST().setToken(process.env.token);
|
const rest = new REST().setToken(process.env.discordToken);
|
||||||
|
|
||||||
// and deploy your commands!
|
// and deploy your commands!
|
||||||
(async () => {
|
(async () => {
|
||||||
|
@ -36,7 +36,7 @@ const rest = new REST().setToken(process.env.token);
|
||||||
|
|
||||||
// The put method is used to fully refresh all commands in the guild with the current set
|
// The put method is used to fully refresh all commands in the guild with the current set
|
||||||
const data = await rest.put(
|
const data = await rest.put(
|
||||||
Routes.applicationGuildCommands(process.env.clientId, process.env.guildId),
|
Routes.applicationGuildCommands(process.env.discordClientId, process.env.discordGuildId),
|
||||||
{ body: commands },
|
{ body: commands },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
2
index.js
2
index.js
|
@ -48,7 +48,7 @@ for (const file of eventFiles) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client.login(process.env.token);
|
client.login(process.env.discordToken);
|
||||||
|
|
||||||
client.once(Events.ClientReady, () => {
|
client.once(Events.ClientReady, () => {
|
||||||
console.log(`Logged in as ${client.user.tag}!`);
|
console.log(`Logged in as ${client.user.tag}!`);
|
||||||
|
|
Loading…
Reference in New Issue