Compare commits
No commits in common. "c325bf5ab4961c9ffbcba0ad5cb1558236820bf4" and "9d82f9dacbf930d3b273dca84e657a60eb269518" have entirely different histories.
c325bf5ab4
...
9d82f9dacb
@ -13,7 +13,6 @@ Contributions welcome.
|
|||||||
> Create a named volume `docker volume create ModmailStorage`
|
> Create a named volume `docker volume create ModmailStorage`
|
||||||
Make sure to have a config.js ready to go, see the example file for a template
|
Make sure to have a config.js ready to go, see the example file for a template
|
||||||
> Start the container
|
> Start the container
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -d --name modmail \
|
docker run -d --name modmail \
|
||||||
-v /path/to/config.js:/modmail/config.js \
|
-v /path/to/config.js:/modmail/config.js \
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
"description": "Modmail bot with eventual integration with Galactic Bot's API",
|
"description": "Modmail bot with eventual integration with Galactic Bot's API",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.js",
|
"start": "node index.js",
|
||||||
"dev": "nodemon --ignore *.json index.js",
|
"dev": "nodemon --ignore *.json index.js"
|
||||||
"dockerpub": "tsc && docker build . --tag navydotgif/modmail:latest && docker push navydotgif/modmail:latest "
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.28.0",
|
"eslint": "^7.28.0",
|
||||||
@ -19,7 +18,7 @@
|
|||||||
"chalk": "^4.0.0",
|
"chalk": "^4.0.0",
|
||||||
"diagnostics": "^2.0.2",
|
"diagnostics": "^2.0.2",
|
||||||
"discord.js": "^12.5.3",
|
"discord.js": "^12.5.3",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.2",
|
||||||
"winston": "^3.3.3",
|
"winston": "^3.3.3",
|
||||||
"winston-transport": "^4.4.0"
|
"winston-transport": "^4.4.0"
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ class ChannelHandler {
|
|||||||
if (channel) await channel.edit({ parentID: state === 'read' ? this.readMail.id : this.newMail.id, lockPermissions: true });
|
if (channel) await channel.edit({ parentID: state === 'read' ? this.readMail.id : this.newMail.id, lockPermissions: true });
|
||||||
if (!this.cache.updatedThreads.includes(target)) this.cache.updatedThreads.push(target);
|
if (!this.cache.updatedThreads.includes(target)) this.cache.updatedThreads.push(target);
|
||||||
if (this.cache.queue.includes(target) && state === 'read') this.cache.queue.splice(this.cache.queue.indexOf(target), 1);
|
if (this.cache.queue.includes(target) && state === 'read') this.cache.queue.splice(this.cache.queue.indexOf(target), 1);
|
||||||
else if (!this.cache.queue.includes(target) && state === 'unread') this.cache.queue.push(target);
|
else if (!this.cache.queue.includes(target)) this.cache.queue.push(target);
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -102,11 +102,11 @@ class ModmailClient extends Client {
|
|||||||
const roles = member.roles.cache.map((r) => r.id);
|
const roles = member.roles.cache.map((r) => r.id);
|
||||||
if (!roles.some((r) => this._options.staffRoles.includes(r)) && !member.hasPermission('ADMINISTRATOR')) return;
|
if (!roles.some((r) => this._options.staffRoles.includes(r)) && !member.hasPermission('ADMINISTRATOR')) return;
|
||||||
|
|
||||||
const [ rawCommand, ...args ] = content.split(/\s+/u);
|
const [ rawCommand, ...args ] = content.split(' ');
|
||||||
const commandName = rawCommand.substring(prefix.length);
|
const commandName = rawCommand.substring(prefix.length);
|
||||||
const command = this.registry.find(commandName);
|
const command = this.registry.find(commandName);
|
||||||
if (!command) return;
|
if (!command) return;
|
||||||
message._caller = commandName;
|
message._caller = commandName.toLowerCase();
|
||||||
|
|
||||||
if (command.showUsage && !args.length) {
|
if (command.showUsage && !args.length) {
|
||||||
|
|
||||||
|
@ -362,6 +362,7 @@ class Modmail {
|
|||||||
response = await this.channels.setReadState(userId, channel, author, state);
|
response = await this.channels.setReadState(userId, channel, author, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (response.error) return response;
|
if (response.error) return response;
|
||||||
this.log({ author, action: `${author.tag} marked ${user.tag}'s thread as ${state}`, target: user });
|
this.log({ author, action: `${author.tag} marked ${user.tag}'s thread as ${state}`, target: user });
|
||||||
return 'Done';
|
return 'Done';
|
||||||
|
@ -13,7 +13,7 @@ class CannedReply extends Command {
|
|||||||
|
|
||||||
async execute (message, { args }) {
|
async execute (message, { args }) {
|
||||||
|
|
||||||
const [ first, second ] = args.map((a) => a);
|
const [ first ] = args.map((a) => a);
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let { channel, content, _caller } = message,
|
let { channel, content, _caller } = message,
|
||||||
anon = false;
|
anon = false;
|
||||||
@ -29,7 +29,6 @@ class CannedReply extends Command {
|
|||||||
|
|
||||||
const list = Object.entries(this.client.modmail.replies);
|
const list = Object.entries(this.client.modmail.replies);
|
||||||
let str = '';
|
let str = '';
|
||||||
if (second?.toLowerCase() !== '-here') channel = await message.author.createDM();
|
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
for (const [ name, content ] of list) {
|
for (const [ name, content ] of list) {
|
||||||
const substr = `**${name}:** ${content}\n`;
|
const substr = `**${name}:** ${content}\n`;
|
||||||
|
@ -12,6 +12,7 @@ class Modmail extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async execute (message, { args }) {
|
async execute (message, { args }) {
|
||||||
|
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let [ first, second ] = args.map((a) => a);
|
let [ first, second ] = args.map((a) => a);
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
@ -36,14 +37,15 @@ class Modmail extends Command {
|
|||||||
error: true,
|
error: true,
|
||||||
msg: 'Cannot send modmail to a bot.'
|
msg: 'Cannot send modmail to a bot.'
|
||||||
};
|
};
|
||||||
content = content.replace(first, '').trim();
|
content = content.replace(first, '');
|
||||||
|
|
||||||
if (!content.length) return {
|
if (!content.length) return {
|
||||||
error: true,
|
error: true,
|
||||||
msg: `Cannot send empty message`
|
msg: `Cannot send empty message`
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.client.modmail.sendModmail({ message, content, anon, target: user });
|
return this.client.modmail.sendModmail({ message, content: content.trim(), anon, target: user });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user