public static async Task PerformAsync(ShardedCommandContext context, DataBase db) { var guild = FindOrCreateGuild.Perform(context.Guild, db); if (EnsureActiveSubscription.Perform(guild, db)) { var service = new SubscriptionService(); var subscription = service.Get(guild.SubscriptionId); var amount = subscription.Plan.Amount; var date = subscription.CurrentPeriodEnd; var message = $"Your current subscription will renew {date.Value.ToLongDateString()}.\n" + $"To cancel your subscription, use the `!volt cancel` command."; await context.Channel.SendMessageAsync(text : message); } else { var size = context.Guild.MemberCount <= 200 ? "s" : "l"; var url = $"https://nminchow.github.io/VoltaireWeb/upgrade?serverId={context.Guild.Id.ToString()}&type={size}"; var view = Views.Info.Pro.Response(url, guild, db); try { await context.Channel.SendMessageAsync(view.Item1, embed : view.Item2); } catch (Discord.Net.HttpException e) { await context.Channel.SendMessageAsync(text : $"Use this URL to upgrade to Volatire Pro: {url}"); } } }
public static async Task PerformAsync(SocketCommandContext context, string identifier, DataBase db) { if (!ValidIdentifier(identifier)) { await context.Channel.SendMessageAsync("Please use the 4 digit number following the identifier to ban users."); return; } var guild = FindOrCreateGuild.Perform(context.Guild, db); if (!EnsureActiveSubscription.Perform(guild, db)) { await context.Channel.SendMessageAsync("You need an active Voltaire Pro subscription to ban users. To get started, use `!volt pro`"); return; } if (guild.BannedIdentifiers.Any(x => x.Identifier == identifier)) { await context.Channel.SendMessageAsync("That identifier is already banned!"); return; } guild.BannedIdentifiers.Add(new BannedIdentifier { Identifier = identifier }); db.SaveChanges(); await context.Channel.SendMessageAsync(text : $"{identifier} is now banned"); }
public static async Task PerformAsync(UnifiedContext context, string identifier, DataBase db) { if (!ValidIdentifier(identifier)) { await Send.SendErrorWithDeleteReaction(context, "Please use the 4 digit number following the identifier to ban users."); return; } var guild = await FindOrCreateGuild.Perform(context.Guild, db); if (!EnsureActiveSubscription.Perform(guild, db)) { await Send.SendErrorWithDeleteReaction(context, "You need an active Voltaire Pro subscription to ban users. To get started, use `/pro`"); return; } if (guild.BannedIdentifiers.Any(x => x.Identifier == identifier)) { await Send.SendErrorWithDeleteReaction(context, "That identifier is already banned!"); return; } guild.BannedIdentifiers.Add(new BannedIdentifier { Identifier = identifier }); await db.SaveChangesAsync(); await Send.SendMessageToContext(context, $"{identifier} is now banned"); }
public static async Task PerformAsync(SocketCommandContext context, SocketRole role, DataBase db) { var guild = FindOrCreateGuild.Perform(context.Guild, db); if (!EnsureActiveSubscription.Perform(guild, db)) { await context.Channel.SendMessageAsync("You need an active Voltaire Pro subscription to set an admin role. To get started, use `!volt pro`"); return; } guild.AdminRole = role.Id.ToString(); db.SaveChanges(); await context.Channel.SendMessageAsync(text : $"{role.Name} can now configure Voltaire and ban users on this server."); }
public static async Task PerformAsync(ShardedCommandContext context, DataBase db) { var guild = FindOrCreateGuild.Perform(context.Guild, db); if (EnsureActiveSubscription.Perform(guild, db)) { var service = new SubscriptionService(); var options = new SubscriptionCancelOptions { Prorate = false }; service.Cancel(guild.SubscriptionId, options); await context.Channel.SendMessageAsync(text : "Your subscription has been canceled. Use `!volt pro` to re-upgrade at any time!"); } else { await context.Channel.SendMessageAsync(text : "You do not currently have an active Voltaire Pro subscription. To create one, use the" + " `!volt pro` command."); } }
public static async Task PerformAsync(ShardedCommandContext context, DataBase db) { var guild = FindOrCreateGuild.Perform(context.Guild, db); if (EnsureActiveSubscription.Perform(guild, db)) { var service = new SubscriptionService(); var subscription = service.Get(guild.SubscriptionId); var amount = subscription.Plan.Amount; var date = subscription.CurrentPeriodEnd; var message = $"Your current subscription will renew {date.Value.ToLongDateString()}.\n" + $"To cancel your subscription, use the `!volt cancel` command."; await context.Channel.SendMessageAsync(text : message); } else { var size = context.Guild.MemberCount <= 200 ? "s" : "l"; //var url = $"https://nminchow.github.io/VoltaireWeb/upgrade?serverId={context.Guild.Id.ToString()}&type={size}"; var url = $"CURRENTLY NOT SUPPORTED (but everybody is pro anyway <3 )"; await context.Channel.SendMessageAsync(text : $"Use this URL to upgrade to Volatire Pro: {url}"); } }