Minecraft-Console-Client icon indicating copy to clipboard operation
Minecraft-Console-Client copied to clipboard

Create DiscordRelay.cs

Open ReinforceZwei opened this issue 4 years ago • 21 comments

Message relaying ChatBot for Discord. (NOT Webhook) Able to issue MCC command from Discord. image image

Require user to download two DLL libraries from https://github.com/ReinforceZwei/Minecraft-Console-Client/releases/tag/v0.0.1-beta before using this bot. The two libraries were written by me. Source code are not yet available publicly.

ReinforceZwei avatar May 27 '21 10:05 ReinforceZwei

The current implementation is too incomplete. If anyone is interested in contributing, please leave a comment.

ReinforceZwei avatar May 27 '21 11:05 ReinforceZwei

What's the difference between WebHook and Relay? Is Webhook for chat messages, and Relay for console commands?

ORelio avatar May 29 '21 15:05 ORelio

FYI "Relay" is the function of the Chatbot. The method using behind is Discord API.

The differences are:

  1. Webhook is in single direction (MCC to DC) while Discord API is in both direction (MCC <-> DC)
  2. The functionality of webhook is very limited compare to Discord API
  3. Discord API is more difficult to use and implement

ReinforceZwei avatar May 29 '21 16:05 ReinforceZwei

This is a really neat idea! I also had a bot integration in mind when creating the webhook script, due to its limitations. Unfortunately I had no idea on how to integrate the Discord API into this client, which limited me on sending messages to Discord via a webhook. I am really looking foreward to this project. :)

Daenges avatar May 31 '21 15:05 Daenges

@ReinforceZwei I wanted to look into it, but I can neither find the .cs file in your mentioned repository, nor the .dll's for it. Am I understanding something wrong? o.O

Daenges avatar Jun 13 '21 16:06 Daenges

@Daenges Sorry, I forgot to push the source code to GitHub. My bad https://github.com/ReinforceZwei/websocket-server https://github.com/ReinforceZwei/simple-discord-api

ReinforceZwei avatar Jun 14 '21 07:06 ReinforceZwei

Hi, can you make a guide on how to use all this in discord, how to connect everything? I just don’t understand this

iwixw avatar Jun 15 '21 09:06 iwixw

@iwixw Hi,

The Discord integration have not been done yet. There will be a guide available once this feature was completed.

ReinforceZwei avatar Jun 15 '21 10:06 ReinforceZwei

@iwixw you may use DiscordWebhook.cs, until this project has finished.

Daenges avatar Jun 15 '21 11:06 Daenges

@Daenges I do not understand how to use this, since I am a noob in scripts.

iwixw avatar Jun 15 '21 15:06 iwixw

@iwixw Here is the bot manual. You basically need to download the file, put it in the same folder as the executable and do /script discordwebhook

Daenges avatar Jun 15 '21 15:06 Daenges

@Daenges can I somehow send any commands to the server via discord?

iwixw avatar Jun 15 '21 16:06 iwixw

@iwixw This is the point of this script here. The webhook can only send messages to discord and not the other way around.

Daenges avatar Jun 15 '21 16:06 Daenges

@Daenges Can I add a webhook url link somewhere so that I don't have to type it into / dw changeurl [link] every time?

iwixw avatar Jun 15 '21 20:06 iwixw

@iwixw this here is no room to ask general questions. If you have any further question, please open an issue and ask it there, so we can keep this thread related to the topic.

But to answer your question: This was already asked here. Short answer is that there are two ways: First: Hardcode it into the script. Just open the file with any text editor and put your link between the quotes here: WebhookURL = "https://discord.com/api/webhooks/SomeNumber/RandomStuff"; // Enter your Webhook URL here to start the bot with it predefined.

Second: You just create a script as described in the issue.

For any further questions I am happy to help in the issue section. :D

Daenges avatar Jun 16 '21 16:06 Daenges

hello is this done?

AbdobiZark avatar Aug 08 '21 13:08 AbdobiZark

@AbdobiZark Nope. No further work was done here since the creation. I can still recommend DiscordWebhook.cs while waiting.

Daenges avatar Aug 08 '21 13:08 Daenges

@AbdobiZark Nope. No further work was done here since the creation. I can still recommend DiscordWebhook.cs while waiting.

Can I use mccc command through discord or (discord to mccc) with this?

AbdobiZark avatar Aug 08 '21 13:08 AbdobiZark

@AbdobiZark Nope, you can only stream chat messages from the server to your discord. (Back and forth communication is the purpose of this PR.)

Daenges avatar Aug 08 '21 13:08 Daenges

@AbdobiZark Nope, you can only stream chat messages from the server to your discord. (Back and forth communication is the purpose of this PR.)

ahh i see a " chat log "

AbdobiZark avatar Aug 08 '21 13:08 AbdobiZark

Since @breadbyte is working on porting this project to .NET 5, I think it is no longer necessary to implement our own Websocket server or Discord gateway API that works on old .NET Framework 4. We could just grab other Discord API implementation to make Discord integration works with MCC.

ReinforceZwei avatar Aug 09 '21 06:08 ReinforceZwei

Since we're on .NET Core 6, you could use https://github.com/discord-net/Discord.Net Seems like a nice library, tho everything would have to be in a Task.Run.

milutinke avatar Sep 07 '22 11:09 milutinke