Last active
August 2, 2018 23:54
-
-
Save Nevexo/184ababa4f9c132f3d6b8815f080b8fa to your computer and use it in GitHub Desktop.
Honestly the worst code - but fun as HECK inspired by https://twitter.com/leinweber/status/989267343002951680 it does that but in discord
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Discord = require('discord.js'); | |
const client = new Discord.Client(); | |
client.on('ready', () => { | |
console.log(`Logged in as ${client.user.tag}!`); | |
}); | |
let dict = {} | |
const channels = ["309127154220924929", "441778887064813568", "309894498119319564"] // Place channel IDs in here to monitor - all Dms are monitored by default | |
client.on('typingStart', (channel, user) => { | |
if (user.id != client.user.id) { | |
if (channels.indexOf(channel.id) > -1 ) { | |
if (dict[channel.id] != true) { | |
console.log("[INTERACTION] " + user.tag + " started typing...") | |
console.log(" -> GUILD - Start typing... " + channel.name + " (" + user.tag + ")") | |
dict[channel.id] = true | |
channel.startTyping() | |
} | |
} | |
if (user.dmChannel != undefined) { | |
if (dict[user.id] != true) { | |
console.log(" -> DM - Sending type indicator to " + user.tag) | |
dict[user.dmChannel] = true | |
user.dmChannel.startTyping() | |
} | |
} | |
} | |
}) | |
client.on("typingStop", (channel, user) => { | |
if (user.id != client.user.id) { | |
if (channels.indexOf(channel.id) > -1 ) { | |
console.log("[INTERACTION] " + user.tag + " stopped typing.") | |
console.log(" -> GUILD - Stop typing " + channel.name + " (" + user.tag + ")") | |
dict[channel.id] = false | |
channel.stopTyping() | |
} | |
if (user.dmChannel != undefined) { | |
if (dict[user.dmChannel]) { | |
dict[user.dmChannel] = false | |
user.dmChannel.stopTyping() | |
console.log(" -> DM - Stopping type indicator " + user.tag) | |
} | |
} | |
} | |
}) | |
client.login("Discord token") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment