Impliment typing proxy
parent
e034b514f1
commit
036885144e
|
@ -52,6 +52,8 @@ These go in `config.json`. See also `config.example.json`.
|
|||
|alwaysReplyAnon|false|If `alwaysReply` is set to true, this option controls whether the auto-reply is anonymous|
|
||||
|useNicknames|false|If set to true, mod replies will use their nickname (on the inbox server) instead of their username|
|
||||
|ignoreAccidentalThreads|false|If set to true, the bot attempts to ignore common "accidental" messages that would start a new thread, such as "ok", "thanks", etc.|
|
||||
|typingProxy|false|If set to true, the bot will start typing in the corresponding modmail channel when the user starts typing in DM.
|
||||
|typingProxyReverse|false|If set to true, the bot will start typing in the user's DM when someone starts typing in the corresponding thread.
|
||||
|enableGreeting|false|Set to true to send a welcome message to new main guild members. Requires `mainGuildId` to be set.|
|
||||
|greetingMessage|None|Text content of the welcome message|
|
||||
|greetingAttachment|None|Path to an image or other attachment to send along with the greeting|
|
||||
|
|
|
@ -25,6 +25,8 @@ const defaultConfig = {
|
|||
"alwaysReplyAnon": false,
|
||||
"useNicknames": false,
|
||||
"ignoreAccidentalThreads": false,
|
||||
"typingProxy": false,
|
||||
"typingProxyReverse": false,
|
||||
|
||||
"enableGreeting": false,
|
||||
"greetingMessage": null,
|
||||
|
|
21
src/index.js
21
src/index.js
|
@ -170,6 +170,27 @@ bot.on('messageUpdate', async (msg, oldMessage) => {
|
|||
bot.createMessage(thread.channelId, editMessage);
|
||||
});
|
||||
|
||||
// Subscribe to typingStart if it's enabled either way
|
||||
if(config.typingProxy || config.typingProxyReverse) {
|
||||
bot.on("typingStart", async (channel, user) => {
|
||||
//bot.sendChannelTyping(channel.id);
|
||||
// Handle user typing to modmail in DM
|
||||
if(config.typingProxy && (channel instanceof Eris.PrivateChannel)) {
|
||||
thread = await threads.getForUser(user, false);
|
||||
if (! thread) return;
|
||||
bot.sendChannelTyping(thread.channelId);
|
||||
}
|
||||
// Handle agent typing in thread
|
||||
else if(config.typingProxyReverse && (channel instanceof Eris.GuildChannel) && ! user.bot) {
|
||||
thread = await threads.getByChannelId(channel.id);
|
||||
if (! thread) return;
|
||||
let dm;
|
||||
dm = await bot.getDMChannel(thread.userId);
|
||||
bot.sendChannelTyping(dm.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a reply to the modmail thread where `msg` was posted.
|
||||
* @param {Eris.Message} msg
|
||||
|
|
Loading…
Reference in New Issue