Begin implementing role menu
This commit is contained in:
parent
1a9d14e3e3
commit
c93077016d
@ -18,7 +18,9 @@ module.exports = {
|
|||||||
this.leaderboardMessageId = "";
|
this.leaderboardMessageId = "";
|
||||||
this.leaderboardChannelId = "";
|
this.leaderboardChannelId = "";
|
||||||
this.waterMessage = "";
|
this.waterMessage = "";
|
||||||
|
this.waterRoleId = "";
|
||||||
this.fruitMessage = "";
|
this.fruitMessage = "";
|
||||||
|
this.fruitRoleId = "";
|
||||||
this.reminderChannelId = "";
|
this.reminderChannelId = "";
|
||||||
this.watchChannelId = "";
|
this.watchChannelId = "";
|
||||||
}
|
}
|
||||||
@ -52,6 +54,10 @@ module.exports = {
|
|||||||
this.watchChannelId = watchChannelId;
|
this.watchChannelId = watchChannelId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
setRoles(waterRoleId, fruitRoleId) {
|
||||||
|
this.waterRoleId = waterRoleId;
|
||||||
|
if (fruitRoleId) this.fruitRoleId = fruitRoleId;
|
||||||
|
}
|
||||||
queryBuilder(query) {
|
queryBuilder(query) {
|
||||||
let queryParts = [];
|
let queryParts = [];
|
||||||
switch (query) {
|
switch (query) {
|
||||||
@ -119,7 +125,15 @@ module.exports = {
|
|||||||
];
|
];
|
||||||
return queryParts.join('');
|
return queryParts.join('');
|
||||||
break;
|
break;
|
||||||
default:
|
case "setRoles":
|
||||||
|
queryParts = [
|
||||||
|
`UPDATE guild_info SET water_role_id = ${db.escape(this.waterRoleId)}, `,
|
||||||
|
`fruit_role_id = ${db.escape(this.fruitRoleId)}, `,
|
||||||
|
`WHERE guild_id = ${db.escape(this.guildId)}`
|
||||||
|
];
|
||||||
|
return queryParts.join('');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -537,9 +537,10 @@ const functions = {
|
|||||||
const collector = channel.createMessageCollector({ filter });
|
const collector = channel.createMessageCollector({ filter });
|
||||||
collector.on('collect', message => {
|
collector.on('collect', message => {
|
||||||
if (message.embeds.length == 0) return;
|
if (message.embeds.length == 0) return;
|
||||||
|
console.log(message.embeds);
|
||||||
if (message.embeds[0].data.description.includes(strings.notifications.water)) {
|
if (message.embeds[0].data.description.includes(strings.notifications.water)) {
|
||||||
this.sendReminder(guildInfo, guildInfo.waterMessage, guildInfo.reminderChannelId, guild);
|
this.sendReminder(guildInfo, guildInfo.waterMessage, guildInfo.reminderChannelId, guild);
|
||||||
} else if (message.embeds[0].data.descriprion.includes(strings.notifications.fruit)) {
|
} else if (message.embeds[0].data.description.includes(strings.notifications.fruit)) {
|
||||||
this.sendReminder(guildInfo, guildInfo.fruitMessage, guildInfo.reminderChannelId, guild);
|
this.sendReminder(guildInfo, guildInfo.fruitMessage, guildInfo.reminderChannelId, guild);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -41,6 +41,7 @@ module.exports = {
|
|||||||
console.log(query);
|
console.log(query);
|
||||||
await dbfn.setGuildInfo(query);
|
await dbfn.setGuildInfo(query);
|
||||||
await interaction.editReply(`I'll watch <#${watchChannel.id}> for Grow A Tree Notifications and relay them to <#${reminderChannel.id}>.`).catch(e => console.error(e));
|
await interaction.editReply(`I'll watch <#${watchChannel.id}> for Grow A Tree Notifications and relay them to <#${reminderChannel.id}>.`).catch(e => console.error(e));
|
||||||
|
fn.collectionBuilders.guildInfos(interaction.client);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error occurred while setting up a notification relay: " + err);
|
console.error("Error occurred while setting up a notification relay: " + err);
|
||||||
|
20
slash-commands/rolemenu.js
Normal file
20
slash-commands/rolemenu.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
const { SlashCommandBuilder } = require('discord.js');
|
||||||
|
const fn = require('../modules/functions.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('rolemenu')
|
||||||
|
.setDescription('Send a self-assignable role selection menu')
|
||||||
|
.addRoleOption(o =>
|
||||||
|
o.setName('waterrole')
|
||||||
|
.setDescription('The role for water reminder pings')
|
||||||
|
.setRequired(true))
|
||||||
|
.addRoleOption(o =>
|
||||||
|
o.setName('fruitrole')
|
||||||
|
.setDescription('The role for fruit alert pings')
|
||||||
|
.setRequired(false)),
|
||||||
|
async execute(interaction) {
|
||||||
|
await interaction.deferReply().catch(err => console.error(err));
|
||||||
|
await interaction.editReply(fn.builders.embeds.treeRoleMenu()).catch(err => console.error(err));
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user