mierda
This commit is contained in:
parent
df6aa45a73
commit
438f3ff2eb
55
index.js
55
index.js
@ -24,12 +24,24 @@ const client = new irc.Client(settings.server, settings.username, {
|
||||
client.addListener('registered', () => {
|
||||
|
||||
//////////////LISTENERS////////////////////
|
||||
|
||||
client.addListener('error', (message) => {
|
||||
console.log('Error: ' + message)
|
||||
})
|
||||
|
||||
client.addListener('message', function (from, channel, message) {
|
||||
if (channel === settings.username) return
|
||||
//DMS SENT TO THE BOT
|
||||
if (channel === client.nick){
|
||||
console.log("DM from " + from + ": " + message)
|
||||
|
||||
const args = message.split("# ")[1]
|
||||
if(args){
|
||||
if(args === "GetInfo") client.say(from, "# HeresInfo: japanese nationalist")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
logMessage(from, channel, message)
|
||||
});
|
||||
|
||||
@ -37,24 +49,26 @@ client.addListener('registered', () => {
|
||||
client.addListener('join', (channel, nick) => {
|
||||
logMessage(nick, channel, "Joined the channel")
|
||||
//I'M THE ANIME GIRL FAGGOT
|
||||
if (nick === settings.username) sendMessage(channel, "# Appears as Jhenna_Hina.http://www.mermeliz.com/hina/dl/Jhenna_Hina.AVB")
|
||||
if (nick === client.nick){
|
||||
sendMessage(channel, "# Appears as Jhenna_Hina.http://www.mermeliz.com/hina/dl/Jhenna_Hina.AVB")
|
||||
}else{
|
||||
client.say(nick, "# Appears as Jhenna_Hina.http://www.mermeliz.com/hina/dl/Jhenna_Hina.AVB")
|
||||
}
|
||||
})
|
||||
|
||||
client.addListener('part', (channel, nick, reason, _message) => {
|
||||
console.log(channel)
|
||||
logMessage(nick, channel, "Parted: " + reason)
|
||||
logMessage(nick, channel, `Left${reason ? ":" + reason : "."}` )
|
||||
})
|
||||
|
||||
client.addListener('quit', (nick, reason, channels, _message) => {
|
||||
for(i in channels){
|
||||
logMessage(nick, channels[i], "Left: " + reason)
|
||||
logMessage(nick, channels[i], `Left${reason ? ":" + reason : "."}`)
|
||||
}
|
||||
})
|
||||
|
||||
client.addListener('kick', (channel, nick, by, reason, _message) => {
|
||||
logMessage(nick, channel, "Kicked by: " + by + ": " + reason)
|
||||
})
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ -106,7 +120,8 @@ client.addListener('registered', () => {
|
||||
const prefix = split[0]
|
||||
if(prefix === "g"){
|
||||
const terminalCommand = split[1].split(' ')[0]
|
||||
const args = split[1].split(' ')[1] ? split[1].split(' ')[1] : ""
|
||||
const splitArgs = split[1].split(' ')
|
||||
const args = splitArgs[1] ? splitArgs[1] : ""
|
||||
switch (terminalCommand) {
|
||||
case "switch_channel":
|
||||
if (!args) {
|
||||
@ -130,6 +145,26 @@ client.addListener('registered', () => {
|
||||
console.log(user)
|
||||
}
|
||||
break
|
||||
case "message":
|
||||
if(!args){
|
||||
console.log("Arguments required")
|
||||
}
|
||||
const message = getMessageFromArgs(splitArgs)
|
||||
if (!message) {
|
||||
console.log("Message required");
|
||||
break
|
||||
}
|
||||
client.say(args, message)
|
||||
break
|
||||
case "whois":
|
||||
if(!args) return console.log("Arguments required")
|
||||
client.whois(args, (info) => {
|
||||
console.log(info)
|
||||
})
|
||||
break
|
||||
default:
|
||||
console.log("Comando inexistente")
|
||||
break
|
||||
}
|
||||
}else{
|
||||
sendMessage(currentChannel, command)
|
||||
@ -148,4 +183,10 @@ function checkIfIsInChannelAndLog(channel){
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function getMessageFromArgs(splitArgs){
|
||||
splitArgs.shift()
|
||||
splitArgs.shift()
|
||||
return splitArgs.join(" ")
|
||||
}
|
Loading…
Reference in New Issue
Block a user