Skip to content

Instantly share code, notes, and snippets.

@doyousketch2
Last active May 29, 2020 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doyousketch2/5472152ed8ae1f76bd6e38c6a6cd525a to your computer and use it in GitHub Desktop.
Save doyousketch2/5472152ed8ae1f76bd6e38c6a6cd525a to your computer and use it in GitHub Desktop.
Ignore Minetest IRC passthrough chat-bots in HexChat
Windows HexChat comes with Lua interpreter
Linux users will need to make sure it's installed:
sudo apt install hexchat-lua
copy mt_bots.lua into your HexChat addons directory
then enable in the app, through the menu
Windows >> Plugins and Scripts
-----------------------------------------------------------
-- @Doyousketch2 AGPL-3 Jun 21, 2019
-- https://www.gnu.org/licenses/agpl-3.0.en.html
-----------------------------------------------------------
-- header
local name = 'mt_bots.lua'
local version = '1.1'
local description = 'Ignore Minetest IRC Bots'
hexchat .register( name, version, description )
--[[ notes: https://git.io/fjwCk
https://hexchat.readthedocs.io/en/latest/script_lua.html
/command NICK Hi there!
word[1] is NICK
word[2] is Hi there!
]]---------------------------------------------------------
-- variable declaration
-- change these to nicknames you use. comma, space, quote to add or remove entries, as neccissary.
local my_nicknames = { 'YourUserNameGoesHere', 'YourOtherUserNameGoesHere' }
-- you can specify an alternate designation, if you so choose
local avatar = '<<in-game>>'
-- specify Minetest IRC chat bot relays, from servers that you frequent
local bot_list = { 'VE-Bananaland', 'VE-Basic', 'VE-Building', 'VE-Creative',
'VE-MTZ', 'VE-Nostalgia', 'VE-Skyblock', 'VE-Survival' }
local print_debug_msgs = false -- set to true if you want to see excess jibberish.
-----------------------------------------------------------
-- define functions
local function ignore( word )
local NICK = word[1]
local entire_msg = word[2]
local passthrough = ''
local found_passthrough_nick = false
if entire_msg :sub( 1, 1 ) == '<' then
found_passthrough_nick = true
passthrough = entire_msg :sub( 2, entire_msg :find('>') -1 ) -- strips < >
end
if print_debug_msgs then
hexchat .print( 'dbg1|' ..NICK ..'||' )
hexchat .print( 'dbg2|' ..entire_msg ..'||' )
if found_passthrough_nick then
hexchat .print( 'dbg3|' ..passthrough ..'||' )
end -- found_passthrough_nick
end -- print_debug_msgs
for _, bot_name in pairs( bot_list ) do
if bot_name == NICK then
for _, nick_name in pairs( my_nicknames ) do
if nick_name == passthrough then
replacement = entire_msg :sub( entire_msg :find('>') +1, -1 )
if print_debug_msgs then
hexchat .print( 'dbg4|' ..replacement ..'||' )
end -- replacement
hexchat .print( avatar ..replacement )
return hexchat .EAT_HEXCHAT
end -- replacement
end -- nick_name
end -- NICK
end -- bot_name
end -- funct
-----------------------------------------------------------
-- main loop
-- hexchat .hook_print( 'Channel Message', ignore )
hexchat .hook_print( 'Channel Msg Hilight', ignore )
-----------------------------------------------------------
-- eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment