From c2676d3bd691bd30c39e239526717370052aeea3 Mon Sep 17 00:00:00 2001 From: badgamernl Date: Tue, 25 Feb 2020 22:41:41 +0100 Subject: [PATCH] Added ChatBot Async commands: - makepopcorn - passsomesnaps - makecocktail - makecoffee - orderpizza - maketea - meadplease - passabeer --- config/chat_reply.lua | 48 +++++++++++++++++++++++++++++++++++++++++++ locale/en/addons.cfg | 21 +++++++++++++++++-- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/config/chat_reply.lua b/config/chat_reply.lua index fc8dee5c..81cf57c5 100644 --- a/config/chat_reply.lua +++ b/config/chat_reply.lua @@ -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 } } diff --git a/locale/en/addons.cfg b/locale/en/addons.cfg index d0588e20..a039c695 100644 --- a/locale/en/addons.cfg +++ b/locale/en/addons.cfg @@ -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]