This repository has been archived by the owner on Aug 28, 2021. It is now read-only.
forked from Factorio-Biter-Battles/Factorio-Biter-Battles
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MewMew
committed
Dec 18, 2018
1 parent
2e4a006
commit 1801b1c
Showing
4 changed files
with
55 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
local event = require 'utils.event' | ||
local message_color = {r = 0.5, g = 0.3, b = 1} | ||
|
||
local brain = { | ||
[1] = {"Our Discord server is at https://comfyplay.net/discord"}, | ||
[2] = {"Need an admin? Type @Mods in game chat to notify moderators!", "Or put a message in the discord help channel."} | ||
} | ||
|
||
local links = { | ||
["discord"] = brain[1], | ||
["admin"] = brain[2], | ||
["administrator"] = brain[2], | ||
["mod"] = brain[2], | ||
["moderator"] = brain[2], | ||
["grief"] = brain[2], | ||
["troll"] = brain[2], | ||
["trolling"] = brain[2], | ||
["stealing"] = brain[2], | ||
["stole"] = brain[2], | ||
["griefer"] = brain[2] | ||
} | ||
|
||
local function on_player_created(event) | ||
local player = game.players[event.player_index] | ||
player.print("Join the comfy discord >> comfyplay.net/discord", message_color) | ||
end | ||
|
||
local function on_console_chat(event) | ||
local message = event.message | ||
message = string.lower(message) | ||
for word in string.gmatch(message, "%a+") do | ||
if links[word] then | ||
local player = game.players[event.player_index] | ||
for _, bot_answer in pairs(links[word]) do | ||
player.print(bot_answer, message_color) | ||
end | ||
return | ||
end | ||
end | ||
end | ||
|
||
event.add(defines.events.on_player_created, on_player_created) | ||
event.add(defines.events.on_console_chat, on_console_chat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters