[Mod + Program] Minetest-Discord relay [discordmt] [v0.1]

Post Reply
User avatar
archfan7411
New member
Posts: 9
Joined: Wed Sep 26, 2018 00:37
GitHub: archfan7411
In-game: archfan

[Mod + Program] Minetest-Discord relay [discordmt] [v0.1]

by archfan7411 » Post

Minetest-Discord relay [discordmt]

An easy-to-use relay complete with login and command support, using an external program written in Python.

GitHub | Releases | Wiki

Licensed under MIT

Have you ever wanted to interact with and moderate your server without logging into the game (or IRC)?
Do you have an active community on Discord which you'd like to bridge to Minetest?
Are you unsatisfied with the features or long installation steps of the current Discord relays?


If you answered YES to any of these questions, discordmt is for you!

Setup

1. Download or clone the repository. If you don't want to install Python and/or the dependencies for running the Python relay, take a look at the releases for binary executables.

2. Create an application at the Discord Developer Dashboard and enable it as a bot (in the Bot tab.) For a more detailed guide on creating Discord bots, see this bot setup guide by reactiflux.

3. Copy the token from your newly-created bot, and use it to finish setting up relay.conf along with any other settings you wish to change. The ID of the channel you wish to relay to must also be specified in relay.conf; you may obtain it by enabling Developer Mode on the Discord client and rightclicking the desired channel in the list.

Example relay.conf: (The token shown below has been regenerated)

Code: Select all

[BOT]
token = NjEwODk0MDU4ODY4NzAzMjMz.XVL5dA.8j8d2XN8_5UwRheG91P2XksYDoM
command_prefix = !
[RELAY]
port = 8080
channel_id = 576585506658189332
allow_logins = true
clean_invites = true
use_nicknames = true
4. Put discordmt in your Minetest mods directory. You may also run the relay program from the mod directory, though server owners may wish to separate the two for cleanliness. If you separate the two, ensure that at least the init.lua and settingtypes.txt make it into the mods directory.

5. Enable mod security and add discordmt to the HTTP mods. In addition, set "discord.port" in your minetest.conf to match the port you used in relay.conf and optionally set "discord.text_color" to a hex color string if you'd like to color relayed messages from Discord.

Example minetest.conf excerpt:

Code: Select all

secure.enable_security = true
secure.http_mods = discordmt
discord.port = 8080
discord.text_color = #a7a7a7
(Side note: The port must be set in both relay.conf and minetest.conf because users may decide to run the relay in a different location than the mod, or to run multiple relays/servers at once.)

6. Run the relay and, when you're ready, the Minetest server. The relay may be left up even when the server goes down, or may run continuously between several server restarts, for maximum convenience.

Logging in and running commands

Discord users may log in by using the !login <username> [password] command in DMs (Direct Messages) with the bot. This command should never be used outside of DMs.

Once a user is logged in, they may run commands with !cmd <command name> [command params] in either the relay channel or DMs with the bot.

Additional information

- Logins persist while the relay is up; users do not need to relogin after the Minetest server alone restarts.
- The relay program must be running if you start a Minetest server with `discordmt` enabled; otherwise HTTP errors will be thrown.
- Running two Minetest servers connecting to a single relay, or multiple relays connected to a single bot, will work unexpectedly and is not recommended. You should run a separate relay and bot for each Minetest server.

Thank you for taking the time to read my wall of text, and feel free to reply or otherwise contact me if you have any issues using the relay.
Last edited by archfan7411 on Sat Oct 19, 2019 14:20, edited 2 times in total.

User avatar
archfan7411
New member
Posts: 9
Joined: Wed Sep 26, 2018 00:37
GitHub: archfan7411
In-game: archfan

Re: [Mod + Program] Minetest-Discord relay [discordmt] [v0.1

by archfan7411 » Post

The relay has been updated to support a new relay.conf option, "clean_invites". When enabled, this option automatically strips Discord invite links from Discord messages when relaying them to Minetest.

A note: The current GitHub Release has had its binaries updated to reflect the change, however the source code bundled with the release is outdated. Releases are used in this project solely to distribute compiled binaries of the Python relay for those who do not wish to install the dependencies, and the source code should always be cloned from the master branch.

redblade7
Member
Posts: 312
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod + Program] Minetest-Discord relay [discordmt] [v0.1

by redblade7 » Post

Looks great!

Caveat for people like me who try and stick with the stable versions, if you're on v5.0.1 you have to make this change to avoid annoying messages filling up your log:

https://github.com/minetest/minetest/co ... 604ef44a0b
-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)

User avatar
archfan7411
New member
Posts: 9
Joined: Wed Sep 26, 2018 00:37
GitHub: archfan7411
In-game: archfan

Re: [Mod + Program] Minetest-Discord relay [discordmt] [v0.1

by archfan7411 » Post

An update has been released on GitHub which fixes compatibility with the IRC mod.

User avatar
Nathan.S
Member
Posts: 1033
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod + Program] Minetest-Discord relay [discordmt] [v0.1

by Nathan.S » Post

Running your executable gives me this error

Code: Select all

Error loading Python lib '/tmp/_MEIrBbt57/libpython3.7m.so.1.0': dlopen: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/_MEIrBbt57/libpython3.7m.so.1.0)
I'd like to try using the source but I don't know where to find discord.py or aiohttp could you possibly update the documentation to point to where to find those files. Thanks.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Nathan.S
Member
Posts: 1033
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod + Program] Minetest-Discord relay [discordmt] [v0.1

by Nathan.S » Post

Forget everything I said, I got it figured out.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Nathan.S
Member
Posts: 1033
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod + Program] Minetest-Discord relay [discordmt] [v0.1

by Nathan.S » Post

Quick question, is it possible to prefix a chat message with something to keep the bridge from copying it over to discord? I know some of the IRC mods have some sort of 'off' prefix you can use. I didn't see anything in the wiki, but I may have missed it.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

redblade7
Member
Posts: 312
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod + Program] Minetest-Discord relay [discordmt] [v0.1

by redblade7 » Post

Nathan.S wrote:Quick question, is it possible to prefix a chat message with something to keep the bridge from copying it over to discord? I know some of the IRC mods have some sort of 'off' prefix you can use. I didn't see anything in the wiki, but I may have missed it.
If this "off prefix" feature was to be added to discordmt, there should be an option by the Minetest server owner to disable it globally.
-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], So.Po.Coder and 4 guests