Merge pull request #108 from Cooldude2606/feature/chat-reply

Chat bot and auto reply
This commit is contained in:
Cooldude2606
2019-06-13 17:27:33 +01:00
committed by GitHub
15 changed files with 159 additions and 20 deletions

View File

@@ -36,6 +36,7 @@ return {
'modules.addons.pollution-grading',
'modules.addons.random-player-colours',
'modules.addons.discord-alerts',
'modules.addons.chat-reply',
-- GUI
'modules.gui.rocket-info',
'modules.gui.science-info',

66
config/chat_reply.lua Normal file
View File

@@ -0,0 +1,66 @@
--- This file defines the different triggers for the chat bot
local format_time = ext_require('expcore.common','format_time')
return {
allow_command_prefix_for_messages = true, -- when true any message trigger will print to all player when prefixed
messages = { -- will trigger when ever the word is said
['discord']={'info.discord'},
['expgaming']={'info.website'},
['website']={'info.website'},
['wiki']={'info.wiki'},
['status']={'info.status'},
['github']={'info.github'},
['command']={'info.custom-commands'},
['commands']={'info.custom-commands'},
['softmod']={'info.softmod'},
['script']={'info.softmod'},
['loop']={'chat-bot.loops'},
['loops']={'chat-bot.loops'},
['rhd']={'chat-bot.lhd'},
['lhd']={'chat-bot.lhd'},
['roundabout']={'chat-bot.loops'},
['roundabouts']={'chat-bot.loops'},
['redmew']={'chat-bot.redmew'},
['afk']=function(player)
local max=player
for _,next_player in pairs(game.connected_players) do
if max.afk_time < next_player.afk_time then
max=next_player
end
end
return {'chat-bot.afk',max.name,format_time(max.afk_time,{minutes=true,seconds=true,long=true})}
end,
['players']=function()
return {'chat-bot.players',#game.players}
end,
['online']=function()
return {'chat-bot.players-online',#game.connected_players}
end,
['time']=function()
return {'chat-bot.map-time',format_time(game.tick,{days=true,hours=true,minutes=true,seconds=true,long=true})}
end,
},
command_admin_only = false, -- when true will only allow chat commands for admins
command_permission = 'command/chat-bot', -- the permision used to allow command prefixs
command_prefix = '!', -- prefix used for commands below and to print to all players (if enabled above)
commands = { -- will trigger only when command prefix is given
['dev']={'chat-bot.not-real-dev'},
['blame']=function(player)
local names = {'Cooldude2606','arty714','badgamernl',player.name}
for _,next_player in pairs(game.connected_players) do
names[#names + 1] = next_player.name
end
return {'chat-bot.blame',table.get_random_dictionary_entry(names)}
end,
['magic']={'chat-bot.magic'},
['aids']={'chat-bot.aids'},
['riot']={'chat-bot.riot'},
['lenny']={'chat-bot.lenny'},
['hodor']=function()
local options = {'?','.','!','!!!'}
return {'chat-bot.hodor',table.get_random_dictionary_entry(options)}
end,
['evolution']=function()
return {'chat-bot.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)}
end,
}
}

View File

@@ -6,17 +6,17 @@ return {
},
messages={ -- the messages that each one will say, must be same name as its location
['Spawn']={
{'info.website-message'},
{'info.website'},
{'info.read-readme'},
{'info.discord-message'},
{'info.discord'},
{'info.softmod'},
{'info.wiki-message'},
{'info.wiki'},
{'info.redmew'},
{'info.feedback-message'},
{'info.feedback'},
{'info.custom-commands'},
{'info.status-message'},
{'info.status'},
{'info.lhd'},
{'info.github-message'},
{'info.github'},
}
}
}

View File

@@ -163,6 +163,7 @@ Roles.new_role('Veteran','Vet')
:set_custom_color{r=140,g=120,b=200}
:set_parent('Member')
:allow{
'command/chat-bot',
}
:set_auto_promote_condition(function(player)
if player.online_time > 10*216000 then

View File

@@ -11,7 +11,7 @@ return {
{'warnings.received',{'warnings.pre-pre-ban'}},
{'warnings.received',{'warnings.pre-ban'}},
function(player,by_player_name,number_of_warnings)
game.ban_player(player,{'warnings.received',by_player_name,number_of_warnings,{'warnings.ban',{'info.website-link'}}})
game.ban_player(player,{'warnings.received',by_player_name,number_of_warnings,{'warnings.ban',{'links.website'}}})
end
},
temp_warning_cool_down=30, -- time for a temp warning (given by script) to be removed (in minutes)