Skip to content

Commit

Permalink
Added @username to the message sent from Discord
Browse files Browse the repository at this point in the history
  • Loading branch information
easly1989 committed Nov 13, 2019
1 parent a975573 commit dddef2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions DFAssist/Helpers/DiscordHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,30 @@ protected override void OnSendNotification(string title, string message, string
return;
}

if(string.IsNullOrWhiteSpace(MainControl.DiscordUsernameTextBox.Text))
var username = MainControl.DiscordUsernameTextBox.Text;
if(string.IsNullOrWhiteSpace(username))
{
Logger.Write("UI: Specify a Username for the Discord settings", LogLevel.Warn);
return;
}

if(string.IsNullOrWhiteSpace(MainControl.DiscordWebhookTextBox.Text))
var webhookUrl = MainControl.DiscordWebhookTextBox.Text;
if(string.IsNullOrWhiteSpace(webhookUrl))
{
Logger.Write("UI: Specify a valid Webhook URL for the Discord settings", LogLevel.Warn);
return;
}

Logger.Write("UI: Sending Discord Notification...", LogLevel.Debug);

var content = $"{title}\n>>>>> {message}";
var content = $"@{username} | {title}\n>>>>> {message}";
if(!string.IsNullOrWhiteSpace(testing))
content += $" [{testing}]";

var webhook = new Webhook(MainControl.DiscordWebhookTextBox.Text);
var webhook = new Webhook(webhookUrl);
var webHookObj = new WebhookObject
{
username = MainControl.DiscordUsernameTextBox.Text,
username = username,
content = content
};

Expand Down
4 changes: 2 additions & 2 deletions SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
// to distinguish one build from another. AssemblyFileVersion is specified
// in AssemblyVersionInfo.cs so that it can be easily incremented by the
// automated build process.
[assembly: AssemblyVersion("2.2.3")]
[assembly: AssemblyVersion("2.2.4")]

// By default, the "Product version" shown in the file properties window is
// the same as the value specified for AssemblyFileVersionAttribute.
// Set AssemblyInformationalVersionAttribute to be the same as
// AssemblyVersionAttribute so that the "Product version" in the file
// properties window matches the version displayed in the GAC shell extension.
[assembly: AssemblyInformationalVersion("2.2.3")] // a.k.a. "Product version"
[assembly: AssemblyInformationalVersion("2.2.4")] // a.k.a. "Product version"

0 comments on commit dddef2d

Please sign in to comment.