whisper2shade

[RELEASED] Discord Relay

Recommended Posts

Posted (edited)
11 hours ago, Sindusk said:

Any other ideas that might be requested.

Maybe server shut down in x minutes messages would be cool.

And in this way, if its possible and the relay can check if the server is online again, to send a message to discord like "server (name) is up and running"

 

Eject

 

add: disbanded deeds message =)

Edited by Eject

Share this post


Link to post
Share on other sites
12 hours ago, Sindusk said:

Here's a new release, but it's moderately different from how the original mod handles things:

  • Only applicable to GL-Kingdom chats. Uses abbreviated kingdom names instead of full ones (#gl-hots for example. Identical to how the name is displayed in-game but lowercased).
  • Prefixes messages from Discord -> ingame with [D] to signify they came from Discord, instead of using a custom name.
  • Prefixes all messages in Discord with the server-side timestamp of when the message was broadcast.
  • Uses member nicknames instead of usernames from Discord. This means if I'm SomeGuy#7799 as my Discord login but my screen name for my server discord is Sindusk, the relay will now use the Sindusk name instead of "SomeGuy"
  • Can now be utilized as a library from other mod authors to link messages into relay. For mod authors interested:
    • Add the line "depends.import=DiscordRelay" to your properties file. Keep in mind this will create a hard dependency on DiscordRelay, meaning if DiscordRelay is not installed on the server, your mod will not work.
    • From your mod, call the method "sendToDiscord(String channel, String message)" to send messages to channels of your choice.

https://github.com/Sindusk/DiscordRelay/releases/tag/v1.0

 

I'll likely expand a bit further on it as well in the near future and increase the functionality, including some of what my other mods are capable of:

  • Unique mob rumours and slay event channel.
  • Death tabs relay.
  • Any other ideas that might be requested.

Screenshots of some of the changes:

 

Timestamps in Discord:

  Reveal hidden contents

B6p6NPO.png

Same messages displayed in game:

  Reveal hidden contents

0aYq96r.png

Upcoming - Currently using a dependent mod with the "library" usage mentioned above to accomplish this:

  Reveal hidden contents

dQPLZfL.png

 

I would still very much prefer a 'Local Server' Freedom relay.

Not every server uses a cluster, and we've become accustomed to using Freedom and not GL-Freedom chat.

Share this post


Link to post
Share on other sites
5 minutes ago, Sindusk said:

New release v1.1:

  • Fixed a bug involving users without a nickname showing up as "null"
  • Add support for non-GL kingdom channels.
  • New "@" annotation instead of "[D]" for discord-to-ingame messaging.

https://github.com/Sindusk/DiscordRelay/releases/tag/v1.1

Is it required to have a Discord channel for GL channels too?

Share this post


Link to post
Share on other sites
1 minute ago, Zera said:

Is it required to have a Discord channel for GL channels too?

No. However, any messages sent in the GL channels in-game will throw an error on the server about null pointer exception. If you're okay to ignore them, the mod will function perfectly fine with just non-GL kingdom channel on Discord.

Share this post


Link to post
Share on other sites

Does this work for a LAN server?  I wanted to try it out somewhere before taking it live on my actual server. I think I created a bot, and I think I got the token info right in the properties file. But when I open Discord, I see no bot.

 

Edited by Batta

Share this post


Link to post
Share on other sites
Posted (edited)

Does anyone have a bot I could download and use?

Edited by Darkness1990

Share this post


Link to post
Share on other sites

I'm confused about how to set this up.

Drop this in the mods folder. Open the properties file for editing. 

Go to https://discordapp.com/developers/applications/me to make my bot.  Click "Bot"

In the Build-A-Bot section, click Add Bot

Pop-up asks, "Add bot to this server?" Choose "Yes, do it"

Immediately get an error message saying: Too many users have this username, please try another.

I wasn't given any option to create a username...

My Discord server is open.  I already have the Pokecord bot on it.

Now what?

 

OH.  I needed to go change the My application section to the name I wanted my bot to be, before clicking Bot.  Got it.  🙂

Edited by Batta

Share this post


Link to post
Share on other sites

Now how do I link my bot to my Discord channel?  

I added the Client secret to the properties file, patched the change. 

But the bot is not on my Discord, and I'm guessing I've missed a step maybe when creating it?

There was some permissions thing, but all it did was give me the number 8 as a result, and I didn't know what to do with that.

 

OK - For the next guy, here's where i found my answer:

https://discordpy.readthedocs.io/en/rewrite/discord.html

 

Edited by Batta

Share this post


Link to post
Share on other sites

I opened a new server, and my bot stopped working. It is still there, just showing as offline.

I went back and re-did all the bot permissions, and I got a message on Discord saying that the bot had joined the server.

However, the bot remains offline, and I don't know how to make it come back online. 

Anybody know what's wrong here?

 

EDIT:  I figured it out. The properties file asks for the Client Secret, but only works with the actual bot token. 

 

Edited by Batta

Share this post


Link to post
Share on other sites

I am having trouble getting the bot to send any chat from my server to discord. it sends messages from discord to trade and freedom with no problems. it also keeps up to date count of players. any ideas what i am doing wrong?

 

[01:19:44 AM] INFO org.nyxcode.wurm.discordrelay.DiscordRelay: Discord Relay failure: #freedom - [01:19:44] <Gmrezden> test
[01:19:59 AM] INFO org.nyxcode.wurm.discordrelay.DiscordRelay: Discord Relay failure: #trade - [01:19:59] <Gmrezden> (Sto) wtb test
[01:20:33 AM] INFO org.nyxcode.wurm.discordrelay.DiscordRelay: Discord Relay failure: #freedom - [01:20:33] <Gmrezden> test
[01:20:38 AM] INFO org.nyxcode.wurm.discordrelay.DiscordRelay: Discord Relay failure: #gl-freedom - [01:20:38] <Gmrezden> test
[01:21:02 AM] INFO org.nyxcode.wurm.discordrelay.DiscordRelay: Discord Relay failure: #gl-freedom - [01:21:02] <Gmrezden> test
Edited by Rezden

Share this post


Link to post
Share on other sites

Hi, I'm able to get this to work one way only. Messages are sent to my discord fine, but discord messages are not sent to my freedom chat in-game. What am I doing wrong?

 

Edit : fixed by changing discord channel name from freedomisle to freedom

Edited by kronic

Share this post


Link to post
Share on other sites

hi

 

will I be asking you how to put this mode into action step by step?

thx

 

Share this post


Link to post
Share on other sites
5 hours ago, Batta said:

Try this:

 

 

 

yes....I have tried this ... and other procedures here on the forum .... all my done, but when I start/use mod, the server will not start :(

Edited by byxoft

Share this post


Link to post
Share on other sites
16 hours ago, byxoft said:

 

yes....I have tried this ... and other procedures here on the forum .... all my done, but when I start/use mod, the server will not start :(

 

I could suggest things to try, but I don't know how much you already know. Are you experienced with WU mods?

Share this post


Link to post
Share on other sites
13 hours ago, Batta said:

 

I could suggest things to try, but I don't know how much you already know. Are you experienced with WU mods?

yes....i have functional mod: survival, timepay, putontable, mapmod etc. (mapmod - problem i have only with RMI=show players online)

 

discorpmod:

- on wurm server i have mod inserted (and edited by instructions here on forum)

- od discorp web i have created server and bot(edited by instructions here on forum too)

 

and if i RUN WURMSERVER.....start only cmd window and for few seconds is closed all (server aplication do not start)

 

....sry my english :)

Share this post


Link to post
Share on other sites
4 hours ago, byxoft said:

yes....i have functional mod: survival, timepay, putontable, mapmod etc. (mapmod - problem i have only with RMI=show players online)

 

discorpmod:

- on wurm server i have mod inserted (and edited by instructions here on forum)

- od discorp web i have created server and bot(edited by instructions here on forum too)

 

and if i RUN WURMSERVER.....start only cmd window and for few seconds is closed all (server aplication do not start)

 

....sry my english :)

That really does sound like a mod conflict. Maybe try to remove the other mods, then see if the Discord mod works?  If yes, then try adding the other mods back one at a time.

Share this post


Link to post
Share on other sites
19 hours ago, Batta said:

That really does sound like a mod conflict. Maybe try to remove the other mods, then see if the Discord mod works?  If yes, then try adding the other mods back one at a time.

 

ok...i remove all mods ..... no help :(

 

i use server-modlauncher-0.40   is it ok?

Share this post


Link to post
Share on other sites

so...i try everething and with mod: DiscordRelay-2.0 -  application WURMSERVER dont start :(

 

if i use mod: DiscordRelay-v0.2

- application WURMSERVER runs NOPROBLEM....and if i STARTSERVER - BOT on discorp server is online

- on discorp server i add text channels gl-freedom and freedom.....but if i write anything to this channel on discorp or in wurm chat....NOTHING HAPPENS

 

and in command windows is this:

[09:42:59 ODP.] SEVERE org.gotti.wurmunlimited.modloader.server.Listeners: ChannelMessageListener handler for mod DiscordRelay failed
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.LinkedList.checkElementIndex(LinkedList.java:555)
        at java.util.LinkedList.get(LinkedList.java:476)
        at org.nyxcode.wurm.discordrelay.DiscordRelay.onKingdomMessage(DiscordRelay.java:64)
        at org.gotti.wurmunlimited.modloader.server.ServerHook.lambda$fireOnKingdomMessage$10(ServerHook.java:110)
        at org.gotti.wurmunlimited.modloader.server.Listeners.lambda$fire$1(Listeners.java:82)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:479)
        at org.gotti.wurmunlimited.modloader.server.Listeners.fire(Listeners.java:88)
        at org.gotti.wurmunlimited.modloader.server.ServerHook.fireOnKingdomMessage(ServerHook.java:110)
        at org.gotti.wurmunlimited.modloader.server.ProxyServerHook.communicatorChannelHook(ProxyServerHook.java:248)
        at com.wurmonline.server.creatures.Communicator.reallyHandle_CMD_MESSAGE(Communicator.java:6447)
        at com.wurmonline.server.creatures.Communicator.reallyHandle(Communicator.java:2406)
        at com.wurmonline.communication.SocketConnection.tick(SocketConnection.java:618)
        at com.wurmonline.communication.SocketServer.tick(SocketServer.java:172)
        at com.wurmonline.server.Server.run(Server.java:2515)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

 

 

 

pls help

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now