mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-28 12:05:21 +09:00
Added ExpGamingBot
This commit is contained in:
62
modules/ExpGamingBot/autoMessage/control.lua
Normal file
62
modules/ExpGamingBot/autoMessage/control.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
--- Sends messages in chat in resposce to other messages
|
||||
-- @module ExpGamingBot.autoChat
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
|
||||
local Server = require('ExpGamingCore.Server')
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
local Ranking
|
||||
local Sync
|
||||
|
||||
script.on_init(function(event)
|
||||
Server.new_thread{
|
||||
name='auto-message',
|
||||
timeout=54000, -- 3240000 = 15 hours dont make the mistake i did, 54000 is 15 minutes
|
||||
reopen=true,
|
||||
data={
|
||||
high_rank= 'Owner',
|
||||
low_rank= 'Regular',
|
||||
low={
|
||||
{'chat-bot.join-us'},
|
||||
{'chat-bot.discord'},
|
||||
{'chat-bot.website'},
|
||||
{'chat-bot.custom-commands'},
|
||||
{'chat-bot.read-readme'}
|
||||
}
|
||||
}
|
||||
}:on_event('timeout',function(self)
|
||||
local data = self.data
|
||||
if not data.high_rank or not data.low_rank
|
||||
or not data.low then self.reopen = false return end
|
||||
game.print{'chat-bot.message',{'chat-bot.players-online',#game.connected_players}}
|
||||
game.print{'chat-bot.message',{'chat-bot.map-time',tick_to_display_format(game.tick)}}
|
||||
self.reopen = true
|
||||
end):on_event(defines.events.on_player_joined_game,function(self,event)
|
||||
local player = Game.get_player(event)
|
||||
if not player then return end
|
||||
local data = self.data
|
||||
if not data.high_rank or not data.low_rank
|
||||
or not data.low then self.reopen = false return end
|
||||
-- idk but this stoped working for no appent reason so i added more checks for nil values
|
||||
if Ranking and Ranking.get_rank(player).power <= Ranking.get_rank(data.low_rank).power or player.admin then return end
|
||||
for _,message in pairs(data.low) do
|
||||
player_return({'chat-bot.message',message},nil,player)
|
||||
end
|
||||
end):on_event('error',function(self,err)
|
||||
Sync.emit_embeded{
|
||||
title='Auto Message Error',
|
||||
color=Color.to_hex(defines.text_color.bg),
|
||||
description='Auto Message Error - Closed Thread',
|
||||
Error=err
|
||||
}
|
||||
self.reopen = false
|
||||
self:close()
|
||||
end):open()
|
||||
end)
|
||||
|
||||
return {
|
||||
on_init = function(self)
|
||||
if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end
|
||||
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||
end
|
||||
}
|
||||
9
modules/ExpGamingBot/autoMessage/locale/de.cfg
Normal file
9
modules/ExpGamingBot/autoMessage/locale/de.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[chat-bot]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (can be found through the question mark on the top left)
|
||||
9
modules/ExpGamingBot/autoMessage/locale/en.cfg
Normal file
9
modules/ExpGamingBot/autoMessage/locale/en.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[chat-bot]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: https://www.explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (It can be found through the question mark on the top left)
|
||||
9
modules/ExpGamingBot/autoMessage/locale/fr.cfg
Normal file
9
modules/ExpGamingBot/autoMessage/locale/fr.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[chat-bot]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (can be found through the question mark on the top left)
|
||||
9
modules/ExpGamingBot/autoMessage/locale/nl.cfg
Normal file
9
modules/ExpGamingBot/autoMessage/locale/nl.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[chat-bot]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (can be found through the question mark on the top left)
|
||||
10
modules/ExpGamingBot/autoMessage/locale/sv-SE.cfg
Normal file
10
modules/ExpGamingBot/autoMessage/locale/sv-SE.cfg
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
[chat-bot]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=Det är __1__ spelare online
|
||||
map-time=Den här kartan har varit igång under __1__
|
||||
join-us=Var snäll och förena dig med oss:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: explosivegaming.nl
|
||||
custom-commands=Vi använder oss av specialiserade kommandon, som till exempel /tag och /report, se kommandotabben i readme för mer information.
|
||||
read-readme=Se till att du har läst "Readme" (Finn den genom att klicka på frågetecknet högst upp i vänstra hörnet)
|
||||
17
modules/ExpGamingBot/autoMessage/softmod.json
Normal file
17
modules/ExpGamingBot/autoMessage/softmod.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "autoMessage",
|
||||
"version": "4.0.0",
|
||||
"type": "Module",
|
||||
"description": "Prints a message every 15 minutes to chat.",
|
||||
"location": "<blank>",
|
||||
"keywords": [
|
||||
"Bot",
|
||||
" Chat",
|
||||
" Auto Message",
|
||||
" Message"
|
||||
],
|
||||
"author": "<blank>",
|
||||
"contact": "<blank>",
|
||||
"license": "<blank>",
|
||||
"dependencies": {}
|
||||
}
|
||||
Reference in New Issue
Block a user