forked from MMPlugins/CloseAddons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
24 lines (22 loc) · 960 Bytes
/
index.js
File metadata and controls
24 lines (22 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module.exports = function({ bot, commands }) {
commands.addInboxThreadCommand('messageclose', '[text$]', async (msg, args, thread) => {
if (! args.text && msg.attachments.length === 0) {
msg.channel.createMessage('Text or Attachment is required');
return;
}
const threadchannel = await thread.getDMChannel();
bot.createMessage(threadchannel.id, `${args.text}`, msg.attachments, false);
msg.delete();
thread.close();
});
commands.addInboxThreadCommand('reasonclose', '[text$]', async (msg, args, thread) => {
if (! args.text && msg.attachments.length === 0) {
msg.channel.createMessage('Text or Attachment is required');
return;
}
const threadchanneltwo = await thread.getDMChannel();
bot.createMessage(threadchanneltwo.id, `Reason for thread closure: ${args.text}`, msg.attachments, false);
msg.delete();
thread.close();
});
};