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