[BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

Post Reply
User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

[BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by googol » Post

DiscordBot for Minetest.

License of source code: AGPL v.3

Notice:
Reprints messages from the general chat Minetest to Discord and back.

ImageImage

Support command in the Discord:
!status - Server’s Minetest version, time the server is running in seconds list of connected players and the message of the day.
!msg <player> <message> - Send a private message <message> to <player>.
!ban <player name> - Ban IP of player.
!unban <player name/IP address> - Remove ban of player with the specified name or IP address.
!kick <player name> <reason> - Kicks the player with the name <player name>. Optionally a <reason> can be provided in text-form. This text is also shown to the kicked player.
!setpassword <player> <passwovrd> - Sets password of <player> to <password>.
!grant <player> <privilege> - Gives the <privilege> to <player>.
!revoke <player> <privilege> - Takes away a <privilege> from <player>.
!privs <player> - Show privs of player.
You can disable this by setting "SUPPORT_CMD = false" in "~/mods/http_api/subscriber/init.lua"

Installing:
1. Download: https://bitbucket.org/g00g01/mtdbot/downloads/?tab=downloads

2. Unzip mtdBot.zip > ~/mtdBot

3. Copy ~/mtdBot/minetest/mods/http_api > ~/minetest/mods/http_api

4. Add this mods to trusted_mods.
--- Open : /minetest/minetest.confg
--- Add : secure.http_mods = subscriber,publisher

5. Activate http_api mod in menu

6. Open https://discordapp.com/developers/applications/me
--- Click "New App"
--- Add "App Name" (Example: minetest-bot)
--- Push "Create App"
--- Push "Create a Bot User"
--- "Token:click to reveal", this is your TokenBot
--- Push "Save changes"
Usage:

Run in console

Code: Select all

minetest --verbose
Edit config.ini and Run server:

Code: Select all

mtdBot
Links:

Source code on Bitbucket:
- https://bitbucket.org/g00g01/mtdbot

Discord:
- https://discordapp.com/

Image
Last edited by googol on Mon Dec 11, 2017 19:54, edited 4 times in total.
I am groot!

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: [BOT]mtdBot v.0.1.0[Discord Bot for Minetest]

by TheReaperKing » Post

Wow neat!!!
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

red-001
Member
Posts: 205
Joined: Tue Jan 26, 2016 20:15
GitHub: red-001
IRC: red-001

Re: [BOT]mtdBot v.0.1.0[Discord Bot for Minetest]

by red-001 » Post

Nice I was thinking of creating something similar but I guess I'm too late.

Skyrider
New member
Posts: 4
Joined: Thu Jul 13, 2017 13:19

Re: [BOT]mtdBot v.0.1.0[Discord Bot for Minetest]

by Skyrider » Post

It's not working for me I'm afraid.

The console does show the discord messages:
Creating new eventBuffer for category: minetest
SubscriptionManager: queued event: &{1499958779173 minetest {chat Dio O_o? []}}.
312245060144201728=312245060144201728
SubscriptionManager: queued event: &{1499958793161 minetest {chat Skyrider Its not working as it should []}}.
312245060144201728=312245060144201728
SubscriptionManager: queued event: &{1499958812002 minetest {cmd Skyrider status []}}.
312245060144201728=312245060144201728
SubscriptionManager: queued event: &{1499958812215 minetest {chat Beerus ```
SubscriptionManager: performing stale category purge.
SubscriptionManager: purging expired eventBuffer for category: minetest.
But it doesn't appear to be sending anything to discord or the other way around. All the messages appears to be queued?

Regards,
Skyrider

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT]mtdBot v.0.1.0[Discord Bot for Minetest]

by googol » Post

Hi Skyrider.
1. Start the minetest in the console "minetest --verbose"
2. Press [F10]
3. Enter "/mods"
4. You should see a subscriber and publisher mods in the list.
5. Start mtdBot in other console
6. Look in the consoles
I am groot!

Skyrider
New member
Posts: 4
Joined: Thu Jul 13, 2017 13:19

Re: [BOT]mtdBot v.0.1.0[Discord Bot for Minetest]

by Skyrider » Post

googol wrote:Hi Skyrider.
1. Start the minetest in the console "minetest --verbose"
2. Press [F10]
3. Enter "/mods"
4. You should see a subscriber and publisher mods in the list.
5. Start mtdBot in other console
6. Look in the consoles
Both publisher & subscriber is loaded, before I made this thread.

As for the console, nothing special:
2017-07-14 00:42:19: VERBOSE[ServerThread]: MEET_ADDNODE: - - - - - - - - - - - - - - 1
2017-07-14 00:42:19: ACTION[ServerThread]: CHAT: <Skyrider> TEST
2017-07-14 00:42:24: INFO[ServerThread]: ServerMap: Written: 0 sector metadata files, 1 block files, 630 blocks in memory.
2017-07-14 00:42:24: INFO[ServerThread]: ServerMap: Blocks modified by:
2017-07-14 00:42:24: INFO[ServerThread]: setNodeNoCheck: - - - - - - - - - - - - - 1
2017-07-14 00:42:24: ACTION[ServerThread]: CHAT: <Skyrider> TEST
2017-07-14 00:42:30: ACTION[ServerThread]: CHAT: <Skyrider> TEST
2017-07-14 00:42:31: INFO[ServerThread]: Players:
2017-07-14 00:42:31: INFO[ServerThread]: * Skyrider RemoteClient 2: m_blocks_sent.size()=1451, m_blocks_sending.size()=0, m_nearest_unsent_d=8, m_excess_gotblocks=0
2017-07-14 00:42:32: ACTION[ServerThread]: CHAT: <Skyrider> TEST
2017-07-14 00:42:32: ACTION[ServerThread]: CHAT: <Skyrider> TEST
2017-07-14 00:42:47: INFO[ServerThread]: ServerMap: Unloaded 22 blocks from memory, of which 0 were written, 608 blocks in memory.
The bot itself is online on discord, so that means mtdBot is using the proper token/bot.

As for mtdBot's console:
2017/07/14 00:40:32 Creating new eventBuffer for category: minetest
2017/07/14 00:40:32 SubscriptionManager: queued event: &{1499985632530 minetest {chat Skyrider :0 []}}.
312245060144201728=312245060144201728
2017/07/14 00:40:57 SubscriptionManager: queued event: &{1499985657005 minetest {chat NuovaPrime wot []}}.
312245060144201728=312245060144201728
2017/07/14 00:41:22 SubscriptionManager: queued event: &{1499985682614 minetest {chat ミゲル :0 []}}.
312245060144201728=312245060144201728
2017/07/14 00:41:31 SubscriptionManager: queued event: &{1499985691953 minetest {chat NuovaPrime :0 []}}.
312245060144201728=312245060144201728
2017/07/14 00:42:43 SubscriptionManager: queued event: &{1499985763765 minetest {chat Skyrider mh? []}}.
2017/07/14 00:42:58 SubscriptionManager: performing stale category purge.
312245060144201728=312245060144201728
2017/07/14 00:43:20 SubscriptionManager: queued event: &{1499985800032 minetest {chat NuovaPrime so confused at this point []}}.
So, not sure why it's not working.

Also, not sure IF related to this mod, but noticed this in console:
2017-07-14 00:47:03: VERBOSE[ConnectionSend]: con(4/1)RE-SENDING timed-out RELIABLE to 178.203.0.221(t/o=0.1): from_peer_id=1, channel=0, seqnum=3
2017-07-14 00:47:03: VERBOSE[ConnectionSend]: con(4/1)RE-SENDING timed-out RELIABLE to 178.203.0.221(t/o=0.1): from_peer_id=1, channel=0, seqnum=4
2017-07-14 00:47:03: VERBOSE[ConnectionSend]: con(4/1)RE-SENDING timed-out RELIABLE to 178.203.0.221(t/o=0.1): from_peer_id=1, channel=0, seqnum=5
2017-07-14 00:47:03: VERBOSE[ConnectionSend]: con(4/1)RE-SENDING timed-out RELIABLE to 178.203.0.221(t/o=0.1): from_peer_id=1, channel=0, seqnum=6
2017-07-14 00:47:03: VERBOSE[ConnectionSend]: con(4/1)RE-SENDING timed-out RELIABLE to 178.203.0.221(t/o=0.1): from_peer_id=1, channel=0, seqnum=7

and

2017-07-14 00:47:03: VERBOSE[ConnectionReceive]: con(4/1)WARNING: ACKed packet not in outgoing queue
2017-07-14 00:47:03: VERBOSE[ConnectionReceive]: con(4/1)WARNING: ACKed packet not in outgoing queue
2017-07-14 00:47:03: VERBOSE[ConnectionReceive]: con(4/1)WARNING: ACKed packet not in outgoing queue
2017-07-14 00:47:03: VERBOSE[ConnectionReceive]: con(4/1)WARNING: ACKed packet not in outgoing queue
2017-07-14 00:47:03: VERBOSE[ConnectionReceive]: con(4/1)WARNING: ACKed packet not in outgoing queue
2017-07-14 00:47:03: VERBOSE[ConnectionReceive]: con(4/1)WARNING: ACKed packet not in outgoing queue
2017-07-14 00:47:03: VERBOSE[ConnectionReceive]: con(4/1)WARNING: ACKed packet not in outgoing queue

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT]mtdBot v.0.1.0[Discord Bot for Minetest]

by googol » Post

The connection between the bot and the minetest goes according to the http protocol.
In the maintest console, you should see the lines (for example):

Code: Select all

2017-07-14 08:43:50: VERBOSE[Server]: httpfetch_caller_alloc_secure: allocating 4538747068179621999
2017-07-14 08:43:50: ACTION[Server]: Mod performs HTTP request with URL http://127.0.0.1:8003/sub?timeout=26&category=minetest
2017-07-14 08:43:50: ERROR[CurlFetch]: http://127.0.0.1:8003/sub?timeout=26&category=minetest not found (Couldn't connect to server) (response code 0)
Also when the bot is launched, it start the server on http://127.0.0.1:8003
my log:

Code: Select all

/Progects/mtdbot$ go run ./main.go -t M................................................ -c 288602630459097089
Starting the server on 127.0.0.1:8003...
2017/07/14 09:10:20 SubscriptionManager: Starting run.
Bot is now running.  Press CTRL-C to exit.
2017/07/14 09:10:23 Handling HTTP request at  /sub?timeout=26&category=minetest
2017/07/14 09:10:23 SubscriptionManager: Adding Client (Category: "minetest" Client: 02e7a20f-3c0f-4488-5a0a-b0581aa3345c)
2017/07/14 09:10:49 SubscriptionManager: Removing Client (Category: "minetest" Client: 02e7a20f-3c0f-4488-5a0a-b0581aa3345c)
2017/07/14 09:10:49 Handling HTTP request at  /sub?timeout=26&category=minetest
2017/07/14 09:10:49 SubscriptionManager: Adding Client (Category: "minetest" Client: 86ff18ac-aea6-496d-5d43-6288201ca5e1)
287142202629685249=288602630459097089
288602630459097089=288602630459097089
2017/07/14 09:11:12 SubscriptionManager: forwarding event to 1 clients. (event: &{1500012672369 minetest {chat Elrick test  []}})
2017/07/14 09:11:12 SubscriptionManager: sending event to client: 86ff18ac-aea6-496d-5d43-6288201ca5e1
2017/07/14 09:11:12 SubscriptionManager: Removing 1 client subscriptions for: minetest
2017/07/14 09:11:12 Creating new eventBuffer for category: minetest
2017/07/14 09:11:12 SubscriptionManager: queued event: &{1500012672369 minetest {chat Elrick test  []}}.
2017/07/14 09:11:12 Handling HTTP request at  /sub?timeout=26&category=minetest
2017/07/14 09:11:12 SubscriptionManager: Adding Client (Category: "minetest" Client: 75aefb4e-5e00-46f4-4996-87e30892db68)

Check the firewall or permitions.
I am groot!

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [BOT]mtdBot v.0.1.0[Discord Bot for Minetest]

by ManElevation » Post

Can you put more clear steps of how to do this?
My Public Mods! Discord: Rottweiler Games#3368

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [BOT] mtdBot [v.0.1.0] - Discord Bot for Minetest

by ManElevation » Post

were do i put this code?

Code: Select all

mtdBot -t <TokenBot> -c <ChannelID>
My Public Mods! Discord: Rottweiler Games#3368

BBmine
Member
Posts: 3475
Joined: Sun Jul 12, 2015 22:51
GitHub: BBmine
IRC: BBmine
In-game: Baggins
Location: USA

Re: [BOT] mtdBot [v.0.1.0] - Discord Bot for Minetest

by BBmine » Post

Is there a way to link the server log with discord? It would be helpful for cases where 2 admins live away from each other.

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT] mtdBot [v.0.1.0] - Discord Bot for Minetest

by googol » Post

BBmine wrote:Is there a way to link the server log with discord? It would be helpful for cases where 2 admins live away from each other.
At the moment there is no such possibility.
I am groot!

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by googol » Post

New version
- added new command "privs"
- added censor for discord board only
- All settings moved in to config.ini
I am groot!

User avatar
fstltna
Member
Posts: 120
Joined: Sat Aug 05, 2017 23:22
GitHub: fstltna
IRC: MarisaG
In-game: MarisaG
Location: South San Francisco, CA
Contact:

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by fstltna » Post

Looks very nice. Will have to give it a try...
---- https://MineCity.online - Fan site for Minetest - get Minetest Hosting with first month FREE & $14/month after that
---- https://discord.gg/Bd4Xw9c - Minecity Discord Server - Join today!

Skyrider
New member
Posts: 4
Joined: Thu Jul 13, 2017 13:19

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by Skyrider » Post

Is this still being updated? When I attempt to build the bot, I'm getting:
main.go:15:5: cannot find package "github.com/vharitonsky/iniflags" in any of:
/usr/lib/go-1.10/src/github.com/vharitonsky/iniflags (from $GOROOT)
/home/skyrider/go/src/github.com/vharitonsky/iniflags (from $GOPATH)
EDIT. I see:
go get -u -a github.com/vharitonsky/iniflags
was missing from the readme. Has to be installed as well.

EDIT 2:

When successfully build, getting the following error:
2018/08/13 11:16:56 SubscriptionManager: Starting run.
error obtaining account details, HTTP 401 Unauthorized, {"code": 0, "message": "401: Unauthorized"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6b1738]

goroutine 24 [running]:
main.discordBot()
/home/skyrider/.minetest/mtdbot/main.go:85 +0x208
created by main.main
/home/skyrider/.minetest/mtdbot/main.go:57 +0x147

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by googol » Post

I am groot!

Skyrider
New member
Posts: 4
Joined: Thu Jul 13, 2017 13:19

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by Skyrider » Post

Do I have to edit a specific file or run something as command line when building it?

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by googol » Post

just edit
/home/skyrider/go/src/github.com/vharitonsky/iniflags/iniflags.go
I am groot!

User avatar
sparky
Member
Posts: 142
Joined: Sun Oct 05, 2014 00:54
GitHub: Elkien3
IRC: ircSparky
In-game: sparky
Location: USA
Contact:

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by sparky » Post

I'm having an issue that seems tobe between the mtdBot program and my Discord server. I can see server chats in mtdBot logs, but there is no bot in my Discord server.

I've run it with sudo and disabled iptables firewall

edit: was able to get it to work with this tutorial https://github.com/Chikachi/DiscordInte ... erverguild

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by googol » Post

Please send me your logs in PM.
BTW i will remove repository from bitbucket to GitHub through some days, with fix a some issues.
I am groot!

User avatar
sparky
Member
Posts: 142
Joined: Sun Oct 05, 2014 00:54
GitHub: Elkien3
IRC: ircSparky
In-game: sparky
Location: USA
Contact:

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by sparky » Post

I don't have them anymore, sorry. but it was a client being created an removed every minute or so, the issue was that I didn't set up the Discord bot to be connected anywhere, and the step of the tutorial I linked is the only thing I was really missing.

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by googol » Post

Is the problem resolved now?
I am groot!

User avatar
sparky
Member
Posts: 142
Joined: Sun Oct 05, 2014 00:54
GitHub: Elkien3
IRC: ircSparky
In-game: sparky
Location: USA
Contact:

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by sparky » Post

was able to get it to work with this tutorial https://github.com/Chikachi/DiscordInte ... erverguild
yep

User avatar
googol
Member
Posts: 81
Joined: Mon Dec 09, 2013 09:23

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by googol » Post

NEW BETA version!

- Install bot in your Discord server
- Install mod https://github.com/googolgl/lp_api
- configure lp_api.channel_id

Start testing!
I am groot!

disconnected
New member
Posts: 2
Joined: Mon Mar 11, 2019 03:45
GitHub: discon-nected
In-game: disconnected

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by disconnected » Post

This URL no longer works: http://mtdbot.pp.ua/
Should we go back to the self-hosted method?
King of the Hill (CapturePoint) Server 》》》RATMIX.COM:30000

User avatar
Miniontoby
Member
Posts: 438
Joined: Fri Mar 01, 2019 19:25
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [BOT] mtdBot [v.0.2.0] - Discord Bot for Minetest

by Miniontoby » Post

The resource doesnt exist anymore
My English isn't very good because I'm Dutch ---- Check my mod "Doorbell" Vote your gang

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests