mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-23 01:05:30 +01:00
Bump dependencies and add typing event handler
This commit is contained in:
parent
a2950ed722
commit
7703506aae
|
@ -29,7 +29,7 @@
|
|||
"@types/debug": "^4.1.5",
|
||||
"@types/fluent-ffmpeg": "^2.1.14",
|
||||
"@types/fs-capacitor": "^2.0.0",
|
||||
"@types/node": "^13.9.1",
|
||||
"@types/node": "^13.9.5",
|
||||
"@types/node-emoji": "^1.8.1",
|
||||
"@types/spotify-web-api-node": "^4.0.1",
|
||||
"@types/validator": "^12.0.1",
|
||||
|
@ -71,7 +71,7 @@
|
|||
"array-shuffle": "^1.0.1",
|
||||
"debug": "^4.1.1",
|
||||
"delay": "^4.3.0",
|
||||
"discord.js": "^12.0.2",
|
||||
"discord.js": "^12.1.1",
|
||||
"dotenv": "^8.2.0",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
"fs-capacitor": "^6.1.0",
|
||||
|
|
|
@ -7,6 +7,7 @@ import Command from './commands';
|
|||
import debug from './utils/debug';
|
||||
import NaturalLanguage from './services/natural-language-commands';
|
||||
import handleGuildCreate from './events/guild-create';
|
||||
import handleTypingStart from './events/handle-typing-start';
|
||||
import handleVoiceStateUpdate from './events/voice-state-update';
|
||||
import errorMsg from './utils/error-msg';
|
||||
import {isUserInVoice} from './utils/channels';
|
||||
|
@ -104,6 +105,7 @@ export default class {
|
|||
|
||||
// Register event handlers
|
||||
this.client.on('guildCreate', handleGuildCreate);
|
||||
this.client.on('typingStart', handleTypingStart);
|
||||
this.client.on('voiceStateUpdate', handleVoiceStateUpdate);
|
||||
|
||||
return this.client.login(this.token);
|
||||
|
|
21
src/events/handle-typing-start.ts
Normal file
21
src/events/handle-typing-start.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import {Channel, TextChannel, PartialDMChannel, User, PartialUser} from 'discord.js';
|
||||
|
||||
const WAIT_TIME_SECONDS = 12;
|
||||
|
||||
export default (channel: Channel | PartialDMChannel, user: User | PartialUser): void => {
|
||||
if (channel.type !== 'text') {
|
||||
return;
|
||||
}
|
||||
|
||||
const textChannel = channel as TextChannel;
|
||||
|
||||
setTimeout(async () => {
|
||||
if (user.typingIn(channel)) {
|
||||
const msg = await textChannel.send(`take your time why don'tcha <@${user.id}>`);
|
||||
|
||||
setTimeout(async () => {
|
||||
await msg.delete();
|
||||
}, 2000);
|
||||
}
|
||||
}, WAIT_TIME_SECONDS * 1000); // Discord sends typing updates every 10s
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2017"],
|
||||
"lib": ["ES2018"],
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -121,10 +121,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.0.tgz#5b6ee7a77faacddd7de719017d0bc12f52f81589"
|
||||
integrity sha512-0ARSQootUG1RljH2HncpsY2TJBfGQIKOOi7kxzUY6z54ePu/ZD+wJA8zI2Q6v8rol2qpG/rvqsReco8zNMPvhQ==
|
||||
|
||||
"@types/node@^13.9.1":
|
||||
version "13.9.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.1.tgz#96f606f8cd67fb018847d9b61e93997dabdefc72"
|
||||
integrity sha512-E6M6N0blf/jiZx8Q3nb0vNaswQeEyn0XlupO+xN6DtJ6r6IT4nXrTry7zhIfYvFCl3/8Cu6WIysmUBKiqV0bqQ==
|
||||
"@types/node@^13.9.5":
|
||||
version "13.9.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.5.tgz#59738bf30b31aea1faa2df7f4a5f55613750cf00"
|
||||
integrity sha512-hkzMMD3xu6BrJpGVLeQ3htQQNAcOrJjX7WFmtK8zWQpz2UJf13LCFF2ALA7c9OVdvc2vQJeDdjfR35M0sBCxvw==
|
||||
|
||||
"@types/parse-json@^4.0.0":
|
||||
version "4.0.0"
|
||||
|
@ -760,10 +760,10 @@ diff@^4.0.1:
|
|||
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
|
||||
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
|
||||
|
||||
discord.js@^12.0.2:
|
||||
version "12.0.2"
|
||||
resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-12.0.2.tgz#c4d68f1363d7fc05ed71a42dba6b930966ed8602"
|
||||
integrity sha512-iZiEA4Y61gqq/EjFfLXnkRK9pLapnax/vTVDUhs/mAhyqozAy0GOlk/MZI9rSa1iIoKTWRq6P9CRKhLNT2wUnA==
|
||||
discord.js@^12.1.1:
|
||||
version "12.1.1"
|
||||
resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-12.1.1.tgz#440043ab5a09d66311e8b975acd31bea4f8ed227"
|
||||
integrity sha512-Y6+QfAUZkb9cy27cfNqUigAgYVSKTw9jPF3mN4UDMih3Em3VQ0WjGBdX1UbE8CwFkLOu5XWQSNPdsoStTR8c2Q==
|
||||
dependencies:
|
||||
"@discordjs/collection" "^0.1.5"
|
||||
abort-controller "^3.0.0"
|
||||
|
|
Loading…
Reference in a new issue