Trying to use relay_bot_messages option
Microjett opened this issue ยท 5 comments
Describe the bug
Hi There, Trying to use relay_bot_messages option however I'm getting a No Value Present error in minecraft when trying to send a message from another bot. Any idea what config changes are needed to fix this ?
This is on 1.20.1 Fabric
[02:25:06] [d4j-events-1/ERROR]: Operator called default onErrorDropped fr.denisd3d.mc2discord.shadow.reactor.core.Exceptions$ErrorCallbackNotImplemented: java.util.NoSuchElementException: No value present Caused by: java.util.NoSuchElementException: No value present at java.util.Optional.get(Unknown Source) ~[?:?] at fr.denisd3d.mc2discord.core.events.DiscordEvent.onMessageCreate(DiscordEvent.java:39) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.tryOnNext(FluxContextWrite.java:115) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxDoFinally$DoFinallyConditionalSubscriber.tryOnNext(FluxDoFinally.java:172) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxPeekFuseable$PeekFuseableConditionalSubscriber.tryOnNext(FluxPeekFuseable.java:530) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxHandleFuseable$HandleFuseableConditionalSubscriber.tryOnNext(FluxHandleFuseable.java:559) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.tryOnNext(FluxMapFuseable.java:317) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.tryOnNext(FluxFilterFuseable.java:367) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxPublishOn$PublishOnConditionalSubscriber.runAsync(FluxPublishOn.java:992) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxPublishOn$PublishOnConditionalSubscriber.run(FluxPublishOn.java:1067) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.scheduler.forkjoin.ForkJoinPoolScheduler$DisposableWorkerTask.run(ForkJoinPoolScheduler.java:443) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at fr.denisd3d.mc2discord.shadow.reactor.scheduler.forkjoin.ForkJoinPoolScheduler$Worker.processTaskQueue(ForkJoinPoolScheduler.java:407) ~[mc2discord-fabric-1.20.1-4.2.3.jar:?] at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(Unknown Source) ~[?:?] at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) ~[?:?] at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source) ~[?:?] at java.util.concurrent.ForkJoinPool.scan(Unknown Source) ~[?:?] at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) ~[?:?] at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) ~[?:?]
Your config file
# Set language for this configuration file. Delete the rest of the file to update. Thanks to the translators: Morty#0273 (ru_ru), PixelVoxel#4327 (ko_kr), thearchy.helios (zh_cn)
# Supported languages: en_us, fr_fr, ru_ru, ko_kr, zh_cn
lang = "en_us"
# Mc2Discord configuration file
# - Curseforge (Download): https://www.curseforge.com/minecraft/mc-mods/mc2discord
# - Modrinth (Download): https://modrinth.com/mod/mc2discord
# - Discord (Support): https://discord.gg/rzzd76c
# - Github (Source code): https://github.com/DenisD3D/Mc2Discord
# - Wiki (Configuration guide): https://github.com/DenisD3D/Mc2Discord/wiki
#
#
# FOLLOW THE CONFIGURATION GUIDE IN THE WIKI: https://github.com/DenisD3D/Mc2Discord/wiki
#
#
# Support is available through the Discord server
[General]
# Token for the Discord bot account, equivalent to a password obtainable through the Discord website (see: https://github.com/DenisD3D/Mc2Discord/wiki/Discord-token)
token = "REDACTED"
# Channels configuration
# One [[Channels.Channel]] block should be created per Discord channel you want to setup
[Channels]
[[Channels.Channel]]
# Id of the Discord channel to send messages in (see: https://github.com/DenisD3D/Mc2Discord/wiki/Discord-ids)
id = REDACTED
# List of messages types to send that will be sent in this channel. Available values: "info", "chat", "command", "logs"
subscriptions = ["info", "chat", "command"]
# Messages format in this channel. Available values: WEBHOOK, PLAIN_TEXT, EMBED
mode = "WEBHOOK"
# Messages content configuration
# Variables (${xxx}) are replaced by corresponding values (see complete list of variables: https://github.com/DenisD3D/Mc2Discord/wiki/Variables)
# "global" variables may be used in any field
[Messages]
# When server start
start = "The server has started"
# When server stop
stop = "The server has stopped"
# When a player join the server ("player" variables are available)
join = "${player_display_name} joined the game"
# When a player join the server ("player" variables are available)
leave = "${player_display_name} left the game"
# When a player die ("player" and "death" variables are available)
death = "${death_message}"
# When a player unlock an advancement ("player" and "advancement" variables are available)
advancement = "${player_display_name} has made the advancement ${advancement_title}. ${advancement_description}."
# Commands configuration
[Commands]
# Prefix before each command. Minecraft default one is '/' (eg : /help)
prefix = "!"
# If true, commands result are sent in a code block (```result```)
use_codeblocks = true
# Commands permissions configuration.
# One [[Commands.Permission]] block should be created per Discord channel you want to setup
[[Commands.Permission]]
# Id of the Discord member or Discord role the permission apply to (0 <=> everyone)
id = 0
# Minecraft permission level that will be allowed, all commands up to that level will be available (-1 <=> No commands, 0 <=> all non-op commands, 3 <=> all op commands)
permission_level = -1
# List of commands that will be allowed in addition of the permission level
commands = [""]
# Enable additional features
# Executing "/mc2discord restart" is required to generate feature-related parts of the configuration file
[Features]
# Regular channels name and topic updates with global variables
status_channels = false
# Minecraft and Discord accounts linking with optional whitelist
account_linking = false
# Style configuration
[Style]
# Override the bot name in webhook and embed mode ("global" variables are available)
bot_name = ""
# Override the bot avatar in webhook and embed mode, must be a valid URL to an image ("global" variables are available)
bot_avatar = ""
# Set the format of the player name appearing next to chat message when using webhook mode ("player" and "global" variables are available)
webhook_display_name = "${player_display_name}"
# URL used to get players head, must be a valid URL to an image ("player" and "global" variables are available)
webhook_avatar_api = "https://mc-heads.net/head/${player_uuid}/right"
# Format used for messages sent in minecraft chat. ("${reply}", "${attachements}", "member", "message", "global" and minecraft formatting variables are available)
minecraft_chat_format = "<Discord - ${member_display_name}> ${reply}${message}"
# Replace ${reply} in minecraft_chat_format if the message has a referenced message. ("member" (author of the referenced message) and "global" variables are available).
reply_format = "Replying to ${member_nickname}: "
# Format used for chat messages in PLAIN_TEXT mode ("player", "message" and "global" variables are available)
discord_chat_format = "**${player_display_name}**: ${message}"
# If true, bot avatar will be shown in the embed for info messages
embed_show_bot_avatar = false
# Embed colors. A color from https://github.com/DenisD3D/Mc2Discord/wiki/Embed-Colors or a decimal color
[Style.EmbedColors]
info = "SUMMER_SKY"
chat = "MEDIUM_SEA_GREEN"
command = "MEDIUM_SEA_GREEN"
log = "SUMMER_SKY"
# Presence configuration
[Style.Presence]
# Message to display under the bot in the member list on Discord ("global" variables are available)
message = "${online_players} / ${max_players} players"
# The type of presence (PLAYING, STREAMING, LISTENING, WATCHING, COMPETING or CUSTOM)
type = "PLAYING"
# Delay between to update of the channel (in seconds, any value below 610 may cause issues)
update = 60
# Only if type is STREAMING, ignored for others type, must be a valid youtube or twitch link.
link = ""
# Miscellaneous settings
[Misc]
# If true, other bots messages will be sent in minecraft chat
relay_bot_messages = true
# List of allowed mentions from minecraft (supported value: "EVERYONE_AND_HERE", "ROLE", "USER")
allowed_mention = ["ROLE", "USER"]
# Text of the /discord command
discord_text = "Invitation link not set"
# Link of the /discord command
discord_link = "https://discord.gg/"
# Format for server logs on Discord
logs_format = "[${log_time|HH:mm:ss}] [${log_thread_name}/${log_level}] [${log_logger_name}]: ${log_message}"
# Level for server logs on Discord (supported values: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL)
logs_level = "INFO"
# List of commands to broadcast to Discord. If absent message will only be sent to Minecraft (supported values: say, me, tellraw)
broadcast_commands = ["say", "me", "tellraw"]
# If true, any message sent by another mod will be logged to the console (used only for configuration of [[Misc.OtherModMessage]], must be disabled after)
verbose_other_mods_messages = false
# Configuration for messages from others mods
# Values may be found on the wiki (https://github.com/DenisD3D/Mc2Discord/wiki/Other-Mods-Messages) or by enabling verbose_other_mods_messages
[[Misc.other_mods_messages]]
# Name of the Java class the message is comming from
class_name = ""
# Index of the class in the stacktrace
class_index = 0
# Type the message will be sent as, must be one found in a Channels.Channel configuration
type = "info"
Hi Denis, Might have found some more about this.
I started with two fresh 1.18.2 forge only servers with no other mods.
Setup both of these with mc2discord and configured two different bots for each server and changed the relay_bot_messages to true in both configs.
With no other changes made to default configs mc2discord was able to relay the server started messages and the player join messages from the other server. but only then crashed with the error in above description when an actual player message was sent.
[13:37:07] [Server thread/INFO] [ne.mi.se.pe.PermissionAPI/]: Successfully initialized permission handlerforge:default_handler [13:37:07] [Server thread/INFO] [Mc2Discord/]: Mc2Discord started as chat-test2#0336 [13:37:09] [fr.denisd3d.mc2discord.shadow.reactor-http-nio-3/INFO] [Mc2Discord/]: Mc2Discord started as chat-test2#0336 [13:37:43] [d4j-events-1/INFO] [minecraft/DedicatedServer]: <Discord - Microjet> test [13:38:13] [d4j-events-3/INFO] [minecraft/DedicatedServer]: <Discord - chat-test1> Microjet joined the game [13:38:24] [d4j-events-2/ERROR] [fr.de.mc.sh.re.co.pu.Operators/]: Operator called default onErrorDropped fr.denisd3d.mc2discord.shadow.reactor.core.Exceptions$ErrorCallbackNotImplemented: java.util.NoSuchElementException: No value present Caused by: java.util.NoSuchElementException: No value present
So this issue seems to be related to the player name in discord being used instead of the bots actual name?
Error is happening due to the bot looking to get informations that doesn't exist for websites messages. I'm gonna need to do an update
Thanks for investigating
Could you send a screen of the message that was sent on the Discord channel when the error occured ?
Denis
Hi Denis,
This was the message sent. The first one directly from Discord worked fine and appeared in MC chat.
But the 2nd comes from another mc server running plexiglass mountain and this one appeared to cause the stacktrace above.
Edit: I should say the other server is also using mc2discord to send messaging from mc plexiglass mountain