-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (24 loc) · 1.15 KB
/
index.js
File metadata and controls
26 lines (24 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module.exports = function({ bot, utils, commands }) {
console.log("Deprecation Warning. The MessageClose repository is no longer updated an may not correctly function. Please use https://github.com/MMPlugins/CloseAddons");
console.log("Thanks -Eight8");
commands.addInboxThreadCommand('messageclose', '[text$]', async (msg, args, thread) => {
if (! args.text && msg.attachments.length === 0) {
utils.postError(msg.channel, '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) {
utils.postError(msg.channel, '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();
});
};