-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ban, clear, endGame, kick, spam, startGame & minor changes
- Loading branch information
Showing
9 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
name: 'ban', | ||
description: 'ban command', | ||
execute(data, client, prefix) { | ||
if (data.msg.startsWith(`${prefix}ban`)) { | ||
const username = data.msg.split(' ')[1]; | ||
if (username) { | ||
const player = client.players.find(player => player.name === username); | ||
if (player) { | ||
client.hostBan(player.id); | ||
client.sendMessage(`I banned ${player.name}, If I have host permissons of course.`); | ||
} else { | ||
client.sendMessage('Invalid username, try again.'); | ||
} | ||
} else { | ||
client.sendMessage(`Please specify a valid username after ${prefix}ban`); | ||
} | ||
return; | ||
} | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
name: 'clear', | ||
description: 'clear command', | ||
execute(data, client, prefix) { | ||
if (data.msg.startsWith(`${prefix}clear`)) { | ||
client.clearCanvas(); | ||
client.sendMessage('I cleared the canva, If I am the current drawer of course.'); | ||
return; | ||
} | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
name: 'endgame', | ||
description: 'end game command', | ||
execute(data, client, prefix) { | ||
if (data.msg.startsWith(`${prefix}endgame`)) { | ||
client.endGame(); | ||
client.sendMessage('Ended Game, If I have host of course.'); | ||
return; | ||
} | ||
}, | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
name: 'kick', | ||
description: 'kick command', | ||
execute(data, client, prefix) { | ||
if (data.msg.startsWith(`${prefix}kick`)) { | ||
const username = data.msg.split(' ')[1]; | ||
if (username) { | ||
const player = client.players.find(player => player.name === username); | ||
if (player) { | ||
client.hostKick(player.id); | ||
client.sendMessage(`I kicked ${player.name}, If I have host permissons of course.`); | ||
} else { | ||
client.sendMessage('Invalid username, try again.'); | ||
} | ||
} else { | ||
client.sendMessage(`Please specify a valid username after ${prefix}kick`); | ||
} | ||
return; | ||
} | ||
}, | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = { | ||
name: 'spam', | ||
description: 'Spam command', | ||
execute(data, client, prefix) { | ||
let i; | ||
let t; | ||
|
||
if (data.msg.startsWith(`${prefix}spam`)) { | ||
const msg = data.msg.split(' ')[1]; | ||
const timer = data.msg.split(' ')[2]; | ||
const cooldown = data.msg.split(' ')[3]; | ||
|
||
if (typeof msg !== "string" && typeof timer !== "string" && typeof cooldown !== "string") { | ||
client.sendMessage(`Invaild spam fields. Make sure your fields is correct! (${prefix}spam <string> <num> <num>)`); | ||
|
||
return; | ||
} | ||
|
||
if(msg && timer && cooldown) { | ||
client.sendMessage(`Spam started; This will end in ${timer}s; ${prefix}leave to cancel & quit the program.`); | ||
|
||
i = setInterval(() => { | ||
client.sendMessage(msg); | ||
}, cooldown * 1000) | ||
|
||
t = setTimeout(() => { | ||
client.sendMessage('Spam ended'); | ||
clearInterval(i); | ||
}, timer * 1000) | ||
} else { | ||
client.sendMessage(`You're missing fields! ex: ${prefix}spam <message> <time (in seconds)> <cooldown (in seconds)>`); | ||
} | ||
|
||
return; | ||
} | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
name: 'startgame', | ||
description: 'start game command', | ||
execute(data, client, prefix) { | ||
if (data.msg.startsWith(`${prefix}startgame`)) { | ||
client.startGame(); | ||
client.sendMessage('Started Game, If I have host of course.'); | ||
return; | ||
} | ||
}, | ||
}; |
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