Skip to content

Commit

Permalink
feat: role select
Browse files Browse the repository at this point in the history
Signed-off-by: BluLightShow <[email protected]>
  • Loading branch information
max-bromberg committed Nov 13, 2021
1 parent b79982c commit 3cb609b
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
7 changes: 6 additions & 1 deletion config-prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
"toCrosspost": ["610239559376044043", "610239597317849248", "610253712824467473"],
"preventDuplicates": ["556594862502182914", "420594746990526468", "775732279938777088", "700051397344886875", "451155251580633089", "438792322340093953", "451155280177266688", "622118305930674192", "759262278050381834", "759262030506360852", "639856342449782798"]
},
"specialMessages": {
"roleSelect": "906772323678421023"
},
"embeds": {
"footer":"Arduino Bot • Submit bugs on GitHub!",
"color": "17989e"
},
"pasteEmoji": "752975737400721549",
"roles": {
"helper": "452631962373455893",
"staff": "451380797782360069"
"staff": "451380797782360069",
"eventNotifsOptin": "908970922730459167",
"serverUpdateNotifsOptin": "908970968070901780"
},
"owners": ["200616508328509442", "223217915673968641"]
}
4 changes: 2 additions & 2 deletions src/commands/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class TagCommand extends Command {
tagEmbed.addField(field.name, field.value, false)
})

return message.channel.send({ embeds: [tagEmbed] })
return message.channel.send({ embeds: [tagEmbed], content: tagFile.content ? tagFile.content : '' })
}
}
})
Expand All @@ -80,7 +80,7 @@ export default class TagCommand extends Command {
tagEmbed.addField(field.name, field.value, false)
})

return message.channel.send({ embeds: [tagEmbed] })
return message.channel.send({ embeds: [tagEmbed], content: tagFile.content ? tagFile.content : '' })
}
}
})
Expand Down
57 changes: 57 additions & 0 deletions src/listeners/interactionCreate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { Listener } from 'discord-akairo'
import { version } from '../../package.json'
import { config, embed } from '../bot'
import * as cache from '../utils/cache'
import { ButtonInteraction, CommandInteraction, Interaction, MessageEmbed } from 'discord.js'

export default class InteractionListener extends Listener {
public constructor() {
super('interactionCreate', {
emitter: 'client',
event: 'interactionCreate'
})
}

public exec(interaction: any) {
if (interaction.isButton() && (interaction.message.id === config.specialMessages.roleSelect)) {
var member = interaction.member
if (interaction.customId === 'events') {
if (member.roles.cache.get(config.roles.eventNotifsOptin)) {
member.roles.remove(config.roles.eventNotifsOptin)

interaction.reply({ ephemeral: true, embeds: [
new MessageEmbed(embed)
.setTimestamp(new Date())
.setTitle('✅ The event notification role was succesfully removed.')
] })
} else {
member.roles.add(config.roles.eventNotifsOptin)

interaction.reply({ ephemeral: true, embeds: [
new MessageEmbed(embed)
.setTimestamp(new Date())
.setTitle('✅ The event notification role was succesfully added.')
] })
}
} else if (interaction.customId === 'server_updates') {
if (member.roles.cache.get(config.roles.serverUpdateNotifsOptin)) {
member.roles.remove(config.roles.serverUpdateNotifsOptin)

interaction.reply({ ephemeral: true, embeds: [
new MessageEmbed(embed)
.setTimestamp(new Date())
.setTitle('✅ The server update notification role was succesfully removed.')
] })
} else {
member.roles.add(config.roles.serverUpdateNotifsOptin)

interaction.reply({ ephemeral: true, embeds: [
new MessageEmbed(embed)
.setTimestamp(new Date())
.setTitle('✅ The server update notification role was succesfully added.')
] })
}
}
}
}
}
1 change: 1 addition & 0 deletions src/tags/codeblock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"value": "If using new lines, a file extension can be placed directly after the first 3 backticks to highlight in that language. An example is shown below, highlighting code in arduino. The backtick key is typically found to the left of the 1 key."
}
],
"content": "",
"image": "https://this-u.lol/09kbow.png"
}

0 comments on commit 3cb609b

Please sign in to comment.