new role: matrix-bridge-discord, WIP
This commit is contained in:
parent
45805e1ed0
commit
712526a714
6 changed files with 209 additions and 43 deletions
|
@ -3,6 +3,7 @@
|
|||
- hosts: matrix
|
||||
roles:
|
||||
- synapse
|
||||
- matrix-bridge-discord
|
||||
|
||||
- hosts: proxy
|
||||
roles:
|
||||
|
|
|
@ -7,5 +7,11 @@ matrix_max_upload_size: 50M
|
|||
matrix_registration_shared_secret: "{{ vault_matrix_registration_shared_secret }}"
|
||||
matrix_macaroon_secret: "{{ vault_matrix_macaroon_secret }}"
|
||||
matrix_form_secret: "{{ vault_matrix_form_secret }}"
|
||||
|
||||
# bridge discord
|
||||
matrix_bridge_discord_postgre_user_pwd: "{{ vault_matrix_bridge_discord_postgre_user_pwd }}"
|
||||
matrix_bridge_discord_client_ID: "{{ vault_matrix_bridge_discord_client_ID }}"
|
||||
matrix_bridge_discord_botToken: "{{ vault_matrix_bridge_discord_botToken }}"
|
||||
|
||||
# Not configured for now
|
||||
matrix_stats_endpoint: https://127.0.0.1/report-usage-stats/push
|
||||
|
|
|
@ -1,44 +1,58 @@
|
|||
$ANSIBLE_VAULT;1.1;AES256
|
||||
37373265323830336539343466626635393530636533643539653062313231633463313066313264
|
||||
6138653863353230353462316565613863316539646235630a393161393833616131623961383837
|
||||
65336634343837663637383435323531393163633561386665643435356639383133353039663434
|
||||
6631633130333531310a663237356464376361663061643432333239323563616136633233343737
|
||||
65656633613663373430643533383733656230376430633631346361383162633661386535343566
|
||||
33626334323036326234306135336339393435353963396631356638393837623239346665343062
|
||||
36376631653534366638636235623433663661386134366338613736643663663335313536613631
|
||||
36383862383637363735363635613861626533373638306538663062343636613465653231653037
|
||||
31363239653634303565626661346435363830366135303462316461343331653239323139323533
|
||||
61373961646439393933363236316430353038616630383864633863336435363163306332646435
|
||||
66383432393336666166323330303636356339656332323330646330316561373561363234646233
|
||||
63656534643238653962353033393365613165356464633162343430666330396665316330343061
|
||||
61383936333166313432323433386664663166323463343634363162626534316432393563363837
|
||||
62653630356266636437626266623138383664316233333431626565363531633661376136653238
|
||||
61313564376161656163623264646665623736366238626437656432376634396639613161316133
|
||||
63363064643534616536316234376563353934343865636161373835353738396164303635313263
|
||||
37356434656566653035306435666364373336313263313262336531323839346232316137333666
|
||||
61663132363762363838333862646530366636383163353762613238313135343936313330353537
|
||||
33623865386333646662316365306233643538623132346630616235393766623338323664333965
|
||||
30396363316634393636356363323333666233343661653534646366393638333830333838626339
|
||||
37333037346263353264356232333632616431663930633432396264336565373839373630336438
|
||||
32636166326663313337316433313835643833396636336362613462653863646339333439316238
|
||||
32653066363864393464343938316430343930303238396366643039613537373935646333343334
|
||||
35626631613466643863313362326166393164313263333261326661353234346361626163663564
|
||||
35623939343936653163636563353138376463363635643830326262323062633062303832666364
|
||||
64656466366532346139373463616433393665363266393934653232326164626131333566383331
|
||||
34316265376633323164366538386562393630666465376531383137353038386436363333623565
|
||||
32333136643733333730663832393264633636323264306131346334333631373865643365613066
|
||||
37623935653432356164336238363562646134393365363765386465366530343137386434343130
|
||||
66346263623266623333663661353963623365303532386437366537616636336165373366376432
|
||||
37373232616163363930646136383565316339653863386162303132323937373933346136313532
|
||||
63646663616332663932303461343563653461396138303336386539326533383634373362326137
|
||||
31366263656361313232616134616134666236393464666564326566313130643132333065393564
|
||||
35356663363164333233656363373739643165336666623966313537393563633239353433353038
|
||||
63636632356464356261383631356432383633336661323835396236323063613335363231646636
|
||||
36653532646335643765303232373464336363323038373464363663623664643966306566333138
|
||||
63373961343138616465323939323536343566613837366434376632356464396362333638303532
|
||||
30643838613366313434313166356565353665323766356365353435333131636465393437656134
|
||||
61383931326562363265363466333564636562393961316562623866623138313438633839626230
|
||||
61366132636463623262356239346335616538313830653962643334343236303263313163666633
|
||||
30623465656563636533336635366135653534663436656664343231373037363939663139303033
|
||||
65633561633666356464306232613736303934373436663462396134323537666666383538633865
|
||||
623261313237666336313932386530333062
|
||||
38323561616438323163306435633733383133393164336663356136346230356334663338343035
|
||||
3230323232346236623061396665623866393561303037620a656266373162393535363333316131
|
||||
62663765383565373832393039396161626164666664333964666337306366353031313031643566
|
||||
6366343430663833380a616334353964323466313332343833313534353266316131613232303262
|
||||
38656239303037306432316562633137613839646636386135393835323231643731366565336537
|
||||
36326539666432383034636439636235386631313764653832366234326562306235393364623736
|
||||
63633463616537343634306536383734343062653938623236653162633731393238323934336663
|
||||
62613866313436653739383461623665646436383439343738613063383432653362306435306365
|
||||
64303461366666646264636266336435323364323738663462393034356538316431656261303265
|
||||
66623964316365383662333461633134323737316462353465326539303633623531616435633333
|
||||
66613465393563386536393637393630333830376136353362346637643961326266653236623536
|
||||
38353664643838363532366166376561323538306263353838356363393336363530396563643632
|
||||
39356534303365386362366361646236316231633031643662613434663536333666396132386531
|
||||
65613233396635613765633961303032366265626138366464353832393163366663316131646339
|
||||
32633962663035383165633966643137303534626464396238323633633838323134363234376231
|
||||
36303231313733303236646562386530383461323238333730313233353362393535313330356231
|
||||
33363561636362323033363839323531316263616333306639356263663862353165363936373966
|
||||
31326136656664376433306633656531396265353631386565646633646266343531373463316362
|
||||
63366132636165633337333235616132373838333031313332623361373534303762373864363161
|
||||
35383132353939393265613435396137376539363334656637343362336630636362343035633436
|
||||
61666139613165623531616464633433636134366533623931396665393664366531353332323938
|
||||
31303761333137636162336438633166363662396437613963376635306365323730663365636662
|
||||
61613561346633326336353539643966666565396633306533633739663462636138643131313062
|
||||
35323931306265383234313630623534336332653766366236323732636534323661393739313965
|
||||
62643938656261616439666531313764373230353934343363643061353335663463396637356433
|
||||
36613534653035363035646234326234663136386365643131613930663935366435303166666465
|
||||
66343664363733656632363833626435346331636465336464346164303839626639613335643831
|
||||
30623865613165373834323162656534653830393433363461613763363962376666333962386163
|
||||
32633264636233373035356635313934303836636232636262333161336339643661646130363231
|
||||
35303235303866663538396337316435623032373731646239303630316336633465373837333731
|
||||
64623265623062613438383036376464656133363062623666303230333932666234613532386538
|
||||
34353334616562633539663262363231346164326563306432643935653566363534356363636537
|
||||
35656632643636666334363337363162333165396164393537326532613964336665643862373436
|
||||
38623938646264653335613262643738366661383038656332626434643365303232663935303633
|
||||
33313631633136346530323033323832653330366132333661383562646532393234303336396434
|
||||
36646361653033326566623630623536316264626635306236343262323837366362346139303234
|
||||
34353630396436653332646630613535653065306265666237353937303265613939643437633064
|
||||
35353334653464383134373531376138323634643535306135353830386661353636323561663364
|
||||
63353566313161326635313966333033353832616131323863633635633935373061313232363431
|
||||
66383436336561333136616662356438346237346536383663393839633437313430363064363030
|
||||
36343833333836626430643136623639613461383433313230623262646439373434313065616339
|
||||
64656536376463396138356137666134363063333463313335356439633765323664313835653137
|
||||
31626365373339663937663364363231346165653337343966383135613862346530383434613738
|
||||
64323933313561383662666639613662366338613335393035626131363530393839383130663533
|
||||
37383331643935633366313064653735363738363336626537643032313934353566356234376239
|
||||
38666665336662383534396662616461373130616538376137306233306230646262376132656234
|
||||
65666366336137343839613166653966626130663863383532386161346366643866653534376539
|
||||
35333733333734666233356461376532336663396532643864373431663935356162656134343839
|
||||
31346139363363656631623439303833373935383634316432333934623062626332333764373137
|
||||
62363863366338396465333337646637646662333434363666646139623261616433323832386339
|
||||
31326262336338633166643530663861353033356266663763613866343632653934633165643163
|
||||
30633134396166343461373030333736346438646631353639336430383063633531623664396430
|
||||
38353032643935316536326632303566366334383036313330336462306166373136323134316530
|
||||
38353832313439633939663335316661383930376133663137383866363838663732646234393935
|
||||
38633961333438363830653138313031633338303232386337393534386531653263666266643830
|
||||
38346635643734353266346565386165626566653730663837353136396266663261356166373365
|
||||
32336139383935623664326232636635393439313166343635393431363538393038
|
||||
|
|
1
roles/matrix-bridge-discord/handlers/main.yml
Normal file
1
roles/matrix-bridge-discord/handlers/main.yml
Normal file
|
@ -0,0 +1 @@
|
|||
---
|
28
roles/matrix-bridge-discord/tasks/main.yml
Normal file
28
roles/matrix-bridge-discord/tasks/main.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
|
||||
- name: Setup postgres
|
||||
include_role:
|
||||
name: postgre
|
||||
vars:
|
||||
postgres_users:
|
||||
- name: bridge_discor_user
|
||||
password: "{{ matrix_bridge_discor_postgre_user_pwd }}"
|
||||
databases:
|
||||
- name: bridge_discord
|
||||
owner: bridge_discor_user
|
||||
local: C
|
||||
template: template0
|
||||
|
||||
- name: Install dependencies
|
||||
apt:
|
||||
name:
|
||||
- npm
|
||||
- git
|
||||
- pgloader
|
||||
state: latest
|
||||
update_cache: true
|
||||
register: apt_result
|
||||
retries: 3
|
||||
until: apt_result is succeeded
|
||||
|
||||
|
116
roles/matrix-bridge-discord/templates/config.yaml
Normal file
116
roles/matrix-bridge-discord/templates/config.yaml
Normal file
|
@ -0,0 +1,116 @@
|
|||
# This is a sample of the config file showing all available options.
|
||||
# Where possible we have documented what they do, and all values are the
|
||||
# default values.
|
||||
|
||||
bridge:
|
||||
# Domain part of the bridge, e.g. matrix.org
|
||||
domain: "{{ matrix_server_name }}"
|
||||
# This should be your publicly-facing URL because Discord may use it to
|
||||
# fetch media from the media store.
|
||||
homeserverUrl: "https://{{ matrix_server_name }}"
|
||||
# The TCP port on which the appservice runs on.
|
||||
port: 9005
|
||||
# Interval at which to process users in the 'presence queue'. If you have
|
||||
# 5 users, one user will be processed every 500 milliseconds according to the
|
||||
# value below. This has a minimum value of 250.
|
||||
# WARNING: This has a high chance of spamming the homeserver with presence
|
||||
# updates since it will send one each time somebody changes state or is online.
|
||||
presenceInterval: 500
|
||||
# Disable setting presence for 'ghost users' which means Discord users on Matrix
|
||||
# will not be shown as away or online.
|
||||
disablePresence: false
|
||||
# Disable sending typing notifications when somebody on Discord types.
|
||||
disableTypingNotifications: false
|
||||
# Disable deleting messages on Discord if a message is redacted on Matrix.
|
||||
disableDeletionForwarding: false
|
||||
# Disable portal bridging, where Matrix users can search for unbridged Discord
|
||||
# rooms on their Matrix server.
|
||||
disablePortalBridging: false
|
||||
# Enable users to bridge rooms using !discord commands. See
|
||||
# https://t2bot.io/discord for instructions.
|
||||
enableSelfServiceBridging: false
|
||||
# Disable sending of read receipts for Matrix events which have been
|
||||
# successfully bridged to Discord.
|
||||
disableReadReceipts: false
|
||||
# Disable Join Leave echos from matrix
|
||||
disableJoinLeaveNotifications: false
|
||||
# Disable Invite echos from matrix
|
||||
disableInviteNotifications: false
|
||||
# Auto-determine the language of code blocks (this can be CPU-intensive)
|
||||
determineCodeLanguage: false
|
||||
# Authentication configuration for the discord bot.
|
||||
auth:
|
||||
# This MUST be a string (wrapped in quotes)
|
||||
clientID: "{{ matrix_bridge_discord_client_ID }}"
|
||||
botToken: "{{ matrix_bridge_discord_botToken }}"
|
||||
# You must enable "Privileged Gateway Intents" in your bot settings on discord.com (e.g. https://discord.com/developers/applications/12345/bot)
|
||||
# for this to work
|
||||
usePrivilegedIntents: true
|
||||
logging:
|
||||
# What level should the logger output to the console at.
|
||||
console: "warn" #silly, verbose, info, http, warn, error, silent
|
||||
lineDateFormat: "MMM-D HH:mm:ss.SSS" # This is in moment.js format
|
||||
files:
|
||||
- file: "debug.log"
|
||||
disable:
|
||||
- "PresenceHandler" # Will not capture presence logging
|
||||
- file: "warn.log" # Will capture warnings
|
||||
level: "warn"
|
||||
- file: "botlogs.log" # Will capture logs from DiscordBot
|
||||
level: "info"
|
||||
enable:
|
||||
- "DiscordBot"
|
||||
database:
|
||||
# You may either use SQLite or Postgresql for the bridge database, which contains
|
||||
# important mappings for events and user puppeting configurations.
|
||||
# Use the filename option for SQLite, or connString for Postgresql.
|
||||
# If you are migrating, see https://github.com/Half-Shot/matrix-appservice-discord/blob/master/docs/howto.md#migrate-to-postgres-from-sqlite
|
||||
# WARNING: You will almost certainly be fine with sqlite unless your bridge
|
||||
# is in heavy demand and you suffer from IO slowness.
|
||||
# filename: "discord.db"
|
||||
connString: "postgresql://bridge_discor_user:{{ matrix_bridge_discord_postgre_user_pwd }}@localhost/bridge_discord"
|
||||
room:
|
||||
# Set the default visibility of alias rooms, defaults to "public".
|
||||
# One of: "public", "private"
|
||||
defaultVisibility: "private"
|
||||
channel:
|
||||
# Pattern of the name given to bridged rooms.
|
||||
# Can use :guild for the guild name and :name for the channel name.
|
||||
namePattern: "[Discord] :guild :name"
|
||||
# Changes made to rooms when a channel is deleted.
|
||||
deleteOptions:
|
||||
# Prefix the room name with a string.
|
||||
#namePrefix: "[Deleted]"
|
||||
# Prefix the room topic with a string.
|
||||
#topicPrefix: "This room has been deleted"
|
||||
# Disable people from talking in the room by raising the event PL to 50
|
||||
disableMessaging: false
|
||||
# Remove the discord alias from the room.
|
||||
unsetRoomAlias: true
|
||||
# Remove the room from the directory.
|
||||
unlistFromDirectory: true
|
||||
# Set the room to be unavailable for joining without an invite.
|
||||
setInviteOnly: true
|
||||
# Make all the discord users leave the room.
|
||||
ghostsLeave: true
|
||||
limits:
|
||||
# Delay in milliseconds between discord users joining a room.
|
||||
roomGhostJoinDelay: 6000
|
||||
# Lock timeout in milliseconds before sending messages to discord to avoid
|
||||
# echos. Default is rather high as the lock will most likely time out
|
||||
# before anyways.
|
||||
# echos = (Copies of a sent message may arrive from discord before we've
|
||||
# fininished handling it, causing us to echo it back to the room)
|
||||
discordSendDelay: 1500
|
||||
# Set a maximum of rooms to be bridged.
|
||||
# roomCount: 20
|
||||
ghosts:
|
||||
# Pattern for the ghosts nick, available is :nick, :username, :tag and :id
|
||||
nickPattern: ":nick"
|
||||
# Pattern for the ghosts username, available is :username, :tag and :id
|
||||
usernamePattern: ":username#:tag"
|
||||
# Prometheus-compatible metrics endpoint
|
||||
metrics:
|
||||
enable: false
|
||||
port: 9001
|
||||
host: "127.0.0.1"
|
Loading…
Reference in a new issue