Update .env variable names
This commit is contained in:
parent
87fa9e762d
commit
9bc73d2630
|
@ -1,6 +1,6 @@
|
|||
clientId=
|
||||
guildId=
|
||||
token=
|
||||
discordClientId=
|
||||
discordGuildId=
|
||||
discordToken=
|
||||
igdbClientId=
|
||||
igdbClientSecret=
|
||||
igdbAccessToken=
|
25
dbObjects.js
25
dbObjects.js
|
@ -19,4 +19,29 @@ BeatenGames.belongsTo(Users);
|
|||
Games.hasMany(BeatenGames);
|
||||
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 };
|
|
@ -27,7 +27,7 @@ for (const folder of commandFolders) {
|
|||
}
|
||||
|
||||
// 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!
|
||||
(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
|
||||
const data = await rest.put(
|
||||
Routes.applicationGuildCommands(process.env.clientId, process.env.guildId),
|
||||
Routes.applicationGuildCommands(process.env.discordClientId, process.env.discordGuildId),
|
||||
{ body: commands },
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue