Some fixes
This commit is contained in:
parent
670df57e86
commit
42d169f157
|
@ -56,15 +56,17 @@ namespace DeukBot4.MessageHandlers
|
|||
using (var client = new WebClient())
|
||||
{
|
||||
var content = client.DownloadData(attachment.Url);
|
||||
var uri = new Uri($"{Settings.URL}/{attachment.Filename}");
|
||||
var uri = new Uri($"{Settings.URL}/{attachment.Filename}-{DateTime.UtcNow:s}");
|
||||
client.Credentials = new NetworkCredential(Settings.Username, Settings.Password);
|
||||
try
|
||||
{
|
||||
client.UploadData(uri, "PUT", content);
|
||||
var attachmentSplit = attachment.Filename.Split('.');
|
||||
var eb = new EmbedBuilder()
|
||||
{
|
||||
Title = "Image Backed Up",
|
||||
Description = $"Image with the name {attachment.Filename} was backed up",
|
||||
Description = $"Image with the name ``{attachment.Filename}`` was backed up as " +
|
||||
$"``{attachmentSplit[0]}-{DateTime.UtcNow:s}.{attachmentSplit[1]}``",
|
||||
ThumbnailUrl = attachment.Url,
|
||||
Timestamp = DateTime.UtcNow
|
||||
};
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace DeukBot4.MessageHandlers
|
|||
CommandHandler.CommandHandler.HandleMessage(message);
|
||||
HandlePrivateMessage(message);
|
||||
ImageBackupHandler.Backup(message);
|
||||
DeltaHandler(message);
|
||||
#pragma warning restore 4014
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -33,5 +34,21 @@ namespace DeukBot4.MessageHandlers
|
|||
await Logger.Log(($"Private Message: {message.Author.Username}- {message.Content}"));
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task DeltaHandler(SocketMessage message)
|
||||
{
|
||||
var lower = message.Content.ToLowerInvariant().Split(' ');
|
||||
foreach (var s in lower)
|
||||
{
|
||||
var diff = Utilities.Lehvenstein.LevenshteinDistance(s, "delta");
|
||||
if (diff <= 1)
|
||||
{
|
||||
await message.Channel.SendMessageAsync("uhh excuse me it's called Origin and it's an art");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,6 +51,7 @@ namespace DeukBot4
|
|||
await Client.CurrentUser.ModifyAsync(properties =>
|
||||
{
|
||||
properties.Username = Settings.Username;
|
||||
properties.Avatar = new Image("avatar.png");
|
||||
});
|
||||
BotId = Client.CurrentUser.Id;
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
Loading…
Reference in New Issue