TShockIRC

Discussion in 'Plugin Release Discussion' started by MarioE, Mar 26, 2013.

  1. MarioE

    TShock Admin TShock Mod Plugin Developer

    Joined:
    May 26, 2012
    Messages:
    386
    Description:
    This plugin acts as an IRC bot for the server; it relays the in-game chat to a specified IRC channel and vice-versa. It also has the ability to relay in-game command usage to another IRC channel.

    Users can execute commands from inside of the channel or in a query (private message) to the IRC bot; they are able to authenticate to the bot and execute commands as if they were on the server.

    Permissions:
    • tshockirc.command - Allows the execution of a command on the server from IRC.
    • tshockirc.manage - Allows reloading the configuration file and restarting the IRC bot.
    Commands:
    • /ircreload - Reloads the configuration file.
    • /ircrestart - Restarts the IRC bot.
    IRC Commands:
    To execute a server command directly, use <command name> [command arguments]. E.g., if I wanted to stop the server, I would use .off.
    • login <user> <password> - Logs the user in.
    • logout - Logs the user out.
    • players - Provides a list of all players currently on the server.
    Note: All IRC commands must be prefixed unless used in query.

    Links:
     
    • Like Like x 6
  2. MarioE

    TShock Admin TShock Mod Plugin Developer

    Joined:
    May 26, 2012
    Messages:
    386
    Config:
    • AdminChannel: The channel where command usage is relayed, if enabled.
    • AdminChannelKey: The channel key for the channel specified above, if any.
    • Channel: The channel where in-game chat is relayed, and vice versa.
    • ChannelKey: The channel key for the channel specified above, if any.
    • ConnectCommands: The commands that the IRC bot issues when it connects to the server.
    • Nick: The nickname of the IRC bot.
    • Port: The port of the IRC server.
    • RealName: The real name of the IRC bot.
    • Server: The IRC server.
    • SSL: Whether or not to connect with SSL/TLS.
    • UserName: The user name of the IRC bot.
    • BotPrefix: The prefix used when accessing the IRC bot.
    • IgnoredCommands: A list of commands to ignore from IRC.
    • IgnoredIRCChatRegexes: A list of regexes to check IRC messages against.
    • IgnoredIRCNicks: A list of nicknames to completely ignore in IRC.
    • IgnoredServerChatRegexes: A list of regexes to check server messages against.
    For the below formats, if the format is empty, then the message is not relayed.
    • IRCActionMessageFormat: The format for IRC action messages which are relayed to the server. {0} is the nick, {1} is the message.
    • IRCChatMessageFormat: The format for IRC chat messages which are relayed to the server. {0} is the prefix of the user, if available, {1} is the nick, {2} is the message.
    • IRCChatModesRequired: What IRC chmodes a user must have one of in order for IRC messages to be relayed.
    • IRCJoinMessageFormat: The format for IRC joins which are relayed to the server. {0} is the nick.
    • IRCKickMessageFormat: The format for IRC kicks which are relayed to the server. {0} is the nick, {1} is the reason.
    • IRCLeaveMessageFormat: The format for IRC leaves (parts) which are relayed to the server. {0} is the nick, {1} is the reason.
    • IRCQuitMessageFormat: The format for IRC quits which are relayed to the server. {0} is the nick, {1} is the reason.
    • ServerActionMessageFormat: The format for server actions which are relayed to the channel. {0} is the name of the player, {1} is the text.
    • ServerCommandMessageFormat: The format for server commands which are relayed to the command-logging channel. {0} is the prefix of the player, {1} is the name of the player, {2} is the command text.
    • ServerChatMessageFormat: The format for server chat which is relayed to the channel. {0} is the prefix of the player, {1} is the name of the player, {2} is the text, {3} is the suffix of the player.
    • ServerJoinMessageFormat: The format for server joins which are relayed to the channel. {0} is the name of the player.
    • ServerJoinAdminMessageFormat: The format for server joins which are relayed to the admin channel. {0} is the name of the player, {1} is the IP.
    • ServerLeaveMessageFormat: The format for server leaves which are relayed to the channel. {0} is the name of the player.
    • ServerLeaveAdminMessageFormat: The format for server leaves which are relayed to the admin channel. {0} is the name of the player, {1} is the IP.
    • ServerLoginAdminMessageFormat: The format for server logins which are relayed to the admin channel. {0} is the name of the player, {1} is the account name, {2} is the IP.
     
  3. Ijwu

    Ijwu Level 11

    Joined:
    Apr 4, 2012
    Messages:
    647
    Nice job! Somebody get this man $20. ; )
     
  4. DarkOS

    DarkOS tShock supporter and programming hack.

    Joined:
    Aug 17, 2011
    Messages:
    849
  5. MarioE

    TShock Admin TShock Mod Plugin Developer

    Joined:
    May 26, 2012
    Messages:
    386
    Hm... for some reason, the IRC bridge's event handlers crap out and decide not to handle any kind of IRC event at some point. I need to figure out why that happens. :/

    In the meantime, use /ircrestart in order to regain control without restarting the server.
     
    • Like Like x 2
  6. Wolfe

    Wolfe Level 9

    Joined:
    Jan 3, 2012
    Messages:
    386
    I really like how you made it so you could login to your server account. Sweet plugin ;)

    Oh, one note:
    You said that {0} is the nick twice.

    One more thing, are the codes between server actions, such as "ServerJoinMessageFormat": "\u000303{0} has joined.", color codes?
     
  7. MarioE

    TShock Admin TShock Mod Plugin Developer

    Joined:
    May 26, 2012
    Messages:
    386
    Yeah, they are color codes.
     
  8. Wolfe

    Wolfe Level 9

    Joined:
    Jan 3, 2012
    Messages:
    386
    Ohhhh, IRC color codes. Now I get it, lol
     
  9. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,597
    Nevermind.
    Was forgetting the execute parameter. >.<
     
  10. Wolfe

    Wolfe Level 9

    Joined:
    Jan 3, 2012
    Messages:
    386
    Two things:

    1. Muted player's text still shows up on IRC. Is this intentional?
    2. Less serious but noteworthy, non-existent commands display on the admin channel. i.e. /gfgfabfadhfhatfcx. This doesn't need a fix or anything since it could be helpful in seeing what commands players are mispelling, just wondering if it's on purpose.
     
  11. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,597
    In terms of stopping IRC just dc'ing randomly, you could make it restart itself hourly or something.
    Alternatively, just encourage people to make AutoBroadcast do that :confused:
     
  12. MarioE

    TShock Admin TShock Mod Plugin Developer

    Joined:
    May 26, 2012
    Messages:
    386
    1. Not intentional, will fix later. Fixed by Colin, whee.
    2. Intentional.

    It's not even DC'ing; what happens is the IRC library somehow gets two people with the same name in the user list (which is absurd) and crashes the event handling. I'd rather just find out why this happens instead of doing a hacky fix...
     
  13. shapi

    shapi Level 0

    Joined:
    Mar 31, 2013
    Messages:
    3
    Can someone tell me how this works? I put the TshockIRC folder in Tshock folder and the other files like .gittatributes, gitignore and tshockirc.sln inside tshock folder, and tshockirc.dll and ircdotnet.dll inside serverplugins folder but nothing seems to work, can someone explain?
     
  14. Olink

    Olink Nyx Developer, Occasional TShock Developer
    Banned

    Joined:
    Jul 21, 2011
    Messages:
    1,397
    lol
     
    • Like Like x 1
  15. shapi

    shapi Level 0

    Joined:
    Mar 31, 2013
    Messages:
    3
    ._.
     
  16. Olink

    Olink Nyx Developer, Occasional TShock Developer
    Banned

    Joined:
    Jul 21, 2011
    Messages:
    1,397
    Why do you think that Source is equivalent to the plugin. Is this the first time you have ever used a tshock plugin? Wouldn't you utilize humanities ability to deduce that all you would need is the dll's linked?
     
  17. Colin

    Colin Level 5

    Joined:
    Nov 25, 2011
    Messages:
    100
    Alright, I'm up for a challenge...

    All you need is for TShockIRC.dll and ircdotnet.dll to be in the ServerPlugins folder. Nothing else. Ignore the Source page.

    When you run the server, a config file will be generated in the tshock folder. It will be named tshockircconfig.json. You need a JSON editor such as Notepad++ to edit it properly. The config options are defined here. You will need an IRC server to connect it to. If you're poor or lazy or host Ryst, you can use a free IRC server such as Mibbit. You need a channel on that server, such as #LameCafe to have the bot join. With everything properly configured, it'll work. Otherwise, you're doing something wrong.
     
    • Like Like x 4
  18. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,597
    Nothing wrong with free stuff :)
    Not everyone tries to leech as much money out of their players as possible
     
  19. shapi

    shapi Level 0

    Joined:
    Mar 31, 2013
    Messages:
    3
    Everything worked fine, Thanks! :)
     
    • Like Like x 1
  20. Wolfe

    Wolfe Level 9

    Joined:
    Jan 3, 2012
    Messages:
    386
    Can I request a variable that shows the player's group's suffix? :)