bug fix permissions name, giveawa announce channel

This commit is contained in:
CorwinDev 2022-12-22 09:19:29 +01:00
parent f79f13b457
commit 97464d25fc
3 changed files with 10 additions and 8 deletions

View file

@ -45,8 +45,7 @@ module.exports = async (client) => {
];
}
const randomText = statuttext[Math.floor(Math.random() * statuttext.length)];
client.user.setActivity('activity', { type: Discord.ActivityType.Streaming });
client.user.setPresence({ activities: [{ name: randomText }], status: 'online' });
client.user.setPresence({ activities: [{ name: randomText, type: Discord.ActivityType.Playing }], status: 'online' });
})
}, 50000)

View file

@ -32,7 +32,11 @@ module.exports = async (client) => {
}
}
}
// All bitfields to name
client.bitfieldToName = function (bitfield) {
const permissions = new Discord.PermissionsBitField(bitfield);
return permissions.toArray();
}
client.checkBotPerms = async function ({
flags: flags,
perms: perms
@ -40,7 +44,7 @@ module.exports = async (client) => {
for (let i = 0; i < flags.length; i++) {
if (!interaction.guild.members.me.permissions.has(flags[i])) {
client.errNoPerms({
perms: perms[i],
perms: client.bitfieldToName(flags[i]) || flags[i],
type: 'editreply'
}, interaction);
@ -48,7 +52,6 @@ module.exports = async (client) => {
}
}
}
client.checkUserPerms = async function ({
flags: flags,
perms: perms
@ -56,7 +59,7 @@ module.exports = async (client) => {
for (let i = 0; i < flags.length; i++) {
if (!interaction.member.permissions.has(flags[i])) {
client.errMissingPerms({
perms: perms[i],
perms: client.bitfieldToName(flags[i]) || flags[i],
type: 'editreply'
}, interaction);

View file

@ -17,7 +17,7 @@ module.exports = {
subcommand
.setName('start')
.setDescription('Start a giveaway')
.addChannelOption(option => option.setName('channel').setDescription('Channel where the giveaway should be').setRequired(true).addChannelTypes(ChannelType.GuildText))
.addChannelOption(option => option.setName('channel').setDescription('Channel where the giveaway should be').setRequired(true).addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement))
.addStringOption(option => option.setName('duration').setDescription('Duration of the giveaway').setRequired(true))
.addNumberOption(option => option.setName('winners').setDescription('The number of giveaway winners').setRequired(true))
.addStringOption(option => option.setName('prize').setDescription('The giveaway prize').setRequired(true)),
@ -26,7 +26,7 @@ module.exports = {
subcommand
.setName('drop')
.setDescription('Start a drop giveaway')
.addChannelOption(option => option.setName('channel').setDescription('Channel where the giveaway should be').setRequired(true).addChannelTypes(ChannelType.GuildText))
.addChannelOption(option => option.setName('channel').setDescription('Channel where the giveaway should be').setRequired(true).addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement))
.addStringOption(option => option.setName('duration').setDescription('Duration of the giveaway').setRequired(true))
.addNumberOption(option => option.setName('winners').setDescription('The number of giveaway winners').setRequired(true))
.addStringOption(option => option.setName('prize').setDescription('The giveaway prize').setRequired(true)),