mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
Replaced access to .Context with .ctx
This commit is contained in:
@@ -32,12 +32,12 @@ namespace NadekoBot.Modules.Administration
|
||||
return;
|
||||
|
||||
|
||||
await ((ITextChannel) Context.Channel).ModifyAsync(tcp =>
|
||||
await ((ITextChannel) ctx.Channel).ModifyAsync(tcp =>
|
||||
{
|
||||
tcp.SlowModeInterval = seconds;
|
||||
});
|
||||
|
||||
await Context.OkAsync();
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
|
@@ -29,7 +29,7 @@ namespace NadekoBot.Modules.Administration
|
||||
}
|
||||
|
||||
var aggregatePerms = perms.Aggregate((acc, seed) => seed | acc);
|
||||
await _service.AddOverride(Context.Guild.Id, cmd.Name, aggregatePerms);
|
||||
await _service.AddOverride(ctx.Guild.Id, cmd.Name, aggregatePerms);
|
||||
|
||||
await ReplyConfirmLocalizedAsync("perm_override",
|
||||
Format.Bold(aggregatePerms.ToString()),
|
||||
@@ -47,7 +47,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
if (!result)
|
||||
return;
|
||||
await _service.ClearAllOverrides(Context.Guild.Id);
|
||||
await _service.ClearAllOverrides(ctx.Guild.Id);
|
||||
|
||||
await ReplyConfirmLocalizedAsync("perm_override_all");
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace NadekoBot.Modules.Administration
|
||||
if (--page < 0)
|
||||
return;
|
||||
|
||||
var overrides = await _service.GetAllOverrides(Context.Guild.Id);
|
||||
var overrides = await _service.GetAllOverrides(ctx.Guild.Id);
|
||||
|
||||
await ctx.SendPaginatedConfirmAsync(page, curPage =>
|
||||
{
|
||||
|
@@ -43,8 +43,8 @@ namespace NadekoBot.Modules.Administration
|
||||
return;
|
||||
}
|
||||
|
||||
if (Context.User.Id != Context.Guild.OwnerId &&
|
||||
role.Position >= ((SocketGuildUser) Context.User).Roles.Max(x => x.Position))
|
||||
if (ctx.User.Id != ctx.Guild.OwnerId &&
|
||||
role.Position >= ((SocketGuildUser) ctx.User).Roles.Max(x => x.Position))
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("insuf_perms_u").ConfigureAwait(false);
|
||||
return;
|
||||
|
@@ -385,7 +385,7 @@ namespace NadekoBot.Modules.Administration
|
||||
[Priority(1)]
|
||||
public async Task SetNick(IGuildUser gu, [Leftover] string newNick = null)
|
||||
{
|
||||
var sg = (SocketGuild) Context.Guild;
|
||||
var sg = (SocketGuild) ctx.Guild;
|
||||
if (sg.OwnerId == gu.Id ||
|
||||
gu.GetRoles().Max(r => r.Position) >= sg.CurrentUser.GetRoles().Max(r => r.Position))
|
||||
{
|
||||
|
@@ -168,10 +168,10 @@ namespace NadekoBot.Modules.Administration
|
||||
[Ratelimit(5)]
|
||||
public async Task ByeTest([Leftover] IGuildUser user = null)
|
||||
{
|
||||
user = user ?? (IGuildUser) Context.User;
|
||||
user = user ?? (IGuildUser) ctx.User;
|
||||
|
||||
await _service.ByeTest((ITextChannel)Context.Channel, user);
|
||||
var enabled = _service.GetByeEnabled(Context.Guild.Id);
|
||||
await _service.ByeTest((ITextChannel)ctx.Channel, user);
|
||||
var enabled = _service.GetByeEnabled(ctx.Guild.Id);
|
||||
if (!enabled)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync("byemsg_enable", $"`{Prefix}bye`").ConfigureAwait(false);
|
||||
@@ -184,10 +184,10 @@ namespace NadekoBot.Modules.Administration
|
||||
[Ratelimit(5)]
|
||||
public async Task GreetTest([Leftover] IGuildUser user = null)
|
||||
{
|
||||
user = user ?? (IGuildUser) Context.User;
|
||||
user = user ?? (IGuildUser) ctx.User;
|
||||
|
||||
await _service.GreetTest((ITextChannel)Context.Channel, user);
|
||||
var enabled = _service.GetGreetEnabled(Context.Guild.Id);
|
||||
await _service.GreetTest((ITextChannel)ctx.Channel, user);
|
||||
var enabled = _service.GetGreetEnabled(ctx.Guild.Id);
|
||||
if (!enabled)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync("greetmsg_enable", $"`{Prefix}greet`").ConfigureAwait(false);
|
||||
@@ -200,15 +200,15 @@ namespace NadekoBot.Modules.Administration
|
||||
[Ratelimit(5)]
|
||||
public async Task GreetDmTest([Leftover] IGuildUser user = null)
|
||||
{
|
||||
user = user ?? (IGuildUser) Context.User;
|
||||
user = user ?? (IGuildUser) ctx.User;
|
||||
|
||||
var channel = await user.GetOrCreateDMChannelAsync();
|
||||
var success = await _service.GreetDmTest(channel, user);
|
||||
if (success)
|
||||
await Context.OkAsync();
|
||||
await ctx.OkAsync();
|
||||
else
|
||||
await Context.WarningAsync();
|
||||
var enabled = _service.GetGreetDmEnabled(Context.Guild.Id);
|
||||
await ctx.WarningAsync();
|
||||
var enabled = _service.GetGreetDmEnabled(ctx.Guild.Id);
|
||||
if (!enabled)
|
||||
await ReplyConfirmLocalizedAsync("greetdmmsg_enable", $"`{Prefix}greetdm`").ConfigureAwait(false);
|
||||
}
|
||||
|
@@ -33,14 +33,14 @@ namespace NadekoBot.Modules.Administration
|
||||
private async Task<bool> CheckRoleHierarchy(IGuildUser target)
|
||||
{
|
||||
var curUser = ((SocketGuild) ctx.Guild).CurrentUser;
|
||||
var ownerId = Context.Guild.OwnerId;
|
||||
var ownerId = ctx.Guild.OwnerId;
|
||||
var modMaxRole = ((IGuildUser) ctx.User).GetRoles().Max(r => r.Position);
|
||||
var targetMaxRole = target.GetRoles().Max(r => r.Position);
|
||||
var botMaxRole = curUser.GetRoles().Max(r => r.Position);
|
||||
// bot can't punish a user who is higher in the hierarchy. Discord will return 403
|
||||
// moderator can be owner, in which case role hierarchy doesn't matter
|
||||
// otherwise, moderator has to have a higher role
|
||||
if ((botMaxRole <= targetMaxRole || (Context.User.Id != ownerId && targetMaxRole >= modMaxRole)) || target.Id == ownerId)
|
||||
if ((botMaxRole <= targetMaxRole || (ctx.User.Id != ownerId && targetMaxRole >= modMaxRole)) || target.Id == ownerId)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("hierarchy");
|
||||
return false;
|
||||
@@ -150,7 +150,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
var opts = OptionsParser.ParseFrom<WarnExpireOptions>(args);
|
||||
|
||||
await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
|
||||
await _service.WarnExpireAsync(ctx.Guild.Id, days, opts.Delete).ConfigureAwait(false);
|
||||
if(days == 0)
|
||||
@@ -425,7 +425,7 @@ namespace NadekoBot.Modules.Administration
|
||||
if (time.Time > TimeSpan.FromDays(49))
|
||||
return;
|
||||
|
||||
var guildUser = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(Context.Guild.Id, user.Id);
|
||||
var guildUser = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, user.Id);
|
||||
|
||||
if (guildUser != null && !await CheckRoleHierarchy(guildUser))
|
||||
return;
|
||||
@@ -450,7 +450,7 @@ namespace NadekoBot.Modules.Administration
|
||||
}
|
||||
}
|
||||
|
||||
await _mute.TimedBan(Context.Guild, user, time.Time, ctx.User.ToString() + " | " + msg).ConfigureAwait(false);
|
||||
await _mute.TimedBan(ctx.Guild, user, time.Time, ctx.User.ToString() + " | " + msg).ConfigureAwait(false);
|
||||
var toSend = _eb.Create().WithOkColor()
|
||||
.WithTitle("⛔️ " + GetText("banned_user"))
|
||||
.AddField(GetText("username"), user.ToString(), true)
|
||||
@@ -473,7 +473,7 @@ namespace NadekoBot.Modules.Administration
|
||||
[Priority(0)]
|
||||
public async Task Ban(ulong userId, [Leftover] string msg = null)
|
||||
{
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(Context.Guild.Id, userId);
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId);
|
||||
if (user is null)
|
||||
{
|
||||
await ctx.Guild.AddBanAsync(userId, 7, ctx.User.ToString() + " | " + msg);
|
||||
@@ -540,7 +540,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
if (message is null)
|
||||
{
|
||||
var template = _service.GetBanTemplate(Context.Guild.Id);
|
||||
var template = _service.GetBanTemplate(ctx.Guild.Id);
|
||||
if (template is null)
|
||||
{
|
||||
await ReplyConfirmLocalizedAsync("banmsg_default");
|
||||
@@ -551,7 +551,7 @@ namespace NadekoBot.Modules.Administration
|
||||
return;
|
||||
}
|
||||
|
||||
_service.SetBanTemplate(Context.Guild.Id, message);
|
||||
_service.SetBanTemplate(ctx.Guild.Id, message);
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ namespace NadekoBot.Modules.Administration
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task BanMsgReset()
|
||||
{
|
||||
_service.SetBanTemplate(Context.Guild.Id, null);
|
||||
_service.SetBanTemplate(ctx.Guild.Id, null);
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ namespace NadekoBot.Modules.Administration
|
||||
var dmChannel = await ctx.User.GetOrCreateDMChannelAsync();
|
||||
var defaultMessage = GetText("bandm", Format.Bold(ctx.Guild.Name), reason);
|
||||
var embed = _service.GetBanUserDmEmbed(Context,
|
||||
(IGuildUser)Context.User,
|
||||
(IGuildUser)ctx.User,
|
||||
defaultMessage,
|
||||
reason,
|
||||
duration);
|
||||
@@ -607,7 +607,7 @@ namespace NadekoBot.Modules.Administration
|
||||
return;
|
||||
}
|
||||
|
||||
await Context.OkAsync();
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ namespace NadekoBot.Modules.Administration
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task Softban(ulong userId, [Leftover] string msg = null)
|
||||
{
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(Context.Guild.Id, userId);
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId);
|
||||
if (user is null)
|
||||
return;
|
||||
|
||||
@@ -725,7 +725,7 @@ namespace NadekoBot.Modules.Administration
|
||||
[Priority(0)]
|
||||
public async Task Kick(ulong userId, [Leftover] string msg = null)
|
||||
{
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(Context.Guild.Id, userId);
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId);
|
||||
if (user is null)
|
||||
return;
|
||||
|
||||
|
@@ -188,7 +188,7 @@ namespace NadekoBot.Modules.CustomReactions
|
||||
return;
|
||||
}
|
||||
|
||||
var cr = _service.GetCustomReaction(Context.Guild?.Id, id);
|
||||
var cr = _service.GetCustomReaction(ctx.Guild?.Id, id);
|
||||
if (cr is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_found").ConfigureAwait(false);
|
||||
@@ -211,7 +211,7 @@ namespace NadekoBot.Modules.CustomReactions
|
||||
// i should try adding these emojis right away to the message, to make sure the bot can react with these emojis. If it fails, skip that emoji
|
||||
try
|
||||
{
|
||||
await Context.Message.AddReactionAsync(emote).ConfigureAwait(false);
|
||||
await ctx.Message.AddReactionAsync(emote).ConfigureAwait(false);
|
||||
await Task.Delay(100).ConfigureAwait(false);
|
||||
succ.Add(emojiStr);
|
||||
|
||||
|
@@ -516,7 +516,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
|
||||
List<DiscordUser> cleanRichest = new List<DiscordUser>();
|
||||
// it's pointless to have clean on dm context
|
||||
if (Context.Guild is null)
|
||||
if (ctx.Guild is null)
|
||||
{
|
||||
opts.Clean = false;
|
||||
}
|
||||
@@ -530,10 +530,10 @@ namespace NadekoBot.Modules.Gambling
|
||||
cleanRichest = uow.DiscordUser.GetTopRichest(_client.CurrentUser.Id, 10_000);
|
||||
}
|
||||
|
||||
await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await _tracker.EnsureUsersDownloadedAsync(ctx.Guild).ConfigureAwait(false);
|
||||
|
||||
var sg = (SocketGuild)Context.Guild;
|
||||
var sg = (SocketGuild)ctx.Guild;
|
||||
cleanRichest = cleanRichest.Where(x => sg.GetUser(x.UserId) != null)
|
||||
.ToList();
|
||||
}
|
||||
@@ -545,7 +545,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
}
|
||||
}
|
||||
|
||||
await Context.SendPaginatedConfirmAsync(page, curPage =>
|
||||
await ctx.SendPaginatedConfirmAsync(page, curPage =>
|
||||
{
|
||||
var embed = _eb.Create()
|
||||
.WithOkColor()
|
||||
|
@@ -356,7 +356,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
if (--index < 0 || price <= 0)
|
||||
return;
|
||||
|
||||
var succ = await _service.ChangeEntryPriceAsync(Context.Guild.Id, index, price);
|
||||
var succ = await _service.ChangeEntryPriceAsync(ctx.Guild.Id, index, price);
|
||||
if (succ)
|
||||
{
|
||||
await ShopInternalAsync(index / 9);
|
||||
@@ -376,7 +376,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
if (--index < 0 || string.IsNullOrWhiteSpace(newName))
|
||||
return;
|
||||
|
||||
var succ = await _service.ChangeEntryNameAsync(Context.Guild.Id, index, newName);
|
||||
var succ = await _service.ChangeEntryNameAsync(ctx.Guild.Id, index, newName);
|
||||
if (succ)
|
||||
{
|
||||
await ShopInternalAsync(index / 9);
|
||||
@@ -396,7 +396,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
if (--index1 < 0 || --index2 < 0 || index1 == index2)
|
||||
return;
|
||||
|
||||
var succ = await _service.SwapEntriesAsync(Context.Guild.Id, index1, index2);
|
||||
var succ = await _service.SwapEntriesAsync(ctx.Guild.Id, index1, index2);
|
||||
if (succ)
|
||||
{
|
||||
await ShopInternalAsync(index1 / 9);
|
||||
@@ -416,7 +416,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
if (--fromIndex < 0 || --toIndex < 0 || fromIndex == toIndex)
|
||||
return;
|
||||
|
||||
var succ = await _service.MoveEntryAsync(Context.Guild.Id, fromIndex, toIndex);
|
||||
var succ = await _service.MoveEntryAsync(ctx.Guild.Id, fromIndex, toIndex);
|
||||
if (succ)
|
||||
{
|
||||
await ShopInternalAsync(toIndex / 9);
|
||||
|
@@ -110,7 +110,7 @@ namespace NadekoBot.Modules.Games
|
||||
.WithDescription(removed.Text.TrimTo(50))
|
||||
.WithOkColor();
|
||||
|
||||
await Context.Channel.EmbedAsync(embed);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Music
|
||||
await voiceChannelLock.WaitAsync();
|
||||
try
|
||||
{
|
||||
if (botUser.VoiceChannel?.Id is null || !_service.TryGetMusicPlayer(Context.Guild.Id, out _))
|
||||
if (botUser.VoiceChannel?.Id is null || !_service.TryGetMusicPlayer(ctx.Guild.Id, out _))
|
||||
await _service.JoinVoiceChannelAsync(ctx.Guild.Id, voiceChannelId);
|
||||
}
|
||||
finally
|
||||
@@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Music
|
||||
|
||||
private async Task<bool> QueuePreconditionInternalAsync()
|
||||
{
|
||||
var user = (IGuildUser) Context.User;
|
||||
var user = (IGuildUser) ctx.User;
|
||||
var voiceChannelId = user.VoiceChannel?.Id;
|
||||
|
||||
if (voiceChannelId is null)
|
||||
@@ -93,7 +93,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (!succ)
|
||||
return;
|
||||
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
@@ -101,7 +101,7 @@ namespace NadekoBot.Modules.Music
|
||||
}
|
||||
|
||||
var (trackInfo, index) = await mp.TryEnqueueTrackAsync(query,
|
||||
Context.User.ToString(),
|
||||
ctx.User.ToString(),
|
||||
asNext,
|
||||
forcePlatform);
|
||||
if (trackInfo is null)
|
||||
@@ -121,7 +121,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (!string.IsNullOrWhiteSpace(trackInfo.Thumbnail))
|
||||
embed.WithThumbnailUrl(trackInfo.Thumbnail);
|
||||
|
||||
var queuedMessage = await _service.SendToOutputAsync(Context.Guild.Id, embed).ConfigureAwait(false);
|
||||
var queuedMessage = await _service.SendToOutputAsync(ctx.Guild.Id, embed).ConfigureAwait(false);
|
||||
queuedMessage?.DeleteAfter(10, _logService);
|
||||
if (mp.IsStopped)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (!succ)
|
||||
return;
|
||||
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
@@ -159,7 +159,7 @@ namespace NadekoBot.Modules.Music
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Join()
|
||||
{
|
||||
var user = (IGuildUser) Context.User;
|
||||
var user = (IGuildUser) ctx.User;
|
||||
|
||||
var voiceChannelId = user.VoiceChannel?.Id;
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (!valid)
|
||||
return;
|
||||
|
||||
await _service.LeaveVoiceChannelAsync(Context.Guild.Id);
|
||||
await _service.LeaveVoiceChannelAsync(ctx.Guild.Id);
|
||||
}
|
||||
|
||||
// play - no args = next
|
||||
@@ -241,7 +241,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (!valid)
|
||||
return;
|
||||
|
||||
var success = await _service.PlayAsync(Context.Guild.Id, ((IGuildUser)Context.User).VoiceChannel.Id);
|
||||
var success = await _service.PlayAsync(ctx.Guild.Id, ((IGuildUser)ctx.User).VoiceChannel.Id);
|
||||
if (!success)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
@@ -436,7 +436,7 @@ namespace NadekoBot.Modules.Music
|
||||
.WithFooter(song.PrettyInfo())
|
||||
.WithErrorColor();
|
||||
|
||||
await _service.SendToOutputAsync(Context.Guild.Id, embed);
|
||||
await _service.SendToOutputAsync(ctx.Guild.Id, embed);
|
||||
}
|
||||
|
||||
public enum All { All = -1 }
|
||||
@@ -553,7 +553,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (string.IsNullOrWhiteSpace(dirPath))
|
||||
return;
|
||||
|
||||
var user = (IGuildUser) Context.User;
|
||||
var user = (IGuildUser) ctx.User;
|
||||
var voiceChannelId = user.VoiceChannel?.Id;
|
||||
|
||||
if (voiceChannelId is null)
|
||||
@@ -573,7 +573,7 @@ namespace NadekoBot.Modules.Music
|
||||
return;
|
||||
}
|
||||
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
@@ -599,7 +599,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (!valid)
|
||||
return;
|
||||
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
@@ -642,7 +642,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (!succ)
|
||||
return;
|
||||
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
@@ -667,14 +667,14 @@ namespace NadekoBot.Modules.Music
|
||||
if (!succ)
|
||||
return;
|
||||
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
return;
|
||||
}
|
||||
|
||||
_ = Context.Channel.TriggerTypingAsync();
|
||||
_ = ctx.Channel.TriggerTypingAsync();
|
||||
|
||||
|
||||
var queuedCount = await _service.EnqueueYoutubePlaylistAsync(mp, playlistQuery, ctx.User.ToString());
|
||||
@@ -690,7 +690,7 @@ namespace NadekoBot.Modules.Music
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task NowPlaying()
|
||||
{
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
@@ -718,7 +718,7 @@ namespace NadekoBot.Modules.Music
|
||||
if (!valid)
|
||||
return;
|
||||
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
|
@@ -38,7 +38,7 @@ namespace NadekoBot.Modules.Music
|
||||
await voiceChannelLock.WaitAsync();
|
||||
try
|
||||
{
|
||||
if (botUser.VoiceChannel?.Id is null || !_service.TryGetMusicPlayer(Context.Guild.Id, out _))
|
||||
if (botUser.VoiceChannel?.Id is null || !_service.TryGetMusicPlayer(ctx.Guild.Id, out _))
|
||||
await _service.JoinVoiceChannelAsync(ctx.Guild.Id, voiceChannelId);
|
||||
}
|
||||
finally
|
||||
@@ -182,7 +182,7 @@ namespace NadekoBot.Modules.Music
|
||||
await _playlistLock.WaitAsync();
|
||||
try
|
||||
{
|
||||
var user = (IGuildUser) Context.User;
|
||||
var user = (IGuildUser) ctx.User;
|
||||
var voiceChannelId = user.VoiceChannel?.Id;
|
||||
|
||||
if (voiceChannelId is null)
|
||||
@@ -202,7 +202,7 @@ namespace NadekoBot.Modules.Music
|
||||
return;
|
||||
}
|
||||
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) Context.Channel);
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
|
||||
if (mp is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("no_player");
|
||||
|
@@ -375,7 +375,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
public Task NsfwClearCache()
|
||||
{
|
||||
_service.ClearCache();
|
||||
return Context.OkAsync();
|
||||
return ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
|
@@ -80,9 +80,9 @@ namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
Func<double, double> f = StandardConversions.CelsiusToFahrenheit;
|
||||
|
||||
var tz = Context.Guild is null
|
||||
var tz = ctx.Guild is null
|
||||
? TimeZoneInfo.Utc
|
||||
: _tzSvc.GetTimeZoneOrUtc(Context.Guild.Id);
|
||||
: _tzSvc.GetTimeZoneOrUtc(ctx.Guild.Id);
|
||||
var sunrise = data.Sys.Sunrise.ToUnixTimestamp();
|
||||
var sunset = data.Sys.Sunset.ToUnixTimestamp();
|
||||
sunrise = sunrise.ToOffset(tz.GetUtcOffset(sunrise));
|
||||
@@ -738,7 +738,7 @@ namespace NadekoBot.Modules.Searches
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
return;
|
||||
|
||||
await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
|
||||
var appId = await _service.GetSteamAppIdByName(query).ConfigureAwait(false);
|
||||
if (appId == -1)
|
||||
|
@@ -13,7 +13,7 @@ namespace NadekoBot.Modules.Searches
|
||||
// [RequireContext(ContextType.Guild)]
|
||||
// public async Task YtFollow(string ytChannelId, [Leftover] string uploadMessage = null)
|
||||
// {
|
||||
// var succ = await _service.ToggleChannelFollowAsync(Context.Guild.Id, Context.Channel.Id, ytChannelId, uploadMessage);
|
||||
// var succ = await _service.ToggleChannelFollowAsync(ctx.Guild.Id, ctx.Channel.Id, ytChannelId, uploadMessage);
|
||||
// if(succ)
|
||||
// {
|
||||
// await ReplyConfirmLocalizedAsync("yt_follow_added").ConfigureAwait(false);
|
||||
@@ -28,7 +28,7 @@ namespace NadekoBot.Modules.Searches
|
||||
// [RequireContext(ContextType.Guild)]
|
||||
// public async Task YtTrackRm(int index)
|
||||
// {
|
||||
// //var succ = await _service.ToggleChannelTrackingAsync(Context.Guild.Id, Context.Channel.Id, ytChannelId, uploadMessage);
|
||||
// //var succ = await _service.ToggleChannelTrackingAsync(ctx.Guild.Id, ctx.Channel.Id, ytChannelId, uploadMessage);
|
||||
// //if (succ)
|
||||
// //{
|
||||
// // await ReplyConfirmLocalizedAsync("yt_track_added").ConfigureAwait(false);
|
||||
@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Searches
|
||||
// [RequireContext(ContextType.Guild)]
|
||||
// public async Task YtTrackList()
|
||||
// {
|
||||
// //var succ = await _service.ToggleChannelTrackingAsync(Context.Guild.Id, Context.Channel.Id, ytChannelId, uploadMessage);
|
||||
// //var succ = await _service.ToggleChannelTrackingAsync(ctx.Guild.Id, ctx.Channel.Id, ytChannelId, uploadMessage);
|
||||
// //if (succ)
|
||||
// //{
|
||||
// // await ReplyConfirmLocalizedAsync("yt_track_added").ConfigureAwait(false);
|
||||
|
@@ -96,7 +96,7 @@ namespace NadekoBot.Modules.Utility
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
quote = uow.Quotes.GetById(id);
|
||||
if (quote.GuildId != Context.Guild.Id)
|
||||
if (quote.GuildId != ctx.Guild.Id)
|
||||
quote = null;
|
||||
}
|
||||
|
||||
|
@@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Utility
|
||||
);
|
||||
}
|
||||
|
||||
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private string GetRepeaterInfoString(RunningRepeater runner)
|
||||
|
@@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
message = rep.Replace(message);
|
||||
|
||||
await channel.SendAsync(message, !((IGuildUser)Context.User).GuildPermissions.MentionEveryone);
|
||||
await channel.SendAsync(message, !((IGuildUser)ctx.User).GuildPermissions.MentionEveryone);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -98,7 +98,7 @@ namespace NadekoBot.Modules.Utility
|
||||
if (--page < 0)
|
||||
return;
|
||||
|
||||
await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await _tracker.EnsureUsersDownloadedAsync(ctx.Guild).ConfigureAwait(false);
|
||||
|
||||
var users = await ctx.Guild.GetUsersAsync();
|
||||
|
@@ -205,7 +205,7 @@ namespace NadekoBot.Modules.Xp
|
||||
.AddField(GetText("xpn_setting_global"), GetNotifLocationString(globalSetting))
|
||||
.AddField(GetText("xpn_setting_server"), GetNotifLocationString(serverSetting));
|
||||
|
||||
await Context.Channel.EmbedAsync(embed);
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -315,13 +315,13 @@ namespace NadekoBot.Modules.Xp
|
||||
|
||||
var (opts, _) = OptionsParser.ParseFrom(new LbOpts(), args);
|
||||
|
||||
await Context.Channel.TriggerTypingAsync();
|
||||
await ctx.Channel.TriggerTypingAsync();
|
||||
|
||||
var socketGuild = ((SocketGuild)ctx.Guild);
|
||||
List<UserXpStats> allUsers = new List<UserXpStats>();
|
||||
if (opts.Clean)
|
||||
{
|
||||
await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
await _tracker.EnsureUsersDownloadedAsync(ctx.Guild).ConfigureAwait(false);
|
||||
|
||||
allUsers = _service.GetTopUserXps(ctx.Guild.Id, 1000)
|
||||
|
Reference in New Issue
Block a user