mirror of
https://github.com/jellyfin/jellyfin-plugin-webhook.git
synced 2024-11-23 14:09:55 +00:00
Merge pull request #57 from jellyfin/bot-username
Update Username parameter to be NotificationUsername
This commit is contained in:
commit
f21ee45828
@ -64,6 +64,7 @@ namespace Jellyfin.Plugin.Webhook.Destinations.Discord
|
||||
if (!string.IsNullOrEmpty(options.Username))
|
||||
{
|
||||
data["Username"] = options.Username;
|
||||
data["BotUsername"] = options.Username;
|
||||
}
|
||||
|
||||
var body = options.GetMessageBody(data);
|
||||
|
@ -49,6 +49,7 @@ namespace Jellyfin.Plugin.Webhook.Destinations.Slack
|
||||
}
|
||||
|
||||
data["SlackUsername"] = options.Username;
|
||||
data["BotUsername"] = options.Username;
|
||||
data["SlackIconUrl"] = options.IconUrl;
|
||||
|
||||
var body = options.GetMessageBody(data);
|
||||
|
@ -248,7 +248,7 @@ namespace Jellyfin.Plugin.Webhook.Helpers
|
||||
/// <returns>The modified data object.</returns>
|
||||
public static Dictionary<string, object> AddUserData(this Dictionary<string, object> dataObject, UserDto user)
|
||||
{
|
||||
dataObject["Username"] = user.Name.Escape();
|
||||
dataObject["NotificationUsername"] = user.Name.Escape();
|
||||
dataObject["UserId"] = user.Id;
|
||||
dataObject[nameof(user.LastLoginDate)] = user.LastLoginDate ?? DateTime.UtcNow;
|
||||
dataObject[nameof(user.LastActivityDate)] = user.LastActivityDate ?? DateTime.MinValue;
|
||||
@ -264,7 +264,7 @@ namespace Jellyfin.Plugin.Webhook.Helpers
|
||||
/// <returns>The modified data object.</returns>
|
||||
public static Dictionary<string, object> AddUserData(this Dictionary<string, object> dataObject, User user)
|
||||
{
|
||||
dataObject["Username"] = user.Username.Escape();
|
||||
dataObject["NotificationUsername"] = user.Username.Escape();
|
||||
dataObject["UserId"] = user.Id;
|
||||
dataObject[nameof(user.LastLoginDate)] = user.LastLoginDate ?? DateTime.UtcNow;
|
||||
dataObject[nameof(user.LastActivityDate)] = user.LastActivityDate ?? DateTime.MinValue;
|
||||
@ -282,7 +282,7 @@ namespace Jellyfin.Plugin.Webhook.Helpers
|
||||
{
|
||||
dataObject[nameof(sessionInfo.Id)] = sessionInfo.Id;
|
||||
dataObject[nameof(sessionInfo.UserId)] = sessionInfo.UserId;
|
||||
dataObject[nameof(sessionInfo.UserName)] = sessionInfo.UserName.Escape();
|
||||
dataObject["NotificationUsername"] = sessionInfo.UserName.Escape();
|
||||
dataObject[nameof(sessionInfo.Client)] = sessionInfo.Client.Escape();
|
||||
dataObject[nameof(sessionInfo.LastActivityDate)] = sessionInfo.LastActivityDate;
|
||||
dataObject[nameof(sessionInfo.LastPlaybackCheckIn)] = sessionInfo.LastPlaybackCheckIn;
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"content": "{{MentionType}}",
|
||||
"avatar_url": "{{AvatarUrl}}",
|
||||
"username": "{{{Username}}}",
|
||||
"username": "{{{BotUsername}}}",
|
||||
"embeds": [
|
||||
{
|
||||
"color": "{{EmbedColor}}",
|
||||
@ -58,4 +58,4 @@
|
||||
[Jellyfin]({{ServerUrl}}/web/index.html#!/details?id={{ItemId}}&serverId={{ServerId}})"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,4 @@
|
||||
"Url": "{{Url}}",
|
||||
"Username": "{{{Username}}}",
|
||||
"UserId": "{{UserId}}"
|
||||
}
|
||||
}
|
||||
|
@ -41,4 +41,4 @@
|
||||
"title": "{{{Name}}} ({{Year}}) has been added to {{{ServerName}}}"
|
||||
{{/if_equals}}
|
||||
{{/if_equals}}
|
||||
}
|
||||
}
|
||||
|
@ -17,4 +17,4 @@
|
||||
"body": "{{{Name}}} ({{Year}}) has been added to {{{ServerName}}}"
|
||||
{{/if_equals}}
|
||||
{{/if_equals}}
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,4 @@
|
||||
"message": "{{{Name}}} ({{Year}}) has been added to {{{ServerName}}}"
|
||||
{{/if_equals}}
|
||||
{{/if_equals}}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
{{#if_exist SlackUsername}}
|
||||
"username": "{{SlackUsername}}",
|
||||
"username": "{{BotUsername}}",
|
||||
{{/if_exist}}
|
||||
{{#if_exist SlackIconUrl}}
|
||||
"icon_url": "{{SlackIconUrl}}",
|
||||
@ -14,4 +14,4 @@
|
||||
"text": "{{{Name}}} ({{Year}}) has been added to {{{ServerName}}}",
|
||||
{{/if_equals}}
|
||||
{{/if_equals}}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ See [Templates](Jellyfin.Plugin.Webhook/Templates) for sample templates.
|
||||
- Playback device name
|
||||
- ClientName
|
||||
- Playback client name
|
||||
- Username
|
||||
- NotificationUsername
|
||||
- User playing item. Note: multiple notifications will be sent if there are multiple users in a session
|
||||
- UserId
|
||||
- The user Id
|
||||
@ -109,7 +109,7 @@ See [Templates](Jellyfin.Plugin.Webhook/Templates) for sample templates.
|
||||
- MentionType
|
||||
- EmbedColor
|
||||
- AvatarUrl
|
||||
- Username
|
||||
- BotUsername
|
||||
- Gotify
|
||||
- Priority
|
||||
- Pushbullet
|
||||
@ -123,6 +123,9 @@ See [Templates](Jellyfin.Plugin.Webhook/Templates) for sample templates.
|
||||
- MessagePriority
|
||||
- NotificationSound
|
||||
- SMTP
|
||||
- Slack
|
||||
- BotUsername
|
||||
- SlackIconUrl
|
||||
|
||||
Future events can be created
|
||||
from https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs
|
||||
from https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs
|
||||
|
Loading…
Reference in New Issue
Block a user