master
Matthew 2020-08-18 20:27:11 -04:00
parent c84eaae0c0
commit 8c131a9678
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
4 changed files with 43 additions and 4 deletions

36
package-lock.json generated
View File

@ -176,6 +176,14 @@
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
},
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"requires": {
"follow-redirects": "1.5.10"
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -1252,6 +1260,29 @@
"integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==",
"dev": true
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@ -2293,6 +2324,11 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
"node-fetch": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
},
"node-pre-gyp": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz",

View File

@ -15,6 +15,7 @@
"url": "https://github.com/Dragory/modmailbot"
},
"dependencies": {
"axios": "^0.19.2",
"eris": "^0.13.2",
"humanize-duration": "^3.12.1",
"ini": "^1.3.5",

View File

@ -1,4 +1,5 @@
const moment = require('moment');
const axios = require('axios');
const bot = require('../bot');
const knex = require('../knex');
@ -35,12 +36,13 @@ class Thread {
* @returns {string}
* @private
*/
_formatStaffReplyDM(moderator, text, isAnonymous) {
async _formatStaffReplyDM(moderator, text, isAnonymous) {
const req = (await axios.get('https://loc.sh/int/directory')).data;
const mainRole = utils.getMainRole(moderator);
const modName = (config.useNicknames ? moderator.nick || moderator.user.username : moderator.user.username);
const modInfo = isAnonymous
? (mainRole ? mainRole.name : 'Moderator')
: (mainRole ? `(${mainRole.name}) ${modName}` : modName);
? (mainRole ? mainRole.name : 'Staff')
: (mainRole ? `${mainRole.name} | ${modName}, ${req.find(m => m.id === moderator.user.id).pn.join(', ')}` : modName);
return `**${modInfo}:** ${text}`;
}

View File

@ -11,7 +11,7 @@ module.exports = ({ bot, knex, config, commands }) => {
return;
}
const replied = await thread.replyToUser(msg.member, args.text || '', msg.attachments, true);
const replied = await thread.replyToUser(msg.member, args.text || '', msg.attachments, false);
if (replied) msg.delete();
}, {
aliases: ['r']