[Cmd, Aliases, RequireContext(ContextType.Guild), UserPerm(GuildPermission.ManageMessages)]public async Task GEnd(ulong messageid){ await using var uow = db.GetDbContext(); var giveaway = uow.Giveaways.GiveawaysForGuild(ctx.Guild.Id).FirstOrDefault(x => x.MessageId == messageid); if (giveaway == null) { await ctx.Channel.SendErrorAsync("No Giveaway with that message ID exists! Please try again!"); return; } if (giveaway.Ended == 1) { await ctx.Channel.SendErrorAsync($"This giveaway has already ended! Use `{await guildSettings.GetPrefix(ctx.Guild)}greroll {messageid}` to reroll!"); return; } var channel = await Context.Guild.GetTextChannelAsync(giveaway.ChannelId); if (channel == null) { await ctx.Channel.SendErrorAsync("Giveaway channel not found!"); return; } await Service.GiveawayTimerAction(giveaway, channel.Guild, channel); await ctx.Channel.SendConfirmAsync("Giveaway ended!");}
[Cmd, Aliases, RequireContext(ContextType.Guild), UserPerm(GuildPermission.ManageMessages)]public async Task GEnd(ulong messageid){ await using var uow = db.GetDbContext(); var gway = uow.Giveaways.GiveawaysForGuild(ctx.Guild.Id).FirstOrDefault(x => x.MessageId == messageid); if (gway == null) { await ctx.Channel.SendErrorAsync("No Giveaway with that message ID exists! Please try again!").ConfigureAwait(false); return; } if (gway.Ended == 1) { await ctx.Channel.SendErrorAsync( $"This giveaway has already ended! Please use `{await guildSettings.GetPrefix(ctx.Guild)}greroll {messageid}` to reroll!").ConfigureAwait(false); return; } var channel = await Context.Guild.GetTextChannelAsync(gway.ChannelId); if (channel == null) { await ctx.Channel.SendErrorAsync("Giveaway channel not found!").ConfigureAwait(false); return; } await Service.GiveawayTimerAction(gway, channel.Guild, channel).ConfigureAwait(false); await ctx.Channel.SendConfirmAsync("Giveaway ended!").ConfigureAwait(false);}