Raised This Month: $7 Target: $400
 1% 

MatterAMXX: Chat relay between many services [Includes API]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose       
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 10-31-2019 , 18:01   MatterAMXX: Chat relay between many services [Includes API]
Reply With Quote #1


[ALL] MatterAMXX
Author: Gabe Iggy
Version: 1.5

Powered by Matterbridge, MatterAMXX is a plugin for AMXX that allows simple bridging between your game servers, Mattermost, IRC, XMPP, Gitter, Slack, Discord, Telegram, and more.



Description

Using Matterbridge API, this plugin allows you to bridge your game server with a Matterbridge installation, relaying messages from/to a growing number of protocols.

You can also bridge multiple servers together so the players can chat between each one.


Protocols natively supported in Matterbridge
  • Mattermost
  • IRC
  • XMPP
  • Gitter
  • Slack
  • Discord
  • Telegram
  • Rocket.chat
  • Matrix
  • Steam (Bugged for now)
  • Twitch
  • Ssh-chat
  • WhatsApp
  • Zulip
  • Keybase

Tested Protocols
  • Discord
  • Matrix
  • Telegram

Dependencies

This plugin requires the following to work:
Supported Games

This plugin is supposed to be mod agnostic. All official games should work out of the box
  • Half-Life
  • Counter-Strike
  • Condition Zero
  • Opposing Force
  • Ricochet
  • Day of Defeat
  • Team Fortress Classic
  • Deathmatch Classic

Kill feed feature will also work in mods where a proper hamdata.ini table is provided
  • The Specialists
  • Sven Co-op


Tested Games
  • Half-Life
  • Ricochet
  • Sven Co-op
  • The Specialists

Installation Instructions
  • Do not download the .amxx file from here. As the webcompiler lacks the includes needed to generate the plugin correctly.
  • Download all requirements, plus the .sma file.
  • Place include files in the /scripting/includes directory.
  • Compile the plugin and install the newly generated .amxx file. (Remember to install the latest version of GRIP in your server)
  • Copy the matteramxx.txt and matteramxx_old.txt files to the /data/lang directory in your AMXX installation.

Setting up MatterAMXX

This quickstart guide assumes you already have a working Matterbridge installation.

Open your matterbridge.toml file and add the following lines:

Code:
[api.myserver]
BindAddress="0.0.0.0:1337"
Token="verysecrettoken"
Buffer=1000
RemoteNickFormat="{NICK}"
Where "myserver" is goes the name of the relay, you can put anything.

Find your gateway where you want to relay the messages.
Quote:
[[gateway]]
name="cstrike"
enable=true

[[gateway.inout]]
account="discord.mydiscord"
channel="general"

[[gateway.inout]]
account="api.myserver"
channel="api"
Where cstrike is goes the gateway name. By default is the mod's gamedir (cstrike for Counter-Strike, valve for Half-Life, etc) but you can change it using cvars, you can add more gateway.inout entries depending on how many protocols do you want to relay messages.


Avatar Spoofing

It's possible to set up avatars for each user on protocols that support it. Unfortunately, due to limitations of AMXX and the GRIP module, user info from the Steam API can't be retrieved because it gets truncated.

However, you can host this simple PHP script to query for avatars to be used in this plugin, you just need a Steam API Key that you can obtain from the Steam Web API website.

Reveal script


This will also cache each avatar and they will be deleted after a while.

Remember to create the /avatars folder! The script won't do it for you.


API

The API allows other plugins to use MatterAMXX features. Just include the matteramxx.inc file in your plugin and it should work immediately.

Reveal script


Remember that the plugin requires the latest version of MatterAMXX to be running in the server.

Click here to check out the MatterAMXX subplugins.


Click here to check out servers using this plugin.

