mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
feat(bot-discord): stickied messages (#13)
This commit is contained in:
0
apps/bot-discord/src/commands/ban.js
Normal file
0
apps/bot-discord/src/commands/ban.js
Normal file
@@ -1,9 +1,23 @@
|
||||
{
|
||||
"discord": {
|
||||
"trainRoles": ["1019903194941362198", "955220417969262612"],
|
||||
"trainRoles": [
|
||||
"1019903194941362198",
|
||||
"955220417969262612"
|
||||
],
|
||||
"botId": "1038762591805247518",
|
||||
"ignoreRole": "1027874293192863765",
|
||||
"ignoreChannels": ["953965039105232906", "953964264400515092", "952987428786941952"]
|
||||
"ignoreChannels": [
|
||||
"953965039105232906",
|
||||
"953964264400515092",
|
||||
"952987428786941952"
|
||||
]
|
||||
},
|
||||
"sticky": {
|
||||
"channelId": "1135563848586379264",
|
||||
"stickyMessage": {
|
||||
"title": "Read me!"
|
||||
},
|
||||
"timeout": 30000
|
||||
},
|
||||
"server": {
|
||||
"port": 3000,
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
{
|
||||
"discord": {
|
||||
"trainRoles": ["1019903194941362198", "955220417969262612"],
|
||||
"trainRoles": [
|
||||
"1019903194941362198",
|
||||
"955220417969262612"
|
||||
],
|
||||
"botId": "1038762591805247518",
|
||||
"ignoreRole": "1027874293192863765",
|
||||
"ignoreChannels": ["953965039105232906", "953964264400515092", "952987428786941952"]
|
||||
"ignoreChannels": [
|
||||
"953965039105232906",
|
||||
"953964264400515092",
|
||||
"952987428786941952"
|
||||
]
|
||||
},
|
||||
"sticky": {
|
||||
"channelId": "1135563848586379264",
|
||||
"stickyMessage": {
|
||||
"title": "Read me!"
|
||||
},
|
||||
"timeout": 30000
|
||||
},
|
||||
"server": {
|
||||
"port": 3000,
|
||||
@@ -146,4 +160,4 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,25 @@ export default {
|
||||
if (msg.attachments.first() && msg.attachments.first().contentType.startsWith('image')) {
|
||||
helper.scanImage(msg.attachments.first().url, `${msg.channelId}/${msg.id}`);
|
||||
}
|
||||
|
||||
|
||||
if (!msg.content || msg.author.bot) return;
|
||||
helper.scanText(
|
||||
msg.content.toLowerCase().replace(/<.*?>/g, ''),
|
||||
`${msg.channelId}/${msg.id}`
|
||||
);
|
||||
|
||||
// Sticky message
|
||||
if (msg.channel.id !== config.sticky.channelId) return;
|
||||
if (msg.client.stickiedMessageTimeout) clearInterval(msg.client.stickiedMessageTimeout);
|
||||
|
||||
msg.client.stickiedMessageTimeout = setTimeout(() => {
|
||||
const channel = await msg.client.channels.fetch(config.sticky.channelId);
|
||||
|
||||
const message = await channel.send({ embeds: [config.sticky.stickyMessage] });
|
||||
|
||||
if (msg.client.stickiedMessage) channel.delete(msg.client.stickiedMessage);
|
||||
|
||||
msg.client.stickiedMessage = message.id;
|
||||
}, config.sticky.timeout);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,6 +21,8 @@ const client = new Client({
|
||||
|
||||
client.commands = new Collection();
|
||||
client.trainingVotes = new Collection();
|
||||
client.stickiedMessage = null;
|
||||
client.stickiedMessageTimeout = null;
|
||||
|
||||
const commandsPath = join(__dirname, 'commands');
|
||||
const commandFiles = readdirSync(commandsPath).filter((file) =>
|
||||
|
||||
Reference in New Issue
Block a user