Cleanup
This commit is contained in:
parent
5e267435d4
commit
f53c77ec9d
@ -24,6 +24,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
[Group]
|
[Group]
|
||||||
public class PlantPickCommands : NadekoSubmodule<GamesService>
|
public class PlantPickCommands : NadekoSubmodule<GamesService>
|
||||||
{
|
{
|
||||||
|
//todo rewrite
|
||||||
private readonly CurrencyService _cs;
|
private readonly CurrencyService _cs;
|
||||||
private readonly IBotConfigProvider _bc;
|
private readonly IBotConfigProvider _bc;
|
||||||
private readonly DbService _db;
|
private readonly DbService _db;
|
||||||
@ -42,10 +43,10 @@ namespace NadekoBot.Modules.Games
|
|||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
var channel = (ITextChannel)Context.Channel;
|
||||||
|
|
||||||
|
///waaaaaat
|
||||||
if (!(await channel.Guild.GetCurrentUserAsync()).GetPermissions(channel).ManageMessages)
|
if (!(await channel.Guild.GetCurrentUserAsync()).GetPermissions(channel).ManageMessages)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
try { await Context.Message.DeleteAsync().ConfigureAwait(false); } catch { }
|
try { await Context.Message.DeleteAsync().ConfigureAwait(false); } catch { }
|
||||||
if (!_service.PlantedFlowers.TryRemove(channel.Id, out List<IUserMessage> msgs))
|
if (!_service.PlantedFlowers.TryRemove(channel.Id, out List<IUserMessage> msgs))
|
||||||
return;
|
return;
|
||||||
@ -72,6 +73,9 @@ namespace NadekoBot.Modules.Games
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IUserMessage msg = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
var imgData = _service.GetRandomCurrencyImage();
|
var imgData = _service.GetRandomCurrencyImage();
|
||||||
|
|
||||||
var msgToSend = GetText("planted",
|
var msgToSend = GetText("planted",
|
||||||
@ -84,11 +88,12 @@ namespace NadekoBot.Modules.Games
|
|||||||
else
|
else
|
||||||
msgToSend += " " + GetText("pick_sn", Prefix);
|
msgToSend += " " + GetText("pick_sn", Prefix);
|
||||||
|
|
||||||
IUserMessage msg;
|
|
||||||
using (var toSend = imgData.Data.ToStream())
|
using (var toSend = imgData.Data.ToStream())
|
||||||
{
|
{
|
||||||
msg = await Context.Channel.SendFileAsync(toSend, imgData.Name, msgToSend).ConfigureAwait(false);
|
msg = await Context.Channel.SendFileAsync(toSend, imgData.Name, msgToSend).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
var msgs = new IUserMessage[amount];
|
var msgs = new IUserMessage[amount];
|
||||||
msgs[0] = msg;
|
msgs[0] = msg;
|
||||||
|
@ -55,8 +55,8 @@ namespace NadekoBot.Core.Services.Database.Models
|
|||||||
public bool FilterInvites { get; set; }
|
public bool FilterInvites { get; set; }
|
||||||
public HashSet<FilterChannelId> FilterInvitesChannelIds { get; set; } = new HashSet<FilterChannelId>();
|
public HashSet<FilterChannelId> FilterInvitesChannelIds { get; set; } = new HashSet<FilterChannelId>();
|
||||||
|
|
||||||
public bool FilterLinks { get; set; }
|
//public bool FilterLinks { get; set; }
|
||||||
public HashSet<FilterLinksChannelId> FilterLinksChannels { get; set; } = new HashSet<FilterLinksChannelId>();
|
//public HashSet<FilterLinksChannelId> FilterLinksChannels { get; set; } = new HashSet<FilterLinksChannelId>();
|
||||||
|
|
||||||
public bool FilterWords { get; set; }
|
public bool FilterWords { get; set; }
|
||||||
public HashSet<FilteredWord> FilteredWords { get; set; } = new HashSet<FilteredWord>();
|
public HashSet<FilteredWord> FilteredWords { get; set; } = new HashSet<FilteredWord>();
|
||||||
|
@ -185,7 +185,7 @@ namespace NadekoBot
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
toReturn.Add(x);
|
toReturn.Add(x);
|
||||||
_log.Info("Loaded {0} typereader.", x.GetType().Name);
|
//_log.Info("Loaded {0} typereader.", x.GetType().Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
@ -250,7 +250,15 @@ namespace NadekoBot
|
|||||||
await LoginAsync(Credentials.Token).ConfigureAwait(false);
|
await LoginAsync(Credentials.Token).ConfigureAwait(false);
|
||||||
|
|
||||||
_log.Info($"Shard {Client.ShardId} loading services...");
|
_log.Info($"Shard {Client.ShardId} loading services...");
|
||||||
|
try
|
||||||
|
{
|
||||||
AddServices();
|
AddServices();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.Error(ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
_log.Info($"Shard {Client.ShardId} connected in {sw.Elapsed.TotalSeconds:F2}s");
|
_log.Info($"Shard {Client.ShardId} connected in {sw.Elapsed.TotalSeconds:F2}s");
|
||||||
|
Loading…
Reference in New Issue
Block a user