From 39c835d8e334501f4decdfcb8a94a28165b32693 Mon Sep 17 00:00:00 2001 From: NikkyAI Date: Mon, 12 Feb 2018 17:41:07 +0100 Subject: [PATCH] add sample and update README --- README.md | 34 ++++- matterbridge-sample.toml | 287 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 314 insertions(+), 7 deletions(-) create mode 100644 matterbridge-sample.toml diff --git a/README.md b/README.md index aa13381..5e30f79 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # MatterLink -matterbridge for MC servers +THIS MOD REQUIRES YOU TO ALSO RUN A MATTERBRIDGE +https://github.com/42wim/matterbridge + +connect matterbridge to MC servers https://github.com/42wim/matterbridge @@ -9,13 +12,13 @@ requires api section to be setup along these lines ``` [api] [api.local] - BindAddress="0.0.0.0:4343" # or listen only to localhost + BindAddress="0.0.0.0:4242" # or listen only to localhost: 127.0.0.1:4242 #Bearer token used for authentication #curl -H "Authorization: Bearer testtoken" http://localhost:4343/api/messages #OPTIONAL (no authorization if token is empty) - Token="testtoken" + Token="mytoken" Buffer=1000 @@ -24,9 +27,26 @@ requires api section to be setup along these lines ShowJoinPart = true ``` -values you need to remember are obviously the IP, port and token -MatterLInk will need them in the configuration - ## Downloads -https://ci.elytradev.com/job/elytra/job/MatterLink/job/master/ \ No newline at end of file +https://github.com/elytra/MatterLink/releases + +https://ci.elytradev.com/job/elytra/job/MatterLink/job/master/ + +## Dependencies + +- forgelin: https://minecraft.curseforge.com/projects/shadowfacts-forgelin + +## Setup + +install matterbridge and try out the basic sample + +``` +go get github.com/42wim/matterbridge +mv matterbridge-sample.toml matterbridge.tom +matterbridge +``` + +now you just need to run matterbridge on the server, the default configuration works with the provided sample + +and then [RTFM!!!](https://github.com/42wim/matterbridge#configuration) \ No newline at end of file diff --git a/matterbridge-sample.toml b/matterbridge-sample.toml new file mode 100644 index 0000000..367a8f2 --- /dev/null +++ b/matterbridge-sample.toml @@ -0,0 +1,287 @@ +#This is configuration for matterbridge. +#WARNING: as this file contains credentials, be sure to set correct file permissions +################################################################### +#IRC section +################################################################### +#REQUIRED to start IRC section +[irc] + +#You can configure multiple servers "[irc.name]" or "[irc.name2]" +#In this example we use [irc.freenode] +#REQUIRED +[irc.freenode] +#irc server to connect to. +#REQUIRED +Server="irc.esper.net:6697" + +#Password for irc server (if necessary) +#OPTIONAL (default "") +Password="" + +#Enable to use TLS connection to your irc server. +#OPTIONAL (default false) +UseTLS=true + +#Enable SASL (PLAIN) authentication. (freenode requires this from eg AWS hosts) +#It uses NickServNick and NickServPassword as login and password +#OPTIONAL (default false) +UseSASL=false + +#Enable to not verify the certificate on your irc server. i +#e.g. when using selfsigned certificates +#OPTIONAL (default false) +SkipTLSVerify=true + +#If you know your charset, you can specify it manually. +#Otherwise it tries to detect this automatically. Select one below +# "iso-8859-2:1987", "iso-8859-9:1989", "866", "latin9", "iso-8859-10:1992", "iso-ir-109", "hebrew", +# "cp932", "iso-8859-15", "cp437", "utf-16be", "iso-8859-3:1988", "windows-1251", "utf16", "latin6", +# "latin3", "iso-8859-1:1987", "iso-8859-9", "utf-16le", "big5", "cp819", "asmo-708", "utf-8", +# "ibm437", "iso-ir-157", "iso-ir-144", "latin4", "850", "iso-8859-5", "iso-8859-5:1988", "l3", +# "windows-31j", "utf8", "iso-8859-3", "437", "greek", "iso-8859-8", "l6", "l9-iso-8859-15", +# "iso-8859-2", "latin2", "iso-ir-100", "iso-8859-6", "arabic", "iso-ir-148", "us-ascii", "x-sjis", +# "utf16be", "iso-8859-8:1988", "utf16le", "l4", "utf-16", "iso-ir-138", "iso-8859-7", "iso-8859-7:1987", +# "windows-1252", "l2", "koi8-r", "iso8859-1", "latin1", "ecma-114", "iso-ir-110", "elot-928", +# "iso-ir-126", "iso-8859-1", "iso-ir-127", "cp850", "cyrillic", "greek8", "windows-1250", "iso-latin-1", +# "l5", "ibm866", "cp866", "ms-kanji", "ibm850", "ecma-118", "iso-ir-101", "ibm819", "l1", "iso-8859-6:1987", +# "latin5", "ascii", "sjis", "iso-8859-10", "iso-8859-4", "iso-8859-4:1988", "shift-jis +# The select charset will be converted to utf-8 when sent to other bridges. +#OPTIONAL (default "") +Charset="" + +#Your nick on irc. +#REQUIRED +Nick="matterbot" + +#If you registered your bot with a service like Nickserv on freenode. +#Also being used when UseSASL=true +# +#Note: if you want do to quakenet auth, set NickServNick="Q@CServe.quakenet.org" +#OPTIONAL +NickServNick="nickserv" +NickServPassword="secret" + +#OPTIONAL only used for quakenet auth +NickServUsername="username" + +#Flood control +#Delay in milliseconds between each message send to the IRC server +#OPTIONAL (default 1300) +MessageDelay=1300 + +#Maximum amount of messages to hold in queue. If queue is full +#messages will be dropped. +# will be add to the message that fills the queue. +#OPTIONAL (default 30) +MessageQueue=30 + +#Maximum length of message sent to irc server. If it exceeds +# will be add to the message. +#OPTIONAL (default 400) +MessageLength=400 + +#Split messages on MessageLength instead of showing the +#WARNING: this could lead to flooding +#OPTIONAL (default false) +MessageSplit=false + +#Delay in seconds to rejoin a channel when kicked +#OPTIONAL (default 0) +RejoinDelay=0 + +#Nicks you want to ignore. +#Messages from those users will not be sent to other bridges. +#OPTIONAL +IgnoreNicks="ircspammer1 ircspammer2" + +#Messages you want to ignore. +#Messages matching these regexp will be ignored and not sent to other bridges +#See https://regex-golang.appspot.com/assets/html/index.html for more regex info +#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword +IgnoreMessages="^~~ badword" + +#messages you want to replace. +#it replaces outgoing messages from the bridge. +#so you need to place it by the sending bridge definition. +#regular expressions supported +#some examples: +#this replaces cat => dog and sleep => awake +#replacemessages=[ ["cat","dog"], ["sleep","awake"] ] +#this replaces every number with number. 123 => numbernumbernumber +#replacemessages=[ ["[0-9]","number"] ] +#optional (default empty) +ReplaceMessages=[ ["cat","dog"] ] + +#nicks you want to replace. +#see replacemessages for syntaxa +#optional (default empty) +ReplaceNicks=[ ["user--","user"] ] + +#RemoteNickFormat defines how remote users appear on this bridge +#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username. +#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge +#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge +#The string "{NOPINGNICK}" (case sensitive) will be replaced by the actual nick / username, but with a ZWSP inside the nick, so the irc user with the same nick won't get pinged. See https://github.com/42wim/matterbridge/issues/175 for more information +#OPTIONAL (default empty) +RemoteNickFormat="[{PROTOCOL}.{BRIDGE}] <{NOPINGNICK}> " + +#Enable to show users joins/parts from other bridges +#Currently works for messages from the following bridges: irc, mattermost, slack +#OPTIONAL (default false) +ShowJoinPart=false + +#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285 +#It will strip other characters from the nick +#OPTIONAL (default false) +StripNick=false + +#Enable to show topic changes from other bridges +#Only works hiding/show topic changes from slack bridge for now +#OPTIONAL (default false) +ShowTopicChange=false + +################################################################### +#API +################################################################### +[api] +#You can configure multiple API hooks +#In this example we use [api.minecraft] +#REQUIRED + +[api.minecraft] +#Address to listen on for API +#REQUIRED +BindAddress="127.0.0.1:4242" + +#Amount of messages to keep in memory +Buffer=1000 + +#Bearer token used for authentication +#curl -H "Authorization: Bearer token" http://localhost:4242/api/messages +#OPTIONAL (no authorization if token is empty) +Token="" + +#RemoteNickFormat defines how remote users appear on this bridge +#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username. +#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge +#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge +#OPTIONAL (default empty) +RemoteNickFormat="{NICK}" + + + +################################################################### +#General configuration +################################################################### +# Settings here are defaults that each protocol can override +[general] +#RemoteNickFormat defines how remote users appear on this bridge +#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username. +#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge +#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge +#OPTIONAL (default empty) +RemoteNickFormat="[{PROTOCOL}] <{NICK}> " + +#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285 +#It will strip other characters from the nick +#OPTIONAL (default false) +StripNick=false + + +#MediaServerUpload and MediaServerDownload are used for uploading images/files/video to +#a remote "mediaserver" (a webserver like caddy for example). +#When configured images/files uploaded on bridges like mattermost,slack, telegram will be downloaded +#and uploaded again to MediaServerUpload URL +#The MediaServerDownload will be used so that bridges without native uploading support: +#gitter, irc and xmpp will be shown links to the files on MediaServerDownload +# +#More information https://github.com/42wim/matterbridge/wiki/Mediaserver-setup-%5Badvanced%5D +#OPTIONAL (default empty) +MediaServerUpload="https://user:pass@yourserver.com/upload" +#OPTIONAL (default empty) +MediaServerDownload="https://youserver.com/download" + +#MediaDownloadSize is the maximum size of attachments, videos, images +#matterbridge will download and upload this file to bridges that also support uploading files. +#eg downloading from slack to upload it to mattermost +# +#It will only download from bridges that don't have public links available, which are for the moment +#slack, telegram, matrix and mattermost +# +#Optional (default 1000000 (1 megabyte)) +MediaDownloadSize=1000000 + +################################################################### +#Gateway configuration +################################################################### + +#You can specify multiple gateways using [[gateway]] +#Each gateway has a [[gateway.in]] and a [[gateway.out]] +#[[gateway.in]] specifies the account and channels we will receive messages from. +#[[gateway.out]] specifies the account and channels we will send the messages +#from [[gateway.in]] to. +# +#Most of the time [[gateway.in]] and [[gateway.out]] are the same if you +#want bidirectional bridging. You can then use [[gateway.inout]] +# + +[[gateway]] +#REQUIRED and UNIQUE +name="minecraft" +#Enable enables this gateway +##OPTIONAL (default false) +enable=true + + #API example + [[gateway.inout]] + account="api.minecraft" + channel="api" + #To send data to the api: + #curl -XPOST -H 'Content-Type: application/json' -d '{"text":"test","username":"randomuser","gateway":"gateway1"}' http://localhost:4242/api/message + #To read from the api: + #curl http://localhost:4242/api/messages + + + #[[gateway.in]] specifies the account and channels we will receive messages from. + #The following example bridges between mattermost and irc + [[gateway.in]] + account="irc.freenode" + channel="#matterlink" + +# #OPTIONAL - only used for IRC protocol at the moment +# [gateway.in.options] +# #OPTIONAL - your irc channel key +# key="yourkey" + + + #[[gateway.inout]] can be used when then channel will be used to receive from + #and send messages to + [[gateway.inout]] + account="irc.freenode" + channel="#matterlink-testing" + +# #OPTIONAL - only used for IRC protocol at the moment +# [gateway.out.options] +# #OPTIONAL - your irc channel key +# key="yourkey" + +# [[gateway.inout]] +# account="discord.game" +# channel="mygreatgame" +# +# #OPTIONAL - webhookurl only works for discord (it needs a different URL for each cahnnel) +# [gateway.inout.options] +# webhookurl=""https://discordapp.com/api/webhooks/123456789123456789/C9WPqExYWONPDZabcdef-def1434FGFjstasJX9pYht73y" + + + +##If you want to do a 1:1 mapping between protocols where the channelnames are the same +##e.g. slack and mattermost you can use the samechannelgateway configuration +##the example configuration below send messages from channel testing on mattermost to +##channel testing on slack and vice versa. (and for the channel testing2 and testing3) +# +#[[samechannelgateway]] +# name="samechannel1" +# enable = false +# accounts = [ "mattermost.work","slack.hobby" ] +# channels = [ "testing","testing2","testing3"] \ No newline at end of file