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

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

Postby googol » Tue Mar 21, 2017 8:09 am

DiscordBot for Minetest.

Notice:
Chatting between Minetest and Discord. There is support for some commands.

ImageImage

NEW BETA version!
Very simple and fast installation!

- Install bot in your Discord server
- Install mod https://github.com/googolgl/lp_api
- configure lp_api.channel_id (Rightclick on the Discord text channel you want the bot to interact with and press "Copy ID", and then insert value in this)

Start testing!

Old Version

License of source code: AGPL v.3

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
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby TheReaperKing » Tue Mar 21, 2017 4:48 pm

Wow neat!!!
TheReaperKing
Member
 
Posts: 531
Joined: Sun Nov 22, 2015 9:36 pm

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

Postby red-001 » Tue Mar 21, 2017 6:36 pm

Nice I was thinking of creating something similar but I guess I'm too late.
red-001
Member
 
Posts: 205
Joined: Tue Jan 26, 2016 8:15 pm
GitHub: red-001

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

Postby Skyrider » Thu Jul 13, 2017 3:14 pm

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
Skyrider
New member
 
Posts: 4
Joined: Thu Jul 13, 2017 1:19 pm

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

Postby googol » Thu Jul 13, 2017 5:35 pm

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
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby Skyrider » Thu Jul 13, 2017 10:45 pm

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
Skyrider
New member
 
Posts: 4
Joined: Thu Jul 13, 2017 1:19 pm

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

Postby googol » Fri Jul 14, 2017 5:55 am

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.
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby ManElevation » Thu Oct 26, 2017 5:51 pm

Can you put more clear steps of how to do this?
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 10:04 pm
GitHub: ManElevation
In-game: ManElevation

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

Postby ManElevation » Sun Nov 12, 2017 1:01 pm

were do i put this code?
Code: Select all
mtdBot -t <TokenBot> -c <ChannelID>
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 10:04 pm
GitHub: ManElevation
In-game: ManElevation

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

Postby BBmine » Tue Nov 21, 2017 11:46 pm

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.
BBmine
Member
 
Posts: 3474
Joined: Sun Jul 12, 2015 10:51 pm
GitHub: BBmine
In-game: Baggins

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

Postby googol » Wed Nov 22, 2017 10:38 am

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.
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby googol » Mon Dec 11, 2017 7:57 pm

New version
- added new command "privs"
- added censor for discord board only
- All settings moved in to config.ini
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby fstltna » Mon Dec 18, 2017 1:42 am

Looks very nice. Will have to give it a try...
fstltna
Member
 
Posts: 98
Joined: Sat Aug 05, 2017 11:22 pm
GitHub: fstltna
In-game: MarisaG

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

Postby Skyrider » Mon Aug 13, 2018 9:15 am

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
Skyrider
New member
 
Posts: 4
Joined: Thu Jul 13, 2017 1:19 pm

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

Postby googol » Mon Aug 13, 2018 3:08 pm

googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby Skyrider » Tue Aug 14, 2018 1:07 pm


Do I have to edit a specific file or run something as command line when building it?
Skyrider
New member
 
Posts: 4
Joined: Thu Jul 13, 2017 1:19 pm

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

Postby googol » Tue Aug 14, 2018 3:09 pm

just edit
/home/skyrider/go/src/github.com/vharitonsky/iniflags/iniflags.go
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby sparky » Tue Feb 05, 2019 9:13 pm

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/DiscordIntegration/wiki/How-to-get-a-token-and-channel-ID-for-Discord#add-your-new-discord-bot-user-to-your-discord-serverguild
sparky
Member
 
Posts: 131
Joined: Sun Oct 05, 2014 12:54 am
GitHub: Elkien3
In-game: sparky

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

Postby googol » Wed Feb 06, 2019 11:59 am

Please send me your logs in PM.
BTW i will remove repository from bitbucket to GitHub through some days, with fix a some issues.
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby sparky » Wed Feb 06, 2019 2:25 pm

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.
sparky
Member
 
Posts: 131
Joined: Sun Oct 05, 2014 12:54 am
GitHub: Elkien3
In-game: sparky

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

Postby googol » Wed Feb 06, 2019 2:36 pm

Is the problem resolved now?
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby sparky » Tue Mar 12, 2019 2:58 pm

was able to get it to work with this tutorial https://github.com/Chikachi/DiscordInte ... erverguild
yep
sparky
Member
 
Posts: 131
Joined: Sun Oct 05, 2014 12:54 am
GitHub: Elkien3
In-game: sparky

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

Postby googol » Tue Mar 12, 2019 8:58 pm

NEW BETA version!

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

Start testing!
googol
Member
 
Posts: 83
Joined: Mon Dec 09, 2013 9:23 am

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

Postby disconnected » Wed Apr 03, 2019 6:24 pm

Using the new beta version i get this...

[lp_api] Please setup (secure.http_mod = lp_api) in minetest.conf... [ERROR]

In my minetest.conf I have these lines...
Code: Select all
secure.http_mod = lp_api
secure.enable_security = true


Could there be some other issue?

UPDATE:

Adding this to minetest.conf fixed my issue...
secure.trusted_mods = lp_api

Thanks for the great mod!
disconnected
Member
 
Posts: 16
Joined: Mon Mar 11, 2019 3:45 am
GitHub: discon-nected
In-game: disconnected

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

Postby Festus1965 » Wed Apr 03, 2019 11:16 pm

I closed discord and get my mail deleted now,

and we of minetest should be care full, NOT to connect automatic services that take more data then we do !

an mail-address and telephone number is too much too "force" other people mainly kids into another data grabbing service.
Festus1965
Member
 
Posts: 956
Joined: Sun Jan 03, 2016 11:58 am
GitHub: Minetest-One
In-game: Thomas Explorer



Return to Minetest-related projects



Who is online

Users browsing this forum: Yandex Bot [Bot] and 0 guests