Move to mautrix
This commit is contained in:
65
README.md
65
README.md
@@ -1,59 +1,18 @@
|
|||||||
# mautrix-discord
|
# mautrix-discord
|
||||||
|
A Matrix-Discord puppeting bridge based on [discordgo](https://github.com/bwmarrin/discordgo).
|
||||||
|
|
||||||
## Getting Started
|
## Documentation
|
||||||
|
All setup and usage instructions are located on [docs.mau.fi]. Some quick links:
|
||||||
|
|
||||||
To get start with this bridge you first need to create the configuration file.
|
[docs.mau.fi]: https://docs.mau.fi/bridges/go/discord/index.html
|
||||||
You can do that by running `./discord generate-config`. By default this will
|
|
||||||
output to `config.yaml`. Edit this file as necessary.
|
|
||||||
|
|
||||||
Once you're done with the configuration file you need to generate the
|
* [Bridge setup](https://docs.mau.fi/bridges/go/setup.html?bridge=discord)
|
||||||
registration for the Synapse. To do so run `./discord generate-registration`.
|
(or [with Docker](https://docs.mau.fi/bridges/general/docker-setup.html?bridge=discord))
|
||||||
This command will update your configuration file as well where necessary.
|
* Basic usage: [Authentication](https://docs.mau.fi/bridges/go/discord/authentication.html)
|
||||||
|
|
||||||
Now that you have a registration file, be sure to add it to the
|
### Features & Roadmap
|
||||||
`app_service_config_files` in the `homeserver.yaml` file of your Synapse
|
[ROADMAP.md](https://github.com/mautrix/discord/blob/master/ROADMAP.md)
|
||||||
install. Once you've done this, make sure to reload or restart Synapse.
|
contains a general overview of what is supported by the bridge.
|
||||||
|
|
||||||
You are no ready to start the bridge with `./discord`
|
## Discussion
|
||||||
|
Matrix room: [#discord:maunium.net](https://matrix.to/#/#discord:maunium.net)
|
||||||
From the Matrix client of your choice, create a direct message with
|
|
||||||
`@discordbot:localhost` adjusting if you changed these settings in the config.
|
|
||||||
This will be your management room with the bot.
|
|
||||||
|
|
||||||
From the management room you can now login to Discord with the `login` command.
|
|
||||||
This will present you with a QRCode that you can scan with the Discord mobile
|
|
||||||
application to login. For more detailed instructions, see the
|
|
||||||
[official documentation](https://support.discord.com/hc/en-us/articles/360039213771-QR-Code-Login-FAQ).
|
|
||||||
|
|
||||||
You should now be able to send an receive direct messages from both one on ones
|
|
||||||
and group dms. However you can't currently create the dm, so you'll have to be
|
|
||||||
invited while the bridge is running.
|
|
||||||
|
|
||||||
## Status
|
|
||||||
|
|
||||||
Complete:
|
|
||||||
|
|
||||||
* Login via QRCode
|
|
||||||
* Message sending for DMs and Group DMs
|
|
||||||
* Message editing for text bodies only (see notes about attachments below)
|
|
||||||
* Unicode standard reactions (add/remove)
|
|
||||||
* Message deleting
|
|
||||||
* Username formatting
|
|
||||||
* User avatars
|
|
||||||
|
|
||||||
Bugged:
|
|
||||||
|
|
||||||
* Changing the room title of a group dm in discord is sent as a message.
|
|
||||||
|
|
||||||
Incomplete:
|
|
||||||
|
|
||||||
* Attachments; most details including the database layout and database api are done.
|
|
||||||
|
|
||||||
Not started:
|
|
||||||
|
|
||||||
* Double Puppeting
|
|
||||||
* Enumerating DM list
|
|
||||||
* Mentions needs to be parsed, they currently show up as `<@!<userid>` in the message body.
|
|
||||||
* Custom emoji are not yet implemented. In message emoji show up as `<:text:id>`.
|
|
||||||
* Custom emoji reactions are not yet implemented.
|
|
||||||
* Additional bot commands like logout
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import (
|
|||||||
"maunium.net/go/mautrix/appservice"
|
"maunium.net/go/mautrix/appservice"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/config"
|
"go.mau.fi/mautrix-discord/config"
|
||||||
"gitlab.com/beeper/discord/database"
|
"go.mau.fi/mautrix-discord/database"
|
||||||
"gitlab.com/beeper/discord/version"
|
"go.mau.fi/mautrix-discord/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import (
|
|||||||
"maunium.net/go/mautrix/format"
|
"maunium.net/go/mautrix/format"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/consts"
|
"go.mau.fi/mautrix-discord/consts"
|
||||||
"gitlab.com/beeper/discord/remoteauth"
|
"go.mau.fi/mautrix-discord/remoteauth"
|
||||||
"gitlab.com/beeper/discord/version"
|
"go.mau.fi/mautrix-discord/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
type globals struct {
|
type globals struct {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"maunium.net/go/mautrix/event"
|
"maunium.net/go/mautrix/event"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/database"
|
"go.mau.fi/mautrix-discord/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
type portalDiscordMessage struct {
|
type portalDiscordMessage struct {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
|
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/remoteauth"
|
"go.mau.fi/mautrix-discord/remoteauth"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"maunium.net/go/mautrix/appservice"
|
"maunium.net/go/mautrix/appservice"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/database"
|
"go.mau.fi/mautrix-discord/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Puppet struct {
|
type Puppet struct {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"maunium.net/go/mautrix/event"
|
"maunium.net/go/mautrix/event"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/database"
|
"go.mau.fi/mautrix-discord/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/globals"
|
"go.mau.fi/mautrix-discord/globals"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cmd struct {
|
type Cmd struct {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package config
|
|||||||
import (
|
import (
|
||||||
log "maunium.net/go/maulogger/v2"
|
log "maunium.net/go/maulogger/v2"
|
||||||
|
|
||||||
db "gitlab.com/beeper/discord/database"
|
db "go.mau.fi/mautrix-discord/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
type database struct {
|
type database struct {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
log "maunium.net/go/maulogger/v2"
|
log "maunium.net/go/maulogger/v2"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/database/migrations"
|
"go.mau.fi/mautrix-discord/database/migrations"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Database struct {
|
type Database struct {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# Homeserver details.
|
# Homeserver details.
|
||||||
homeserver:
|
homeserver:
|
||||||
# The address that this appservice can use to connect to the homeserver.
|
# The address that this appservice can use to connect to the homeserver.
|
||||||
address: http://localhost:29326
|
address: http://localhost:8008
|
||||||
# The domain of the homeserver (for MXIDs, etc).
|
# The domain of the homeserver (for MXIDs, etc).
|
||||||
domain: example.com
|
domain: example.com
|
||||||
|
|
||||||
# Is the homeserver actually mautrix-asmux?
|
# Is the homeserver actually mautrix-asmux?
|
||||||
asmux: false
|
asmux: false
|
||||||
# The URL to push real-time bridge status to.
|
# The URL to push real-time bridge status to.
|
||||||
# If set, the bridge will make POST requests to this URL whenever a user's whatsapp connection state changes.
|
# If set, the bridge will make POST requests to this URL whenever a user's discord connection state changes.
|
||||||
# The bridge will use the appservice as_token to authorize requests.
|
# The bridge will use the appservice as_token to authorize requests.
|
||||||
status_endpoint: null
|
status_endpoint: null
|
||||||
|
|
||||||
@@ -16,11 +16,11 @@ homeserver:
|
|||||||
# Changing these values requires regeneration of the registration.
|
# Changing these values requires regeneration of the registration.
|
||||||
appservice:
|
appservice:
|
||||||
# The address that the homeserver can use to connect to this appservice.
|
# The address that the homeserver can use to connect to this appservice.
|
||||||
address: http://localhost:29350
|
address: http://localhost:29334
|
||||||
|
|
||||||
# The hostname and port where this appservice should listen.
|
# The hostname and port where this appservice should listen.
|
||||||
hostname: 0.0.0.0
|
hostname: 0.0.0.0
|
||||||
port: 29350
|
port: 29334
|
||||||
# Database config.
|
# Database config.
|
||||||
database:
|
database:
|
||||||
# The database type. "sqlite3" and "postgres" are supported.
|
# The database type. "sqlite3" and "postgres" are supported.
|
||||||
@@ -29,7 +29,7 @@ appservice:
|
|||||||
# SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
|
# SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
|
||||||
# Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
|
# Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
|
||||||
# To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql
|
# To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql
|
||||||
uri: mautrix-whatsapp.db
|
uri: mautrix-discord.db
|
||||||
# Maximum number of connections. Mostly relevant for Postgres.
|
# Maximum number of connections. Mostly relevant for Postgres.
|
||||||
max_open_conns: 20
|
max_open_conns: 20
|
||||||
max_idle_conns: 2
|
max_idle_conns: 2
|
||||||
@@ -50,7 +50,7 @@ appservice:
|
|||||||
bot:
|
bot:
|
||||||
username: discordbot
|
username: discordbot
|
||||||
displayname: Discord bridge bot
|
displayname: Discord bridge bot
|
||||||
avatar: mxc://beeper.com/222332ba2b197e57b73ef2db236232db79af62d0
|
avatar: mxc://maunium.net/nIdEykemnwdisvHbpxflpDlC
|
||||||
|
|
||||||
# Whether or not to receive ephemeral events via appservice transactions.
|
# Whether or not to receive ephemeral events via appservice transactions.
|
||||||
# Requires MSC2409 support (i.e. Synapse 1.22+).
|
# Requires MSC2409 support (i.e. Synapse 1.22+).
|
||||||
@@ -64,9 +64,10 @@ appservice:
|
|||||||
# Bridge config
|
# Bridge config
|
||||||
bridge:
|
bridge:
|
||||||
# Localpart template of MXIDs for Discord users.
|
# Localpart template of MXIDs for Discord users.
|
||||||
# {{.}} is replaced with the phone number of the WhatsApp user.
|
# {{.}} is replaced with the internal ID of the Discord user.
|
||||||
username_template: discord_{{.}}
|
username_template: discord_{{.}}
|
||||||
# Displayname template for Discord userss.
|
# Displayname template for Discord users.
|
||||||
|
# TODO: document variables
|
||||||
displayname_template: '{{.Username}}#{{.Discriminator}} (D){{if .Bot}} (bot){{end}}'
|
displayname_template: '{{.Username}}#{{.Discriminator}} (D){{if .Bot}} (bot){{end}}'
|
||||||
|
|
||||||
portal_message_buffer: 128
|
portal_message_buffer: 128
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module gitlab.com/beeper/discord
|
module go.mau.fi/mautrix-discord
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
|
|||||||
12
main.go
12
main.go
@@ -6,12 +6,12 @@ import (
|
|||||||
|
|
||||||
"github.com/alecthomas/kong"
|
"github.com/alecthomas/kong"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/config"
|
"go.mau.fi/mautrix-discord/config"
|
||||||
"gitlab.com/beeper/discord/consts"
|
"go.mau.fi/mautrix-discord/consts"
|
||||||
"gitlab.com/beeper/discord/globals"
|
"go.mau.fi/mautrix-discord/globals"
|
||||||
"gitlab.com/beeper/discord/registration"
|
"go.mau.fi/mautrix-discord/registration"
|
||||||
"gitlab.com/beeper/discord/run"
|
"go.mau.fi/mautrix-discord/run"
|
||||||
"gitlab.com/beeper/discord/version"
|
"go.mau.fi/mautrix-discord/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cli struct {
|
var cli struct {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"maunium.net/go/mautrix/appservice"
|
"maunium.net/go/mautrix/appservice"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/config"
|
"go.mau.fi/mautrix-discord/config"
|
||||||
"gitlab.com/beeper/discord/globals"
|
"go.mau.fi/mautrix-discord/globals"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cmd struct {
|
type Cmd struct {
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/bridge"
|
"go.mau.fi/mautrix-discord/bridge"
|
||||||
"gitlab.com/beeper/discord/config"
|
"go.mau.fi/mautrix-discord/config"
|
||||||
"gitlab.com/beeper/discord/globals"
|
"go.mau.fi/mautrix-discord/globals"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cmd struct{}
|
type Cmd struct{}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package version
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gitlab.com/beeper/discord/consts"
|
"go.mau.fi/mautrix-discord/consts"
|
||||||
"gitlab.com/beeper/discord/globals"
|
"go.mau.fi/mautrix-discord/globals"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cmd struct{}
|
type Cmd struct{}
|
||||||
|
|||||||
Reference in New Issue
Block a user