From 179778dc0360dcf093169eda612ccd314c238f7c Mon Sep 17 00:00:00 2001 From: strelzia Date: Mon, 4 May 2026 16:52:36 +0200 Subject: [PATCH 1/2] [discord] guild chat now displays the discord nickname rather than the discord username. --- Modules/DiscordRelay.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/DiscordRelay.php b/Modules/DiscordRelay.php index d82e2cf..20057b5 100644 --- a/Modules/DiscordRelay.php +++ b/Modules/DiscordRelay.php @@ -453,7 +453,10 @@ function cron($cron) if ($this->bot->core("settings")->get("discord", "IncLog")) $this->bot->log("DISCORD", "Incoming", ucfirst($msg['author']['username']).": ".strip_tags($msg['content'])); if(substr($msg['content'],0,1)!=$this->bot->commpre) { if(mb_detect_encoding($msg['content'], 'UTF-8', true)) $msg['content'] = mb_convert_encoding($msg['content'], 'ISO-8859-1', 'UTF-8'); - $sent = "[Discord] ".ucfirst($msg['author']['username']).": ".strip_tags($msg['content']); + $nickname = isset($msg['author']['global_name']) && $msg['author']['global_name'] !== null + ? $msg['author']['global_name'] + : $msg['author']['username']; + $sent = "[Discord] ".ucfirst($nickname).": ".strip_tags($msg['content']); $this->bot->send_output("", $sent,$this->bot->core("settings")->get("discord", "WhatChat")); if ($this->bot->exists_module("irc")&&$this->bot->core("settings")->get("Discord", "IrcRelay")) { $this->bot->core("irc")->send_irc("", "", $sent); @@ -799,4 +802,4 @@ function discord_sm() } -?> \ No newline at end of file +?> From e7768684aaf85abd5949bca2af636ab37c4c8897 Mon Sep 17 00:00:00 2001 From: strelzia Date: Mon, 11 May 2026 05:36:11 +0200 Subject: [PATCH 2/2] Fixed a bug where a variable was always overwritten. --- Modules/DiscordRelay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/DiscordRelay.php b/Modules/DiscordRelay.php index 20057b5..371d0bd 100644 --- a/Modules/DiscordRelay.php +++ b/Modules/DiscordRelay.php @@ -440,7 +440,7 @@ function cron($cron) $channel = $this->bot->core("settings")->get("discord", "ChannelId"); if ($channel>0 && $token!="") { if ($this->lastmsg>0) { $route = "/channels/{$channel}/messages?after=".$this->lastmsg; } - $route = "/channels/{$channel}/messages"; + else $route = "/channels/{$channel}/messages"; $result = discord_get($route, $token); if ($this->lastcheck==0) $this->lastcheck = date('Y-m-d').'T'.date("H:i:s").'.000000+00:00'; if(is_array($result)&&!is_null($result)) $invert = array_reverse($result);