Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Discord Username #281

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Jellyfin.Plugin.Webhook/Configuration/Web/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ export default function (view) {
setConfig: function (config, element) {
Webhook.baseConfig.setConfig(config, element);
element.querySelector("[data-name=txtAvatarUrl]").value = config.AvatarUrl || "";
element.querySelector("[data-name=txtUsername]").value = config.Username || "";
element.querySelector("[data-name=txtUsername]").value = config.BotUsername || "";
element.querySelector("[data-name=ddlMentionType]").value = config.MentionType || "None";
element.querySelector("[data-name=txtEmbedColor]").value = config.EmbedColor || Webhook.discord.defaultEmbedColor;
element.querySelector("[data-name=EmbedColor]").value = config.EmbedColor || Webhook.discord.defaultEmbedColor;
},
getConfig: function (e) {
const config = Webhook.baseConfig.getConfig(e);
config.AvatarUrl = e.querySelector("[data-name=txtAvatarUrl]").value || "";
config.Username = e.querySelector("[data-name=txtUsername]").value || "";
config.BotUsername = e.querySelector("[data-name=txtUsername]").value || "";
config.MentionType = e.querySelector("[data-name=ddlMentionType]").value || "";
config.EmbedColor = e.querySelector("[data-name=txtEmbedColor]").value || "";
return config;
Expand Down
5 changes: 2 additions & 3 deletions Jellyfin.Plugin.Webhook/Destinations/Discord/DiscordClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ public async Task SendAsync(DiscordOption option, Dictionary<string, object> dat
data["AvatarUrl"] = option.AvatarUrl;
}

if (!string.IsNullOrEmpty(option.Username))
if (!string.IsNullOrEmpty(option.BotUsername))
{
data["Username"] = option.Username;
data["BotUsername"] = option.Username;
data["BotUsername"] = option.BotUsername;
}

var body = option.GetMessageBody(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class DiscordOption : BaseOption
/// <summary>
/// Gets or sets the bot username.
/// </summary>
public string? Username { get; set; }
public string? BotUsername { get; set; }

/// <summary>
/// Gets or sets the mention type.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ See [Templates](Jellyfin.Plugin.Webhook/Templates) for sample templates.
- Current user name
- Username
- Current user name
- BotUsername
- user name for Discord/Slack
- UserId
- User ID
- LastLoginDate
Expand Down