Raised This Month: $342 Target: $400
 85%   Almost there!

MatterAMXX: Chat relay between many services [Includes API]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose       
Gabe Iggy
Veteran Member
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.4

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.


Console Variables
  • amx_matter_enable
    • Enables the plugin.
    • Default: 1
  • amx_matter_bridge_url
    • URL and port where the bridge is located.
    • Default: "http://localhost: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_chat_protocol
    • This controls if the plugin should add the message protocol in incoming messages.
    • No effect if amx_matter_bridge_incoming is 0.
    • This accepts 3 values:
      • 0
        • Disables the feature
      • 1
        • Displays the raw protocol
      • 2
        • Displays the user defined label
    • 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
    • Transmit chat messages.
    • No effect if amx_matter_bridge_outgoing is 0.
    • Default: 1
  • 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.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.
Attached Files
File Type: sma Get Plugin or Get Source (matteramxx.sma - 48 views - 25.0 KB)
File Type: inc matteramxx.inc (1.3 KB, 29 views)
File Type: txt matteramxx.txt (6.2 KB, 34 views)
File Type: txt matteramxx_old.txt (466 Bytes, 26 views)
__________________

Last edited by Gabe Iggy; 07-29-2020 at 18:56. Reason: New Version Released: 1.3.2
Gabe Iggy is offline
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?
__________________

Last edited by EFFx; 10-31-2019 at 22:04.
EFFx is offline
Send a message via Skype™ to EFFx
Gabe Iggy
Veteran Member
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.
__________________
Gabe Iggy is offline
Gabe Iggy
Veteran Member
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 Gabe Iggy; 11-08-2019 at 13:22.
Gabe Iggy is offline
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!
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty — a beauty cold and austere, like that of sculpture..." -Bertrand Russell
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
Gabe Iggy
Veteran Member
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 Gabe Iggy; 11-03-2019 at 11:35.
Gabe Iggy is offline
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
Gabe Iggy
Veteran Member
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 Gabe Iggy; 11-03-2019 at 15:43.
Gabe Iggy is offline
Gabe Iggy
Veteran Member
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 Gabe Iggy; 11-06-2019 at 23:07.
Gabe Iggy is offline
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 10:35.


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