Merge pull request #4 from bbassie/feature/async

Added ChatBot Async commands
This commit is contained in:
Cooldude2606
2020-02-25 22:52:43 +00:00
committed by GitHub
2 changed files with 67 additions and 2 deletions

View File

@@ -1,8 +1,13 @@
--- This file defines the different triggers for the chat bot
-- @config Chat-Reply
local Async = require 'expcore.async'
local format_time = ext_require('expcore.common','format_time') --- @dep expcore.common
local async_message = Async.register(function(player, message)
player.print(message)
end)
return {
allow_command_prefix_for_messages = true, --- @setting allow_command_prefix_for_messages when true any message trigger will print to all player when prefixed
messages = { --- @setting messages will trigger when ever the word is said
@@ -65,5 +70,48 @@ return {
['evolution']=function()
return {'chat-bot.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)}
end,
['makepopcorn']=function(player)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-popcorn-1'}})
Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-popcorn-2',player.name}})
end,
['passsomesnaps']=function(player)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-snaps-1'}})
Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-snaps-2',player.name}})
Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.get-snaps-3',player.name}})
end,
['makecocktail']=function(player)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-1'}})
Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-2',player.name}})
Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-3',player.name}})
end,
['makecoffee']=function(player)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message,player,{'chat-bot.reply',{'chat-bot.make-coffee-1'}})
Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.make-coffee-2',player.name}})
end,
['orderpizza']=function(player)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-1'}})
Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-2',player.name}})
Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-3',player.name}})
end,
['maketea']=function(player)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message,player,{'chat-bot.reply',{'chat-bot.make-tea-1'}})
Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.make-tea-2',player.name}})
end,
['meadplease']=function(player)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-mead-1'}})
Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-mead-2',player.name}})
end,
['passabeer']=function(player)
local timeout = math.floor(180*(math.random()+0.5))
Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-beer-1'}})
Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-beer-2',player.name}})
end
}
}

View File

@@ -57,8 +57,25 @@ riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ \(´ω` )/
loops=NO LOOPS; LOOPS ARE BAD; JUST NO LOOPS!!!!!; IF YOU MAKE A LOOP.... IT WILL NOT END WELL!!!!!!!
lenny=( ͡° ͜ʖ ͡°)
hodor=Hodor
get-popcorn-1=Heating the oil and waiting for the popping sound...
get-popcorn-2=__1__ your popcorn is finished. Lean backwards and watch the drama unfold.
get-snaps-1=Pouring the glasses and finding the correct song book...
get-snaps-2=Singing a song...🎤🎶
get-snaps-3=schkål, my friends!
get-cocktail-1= 🍸 Inintiating mind reading unit... 🍸
get-cocktail-2= 🍸 Mixing favourite ingredients of __1__ 🍸
get-cocktail-3=🍸 __1__ your cocktail is done.🍸
make-coffee-1= ☕ Boiling the water and grinding the coffee beans... ☕
make-coffee-2= ☕ __1__ we ran out of coffe beans! Have some tea instead. ☕
order-pizza-1= 🍕 Finding nearest pizza supplier... 🍕
order-pizza-2= 🍕 Figuring out the favourite pizza of __1__ 🍕
order-pizza-3= 🍕 __1__ your pizza is here! 🍕
make-tea-1= ☕ Boiling the water... ☕
make-tea-2= ☕ __1__ your tea is done! ☕
get-mead-1= Filling the drinking horn
get-mead-2= Skål!
get-beer-1= 🍺 Pouring A Glass 🍺
get-beer-2= 🍻 Chears Mate 🍻
[greetings]
greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color]