add the ability to add multiple bots with the new logic

This commit is contained in:
Alberto Xamin 2020-12-25 21:15:21 +01:00
parent 632635e464
commit 1000b149cc
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2

View File

@ -35,8 +35,15 @@ export default {
},
methods: {
sendChatMessage(e) {
if (this.text.trim().length > 0){
this.$socket.emit('chat_message', this.text.trim())
let msg = this.text.trim()
if (msg.length > 0){
if (msg.indexOf('/addbot') !== -1 && msg.split(' ').length > 1){
for (let i = 0; i < parseInt(msg.split(' ')[1]); i++) {
this.$socket.emit('chat_message', msg.split(' ')[0])
}
}else{
this.$socket.emit('chat_message', msg)
}
this.text = ''
}
e.preventDefault();