Merge branch 'master' into feature/update-libs

# Conflicts:
#	Discord Media Loader.Application/Classes/JobScheduler.cs
This commit is contained in:
Serraniel 2021-12-05 22:22:22 +01:00
commit 08921bd22a
Signed by: Serraniel
GPG key ID: 3690B4E7364525D3
3 changed files with 9 additions and 3 deletions

View file

@ -232,6 +232,7 @@ namespace DML.AppCore.Classes
var extensionRequired = !fileName.EndsWith("%name%");
var serverName = "unknown";
string nickname = null;
var socketTextChannel = message.Channel as SocketTextChannel;
if (socketTextChannel != null)
@ -239,6 +240,7 @@ namespace DML.AppCore.Classes
serverName = socketTextChannel.Guild.Name;
serverName = Path.GetInvalidFileNameChars()
.Aggregate(serverName, (current, c) => current.Replace(c, ' '));
nickname = socketTextChannel.GetUser(message.Author.Id).Nickname;
}
var channelName = message.Channel.Name;
@ -252,7 +254,9 @@ namespace DML.AppCore.Classes
.Replace("%name%", a.Filename)
.Replace("%id%", a.Id.ToString())
.Replace("%userid%", message.Author.Id.ToString())
.Replace("%username%", message.Author.Username);
.Replace("%username%", message.Author.Username)
.Replace("%nickname%",
!string.IsNullOrEmpty(nickname) ? nickname : message.Author.Username);
if (extensionRequired)
fileName += Path.GetExtension(a.Filename);

View file

@ -86,7 +86,8 @@ namespace DML.Application.Properties {
///%channel% -> channel name
///%timestamp% -> message timestamp (Unix timestamp)
///%name% -> attachment filename
///%username% -> author name
///%username% -> author username
///%nickname% -> author nickname (if unassigned, username will be used)
///%id% -> attachment id (given by Discord)
///%userid% -> author id (given by discord) ähnelt.
/// </summary>

View file

@ -139,7 +139,8 @@ Flaticons (Roundicons Circle Flat) - Flaticon Basic License</value>
%channel% -&gt; channel name
%timestamp% -&gt; message timestamp (Unix timestamp)
%name% -&gt; attachment filename
%username% -&gt; author name
%username% -&gt; author username
%nickname% -&gt; author nickname (if unassigned, username will be used)
%id% -&gt; attachment id (given by Discord)
%userid% -&gt; author id (given by discord)</value>
</data>