Console Variables
  • amx_matter_enable
    • Enables the plugin.
    • Default: 1
  • amx_matter_bridge_protocol
    • Protocol of where the bridge is located.
    • Default: "http"
  • amx_matter_bridge_host
    • Host of where the bridge is located.
    • Default: "localhost"
  • amx_matter_bridge_port
    • Port of where the bridge is located.
    • Default: "1337"
  • amx_matter_system_avatar
    • URL pointing to a picture that will be used as avatar image in system messages. (In protocols that support it)
    • Default: [empty string]
  • amx_matter_autogenerate_avatar
    • URL pointing to a picture that will be used as avatar image in unauthenticated player messages. (In protocols that support it)
    • This will mostly affect LAN servers, ID_PENDING cases, cases where Steam might be down and other specific cases.
    • This is generated on the user's nickname, so you must provide a link to Gravatar, Identicons, etc.
    • Default: [empty string]
  • amx_matter_player_avatar
    • URL pointing to a picture that will be used as avatar image in player messages. (In protocols that support it)
    • Note that this is dynamic based on the user's Steam ID64, if it can't be retrieved the message won't have any avatar.
    • Upload the PHP file I provided to your file server and use it in this cvar like "http://localhost/avatars/get_avatar.php?steamid=%s".
    • See "Avatar Spoofing" for more information.
    • Default: [empty string]
  • amx_matter_bridge_gateway
    • Gateway name to connect.
    • Default: [varies, depends on the game]
  • amx_matter_bridge_token
    • String token to authenticate, it's recommended that you set it up, but it will accept any connection by default.
    • Default: [empty string]
  • amx_matter_bridge_incoming
    • Enables incoming messages (protocols to server).
    • Default: 1
  • amx_matter_bridge_incoming_ignore_prefix
    • Messaging matching this in the beggining of the message will be ignored by the plugin.
    • It supports regex.
    • Plugins using the API can still catch these messages.
    • Default: "!"
  • amx_matter_bridge_incoming_dont_colorize
    • By default it will colorize any message with a simple format (green username) but if set to 1 it will not colorize anything, leaving the admin to handle any colorization in the matterbridge.toml file.
    • It will only affect Counter-Strike.
    • Default: 0
  • amx_matter_incoming_update_time
    • Specifies how many seconds it has to wait before querying new incoming messages.
    • Performance wise is tricky, lower values mean the messages will be queried instantly, while higher values will wait and bring all messages at once, both cases may cause overhead. Experiment and see what's ideal for your server.
    • No effect if amx_matter_bridge_incoming is 0.
    • Default: 3.0
  • amx_matter_bridge_outgoing
    • Enables outgoing messages (server to protocols).
    • Default: 1
  • amx_matter_bridge_outgoing_display_map
    • Display the current map at the start of every session.
    • Default: 1
  • amx_matter_bridge_outgoing_strip_colors
    • Strip color codes from player names.
    • It will only affect Half-Life and Adrenaline Gamer.
      • No effect in other games.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: 1
  • amx_matter_bridge_outgoing_system_username
    • Name of the "user" when relying system messages.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: [your server name]
  • amx_matter_bridge_outgoing_chat_mode
    • Select which chat messages you want to send.
      • 1 = All chat
      • 2 = Team chat
    • You must sum the values you want to send. For example, if you want to send everything the value must be 3.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: 3
  • amx_matter_bridge_outgoing_chat_zwsp_at
    • This controls if the plugin should add a ZWSP character after the at symbol (@) to prevent unintentional or malicious pinging.
    • No effect if amx_matter_bridge_outgoing_chat is 0.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: 1
  • amx_matter_bridge_outgoing_chat_no_repeat
    • Implement basic anti-spam filter. Useful for preventing taunt binds from sending multiple times.
    • No effect if amx_matter_bridge_outgoing_chat is 0.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: 1
  • amx_matter_bridge_outgoing_kills
    • Transmit kill feed.
    • It's recommended that you to turn it off on heavy activity servers (Like CSDM/Half-Life servers with tons of players)
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default 1
  • amx_matter_bridge_outgoing_join
    • Transmit when people join the server.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: 1
  • amx_matter_bridge_outgoing_join_delay
    • Specify how many seconds the server has to wait before sending Join messages..
    • No effect if amx_matter_bridge_outgoing_join is 0.
    • Default: 30.0
  • amx_matter_bridge_outgoing_quit
    • Transmit when people leave the server.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: 1
  • amx_matter_bridge_outgoing_quit_ignore_interm ission
    • Specify if the server shouldn't send quit messages if the server reached the intermission state.
    • No effect if amx_matter_bridge_outgoing_quit is 0.
    • Default: 0
  • amx_matter_bridge_outgoing_joinquit_count
    • Display playercount on each Join/Quit message.
    • No effect if both amx_matter_bridge_outgoing_quit and amx_matter_bridge_outgoing_join are 0.
    • Default: 1
  • amx_matter_bridge_retry_delay
    • In seconds, how long the server has wait before retrying a connection when it was interrupted.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: 3.0

