startup commands will no longer be treated as if theyr'e run in DMs

This commit is contained in:
Kwoth 2017-04-01 13:47:05 +02:00
parent 83dbc562af
commit 3a5aed213b
2 changed files with 32 additions and 6 deletions

View File

@ -1,7 +1,10 @@
using Discord; using Discord;
using Discord.Commands; using Discord.Commands;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Attributes; using NadekoBot.Attributes;
using NadekoBot.Extensions; using NadekoBot.Extensions;
using NadekoBot.Services;
using NadekoBot.Services.Database;
using NLog; using NLog;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
@ -118,6 +121,30 @@ namespace NadekoBot.Modules.Administration
.ConfigureAwait(false); .ConfigureAwait(false);
} }
} }
//[NadekoCommand, Usage, Description, Aliases]
//[RequireContext(ContextType.Guild)]
//[RequireUserPermission(GuildPermission.ManageMessages)]
//public async Task SlowmodeWhitelist(IUser user)
//{
// Ratelimiter throwaway;
// if (RatelimitingChannels.TryRemove(Context.Channel.Id, out throwaway))
// {
// throwaway.cancelSource.Cancel();
// await ReplyConfirmLocalized("slowmode_disabled").ConfigureAwait(false);
// }
//}
//[NadekoCommand, Usage, Description, Aliases]
//[RequireContext(ContextType.Guild)]
//[RequireUserPermission(GuildPermission.ManageMessages)]
//public async Task SlowmodeWhitelist(IRole role)
//{
// using (var uow = DbHandler.UnitOfWork())
// {
// uow.GuildConfigs.For(Context.Guild.Id, set => set.Include(x => x.SlowmodeWhitelists)).
// }
//}
} }
} }
} }

View File

@ -36,11 +36,9 @@ namespace NadekoBot.Modules.Administration
var _ = Task.Run(async () => var _ = Task.Run(async () =>
{ {
#if !GLOBAL_NADEKO while(!NadekoBot.Ready)
await Task.Delay(2000); await Task.Delay(1000);
#else
await Task.Delay(10000);
#endif
foreach (var cmd in NadekoBot.BotConfig.StartupCommands) foreach (var cmd in NadekoBot.BotConfig.StartupCommands)
{ {
if (cmd.GuildId != null) if (cmd.GuildId != null)
@ -52,7 +50,8 @@ namespace NadekoBot.Modules.Administration
try try
{ {
var msg = await channel.SendMessageAsync(cmd.CommandText).ConfigureAwait(false); IUserMessage msg = await channel.SendMessageAsync(cmd.CommandText).ConfigureAwait(false);
msg = (IUserMessage)await channel.GetMessageAsync(msg.Id).ConfigureAwait(false);
await NadekoBot.CommandHandler.TryRunCommand(guild, channel, msg).ConfigureAwait(false); await NadekoBot.CommandHandler.TryRunCommand(guild, channel, msg).ConfigureAwait(false);
//msg.DeleteAfter(5); //msg.DeleteAfter(5);
} }