Change Log
  • 1.5
    Main Changes
    • Deprecated the usage of amx_matter_bridge_url, users are encouraged to use the new cvars amx_matter_bridge_protocol, amx_matter_bridge_host and amx_matter_bridge_port.
    • The plugin will no longer try to query the incoming protocol, it will now respect the format specified on the matterbridge.toml file.
    • Introduced system messages, a message marked as "system message" won't be printed to other game servers.
    • User's SteamID is now included in the Matterbridge payload.
    • Added cvar amx_matter_bridge_incoming_dont_colorize. Only for Counter-Strike, by default it will colorize any message with a simple format (green username) but if set to 1 it will not colorize anything, leaving the admin to handle any colorization in the matterbridge.toml file.
    • Fixed a lot of errors related to Counter-Strike and rendering text with colors.
    • Removed amx_matter_bridge_outgoing_chat and amx_matter_bridge_outgoing_chat_team cvars, these will now be managed by a single cvar: amx_matter_bridge_outgoing_chat_mode. Add the sum of the desired behavior:
      • Send all chat = 1
      • Send team chat = 2
      If you want to send everything, you must put 3.
    • Added amx_matter_bridge_incoming_ignore_prefix. Useful to ignore bot commands.
    • Server messages now support multi language.
    • Quotes no longer get removed from players' messages.
    • Made Sven Co-op use the alternative language file, the game doesn't support rendering "%" in chat.
    Sub plugin changes

    • API
      • Added support for system messages.
      • matteramxx_print_message now includes the userid field.
      • Plugins now can specify an alternative Matterbridge gateway.
      • matteramxx_send_message is now a native.
    • CONSOLE
      • Console output won't be escaped if amx_matter_rcon_code_block is on.
      • Ignore commands coming from other game servers.
      • It will now use the user id instead of the name for admin checking.
      • Removed support for listip/listid commands, changed error message for a better explanation.
    • LAG CHECKER
      • Fix missing localization strings.
      • Fixed using wrong lag percent formula.
  • 1.4
    • The matteramxx_print_message() forward now includes the user's avatar and protocol.
    • Fixed the Killed Hamsandwich hook in TFC that was not working as it should.
    • Added multilingual support.
      • Many thanks to the language contributors:
        • Romanian: tom .
        • Turkish: Snake.
        • Albanian: thEsp
        • Russian: Natsheh
    • The following console variables are now protected:
      • amx_matter_bridge_token
      • amx_matter_bridge_gateway
      • amx_matter_bridge_url
      • amx_matter_player_avatar
      • amx_matter_autogenerate_avatar
      • amx_matter_system_avatar
    • Added new console variable: amx_matter_bridge_outgoing_chat_zwsp_at
      • This controls if the plugin should add a ZWSP character after the at symbol (@) to prevent unintentional or malicious pinging.
    • Added new console variable: amx_matter_bridge_incoming_chat_protocol
      • This controls if the plugin should add the message protocol in incoming messages.
    • The plugin (and subplugins) now pause when disabled.
    • Code cleanup.
    • New subplugins released to showcase the power of the MatterAMXX Api:
      • MatterAMXX Lagchecker
        • This plugin will notify a configured user if the CPU/FPS increase/fall past/below a defined threshold.
        • This will be triggered if any user says "lag".
        • This will also output the current values to the users notifying them if the server is not lagging.
        • Requires Orpheu and Orpheu Signatures.
      • MatterAMXX RCON
        • This plugin will allow you to control the server's console from any messaging protocol, with full console output.
        • You can configure which users are allowed to send commands to the server console.
        • Requires Orpheu and Orpheu Signatures.
  • 1.3.2
    • Extended buffers to allow more complex messages to be sent/received
    • Leave messages now work in 1.8.2
  • 1.3.1
    • Tried to fix a case where multiple pending messages would cause them to not send due to AMXX limits. Further testing is required
    • Fixed a bug where it would always see any ID as a valid Steam ID
  • 1.3
    • Added new console variable: amx_matter_incoming_update_time
      • Specify how many seconds the server has to wait before querying new messages
    • Decreased default value of amx_matter_bridge_outgoing_join_delay (from 30.0 to 15.0)
    • Fixed a bug where it would not display when a new map has started
    • Added new debug information (requires the plugin to be running on debug mode)
      • Currently it only supports outgoing messages
    • Added new console variable: amx_matter_autogenerate_avatar
      • Allows avatar support for unauthenticated users (LAN, Pending IDs and other uses I won't mention)
      • You need to supply an URL to generate an image from Text, where %s is a URL parsed nickname of the user
    • MatterAMXX will now display the external username in color (only if the game is a version Counter-Strike)
  • 1.2.1
    • Fixed a bug where the attacker and victim were reversed in the non-HamSandwich version.
    • Fixed a bug where the leave message should show the player count before the player actually left.
  • 1.2
    • Added new console variable: amx_matter_bridge_outgoing_join_delay
      • Specify how many seconds the server has to wait before sending Join messages
    • Added new console variable: amx_matter_bridge_outgoing_quit_ignore_interm ission
      • Specify if the server shouldn't send quit messages if the server reached the intermission state
    • Added new console variable: amx_matter_bridge_outgoing_display_map
      • Display the current map at the start of every session
    • Added new console variable: amx_matter_bridge_outgoing_joinquit_count
      • Display playercount on each Join/Quit message
    • Added API support!
      • The API allows other plugins to use MatterAMXX features
      • New stock: matteramxx_send_message
      • New forward: matteramxx_print_message
    • The plugin can now be set up to compile without the HamSandwich module.
    • Adjusted some code, using newer DEFINEs.
  • 1.1
    • Join and Quit messages will only be sent after the user has actually joined the server (putinserver). This will prevent Join/Leave spam.
    • Added new console variable: amx_matter_system_avatar
      • Url pointing to a picture that will be used as avatar image in system messages. (In protocols that support it)
    • Added new console variable: amx_matter_player_avatar
      • Url pointing to a picture that will be used as avatar image in player messages. (In protocols that support it).
      • Note that this is dynamic based on the user's Steam ID64, if it can't be retrieved the message won't have any avatar.
    • Added new console variable: amx_matter_bridge_outgoing_strip_colors
      • Strip color codes from player names.
      • It will only affect Half-Life and Adrenaline Gamer.
    • Added new console variable: amx_matter_bridge_outgoing_chat_no_repeat
      • Implement basic anti-spam filter. Useful for preventing taunt binds from sending multiple times.
    • Minor code cleanup
  • 1.0
    • Initial Release

Credits
  • 42wim
    Main developer of Matterbridge.
  • Michael Wieland
    His MatterBukkit plugin for Minecraft inspired me to create this.
  • Th3-822
    Helped me finding some bugs.
  • tom .
    Romanian translator.
  • Snake.
    Turkish translator.
  • thEsp
    Albanian translator.
  • Natsheh
    Russian translator.
  • MaNa
    Done a lot of testing on his CS1.6 server. The quick release of MatterAMXX 1.5 wouldn't be possible without him.
Attached Files
File Type: zip MatterAMXX-1.5.zip (32.5 KB, 392 views)
__________________

Last edited by gabuch2; 02-23-2021 at 09:46. Reason: New Version Released: 1.5
gabuch2 is online now
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 10-31-2019 , 21:27   Re: MatterAMXX
Reply With Quote #2

So basically, I can register the whatsapp with the server and when someone join or leave the server, a message is sent to the group or person on whatsapp?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 10-31-2019 at 22:04.
EFFx is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 11-01-2019 , 00:02   Re: MatterAMXX
Reply With Quote #3

Quote:
Originally Posted by EFFx View Post
So basically, I can register the whatsapp with the server and when someone join or leave the server, a message is sent to the group or person on whatsapp?
You can relay messages between WhatsApp and the server, yes.
__________________
gabuch2 is online now
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 11-01-2019 , 14:59   Re: MatterAMXX
Reply With Quote #4

Based on feedback a new version was released:
  • 1.1
    • Join and Quit messages will only be sent after the user has actually joined the server (putinserver). This will prevent Join/Leave spam.
    • Added new console variable: amx_matter_system_avatar
      • Url poiting to a picture that will be used as avatar image in system messages. (In protocols that support it)
    • Added new console variable: amx_matter_player_avatar
      • Url poiting to a picture that will be used as avatar image in player messages. (In protocols that support it).
      • Note that this is dynamic based on the user's Steam ID64, if it can't be retrieved the message won't have any avatar.
    • Added new console variable: amx_matter_bridge_outgoing_strip_colors
      • Strip color codes from player names.
      • It will only affect Half-Life and Adrenaline Gamer.
    • Added new console variable: amx_matter_bridge_outgoing_chat_no_repeat
      • Implement basic anti-spam filter. Useful for preventing taunt binds from sending multiple times.
    • Minor code cleanup

It's now possible to set up avatars for each user on protocols that support it. Unfortunately, due to limitations of AMXX and the GRIP module, user info from the Steam API can't be retrieved because it gets truncated.

However, you can host this simple PHP script to query for avatars to be used in this plugin, you just need a Steam API Key that you can obtain from the Steam Web API website.

Visit https://pastebin.com/p9aBm1pS to get the script (Because CloudFlare is blocking the script from being posted here)

This will also cache each avatar and they will be deleted after a while.

Remember to create the /avatars folder! The script won't do it for you.
__________________

Last edited by gabuch2; 11-08-2019 at 13:22.
gabuch2 is online now
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 11-02-2019 , 09:55   Re: MatterAMXX
Reply With Quote #5

Impressive especially for GoldSrc. Formally API like this I thought could only be done via Source. Thanks Iggy!
__________________
DJEarthQuake is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 11-02-2019 , 11:51   Re: MatterAMXX
Reply With Quote #6

amazing, will try this in whatsapp soon, thanks
tarsisd2 is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 11-03-2019 , 11:35   Re: MatterAMXX
Reply With Quote #7

Thanks for the kind comments.

I have the following on the roadmap:
  • Notify admins that a message failed to relay to Matterbridge.
  • Display SteamID (Or IP, if you want) in the user message.
  • A list of messages that will be ignored if typed in the server (Stuff like nextmap, timeleft, etc).
__________________

Last edited by gabuch2; 11-03-2019 at 11:35.
gabuch2 is online now
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 11-03-2019 , 12:20   Re: MatterAMXX
Reply With Quote #8

how can i set up to send notifications about bans on whatsapp, when someone is banned or unbanned?
is it possible?
tarsisd2 is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 11-03-2019 , 15:27   Re: MatterAMXX
Reply With Quote #9

Quote:
Originally Posted by tarsisd2 View Post
how can i set up to send notifications about bans on whatsapp, when someone is banned or unbanned?
is it possible?
It's definitively possible for other plugins to send messages to your protocols (For it, I have to implement a simple API in MatterAMXX).

However, you would still need to edit your plugins to do that.
__________________

Last edited by gabuch2; 11-03-2019 at 15:43.
gabuch2 is online now
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 11-06-2019 , 12:40   Re: MatterAMXX
Reply With Quote #10

Looks like the plugin crashes on Ricochet due to it not having hamdata.ini entries, even if you disable the streaming of kill feed. (The plugin crashes upon detecting it has a Ham function, not when executing it)

Current roadmap:
  • Implement API so other plugins can send messages via MatterAMXX Somewhat done. Need to know why I can't read the incoming message from the other plugin. Sending works fine.
  • Implement simple compile defines to decide if you want to compile with HamSandwich support. (Search another way to detect death of players? Needs to be mod agnostic tho') Done (Using DeathMsg event)
  • Add a list of words that would be ignored when typed in the chat (Stuff like "nextmap", "rtv", etc.)
  • I would also like to add some checks to prevent Join messages on the first N seconds the map started, and Quit messages when we reached the intermission, to further prevent Join/Leave spam. Done
  • Of course add a message when the map changed, should be very easy. Done as well
__________________

Last edited by gabuch2; 11-06-2019 at 23:07.
gabuch2 is online now
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode