Skip to content

Commit

Permalink
add preliminary ticket stuff, add message counting and message reqs f…
Browse files Browse the repository at this point in the history
…or giveaways
  • Loading branch information
SylveonDeko committed Aug 14, 2024
1 parent 011554a commit fe22ea0
Show file tree
Hide file tree
Showing 27 changed files with 10,169 additions and 1,390 deletions.
12 changes: 6 additions & 6 deletions src/Mewdeko/Common/MewdekoSlashModuleBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public abstract class MewdekoSlashCommandModule : InteractionModuleBase
public Task ErrorLocalizedAsync(string? textKey, params object?[] args)
{
var text = GetText(textKey, args);
return ctx.Interaction.SendErrorAsync(text, Config);
return !ctx.Interaction.HasResponded ? ctx.Interaction.SendErrorAsync(text, Config) : ctx.Interaction.SendErrorFollowupAsync(text, Config);
}

/// <summary>
Expand All @@ -74,7 +74,7 @@ public Task ErrorLocalizedAsync(string? textKey, params object?[] args)
public Task ReplyErrorLocalizedAsync(string? textKey, params object?[] args)
{
var text = GetText(textKey, args);
return ctx.Interaction.SendErrorAsync($"{Format.Bold(ctx.User.ToString())} {text}", Config);
return !ctx.Interaction.HasResponded ? ctx.Interaction.SendErrorAsync($"{Format.Bold(ctx.User.ToString())} {text}", Config): ctx.Interaction.SendErrorFollowupAsync($"{Format.Bold(ctx.User.ToString())} {text}", Config);
}

/// <summary>
Expand All @@ -83,7 +83,7 @@ public Task ReplyErrorLocalizedAsync(string? textKey, params object?[] args)
public Task EphemeralReplyErrorLocalizedAsync(string? textKey, params object?[] args)
{
var text = GetText(textKey, args);
return ctx.Interaction.SendEphemeralErrorAsync($"{Format.Bold(ctx.User.ToString())} {text}", Config);
return !ctx.Interaction.HasResponded ? ctx.Interaction.SendEphemeralFollowupErrorAsync($"{Format.Bold(ctx.User.ToString())} {text}", Config) : ctx.Interaction.SendEphemeralErrorAsync($"{Format.Bold(ctx.User.ToString())} {text}", Config);
}

/// <summary>
Expand All @@ -92,7 +92,7 @@ public Task EphemeralReplyErrorLocalizedAsync(string? textKey, params object?[]
public Task ConfirmLocalizedAsync(string? textKey, params object?[] args)
{
var text = GetText(textKey, args);
return ctx.Interaction.SendConfirmAsync(text);
return !ctx.Interaction.HasResponded ? ctx.Interaction.SendConfirmAsync(text) : ctx.Interaction.SendConfirmFollowupAsync(text);
}

/// <summary>
Expand All @@ -101,7 +101,7 @@ public Task ConfirmLocalizedAsync(string? textKey, params object?[] args)
public Task ReplyConfirmLocalizedAsync(string? textKey, params object?[] args)
{
var text = GetText(textKey, args);
return ctx.Interaction.SendConfirmAsync($"{Format.Bold(ctx.User.ToString())} {text}");
return ctx.Interaction.HasResponded ? ctx.Interaction.SendConfirmFollowupAsync($"{Format.Bold(ctx.User.ToString())} {text}") : ctx.Interaction.SendConfirmAsync($"{Format.Bold(ctx.User.ToString())} {text}");
}

/// <summary>
Expand All @@ -110,7 +110,7 @@ public Task ReplyConfirmLocalizedAsync(string? textKey, params object?[] args)
public Task EphemeralReplyConfirmLocalizedAsync(string? textKey, params object?[] args)
{
var text = GetText(textKey, args);
return ctx.Interaction.SendEphemeralConfirmAsync($"{Format.Bold(ctx.User.ToString())} {text}");
return !ctx.Interaction.HasResponded ? ctx.Interaction.SendEphemeralConfirmAsync($"{Format.Bold(ctx.User.ToString())} {text}") : ctx.Interaction.SendEphemeralFollowupConfirmAsync($"{Format.Bold(ctx.User.ToString())} {text}");
}

/// <summary>
Expand Down
24 changes: 24 additions & 0 deletions src/Mewdeko/Database/MewdekoContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public MewdekoContext(DbContextOptions options) : base(options)
/// </summary>
public DbSet<GiveawayUsers> GiveawayUsers { get; set; }

/// <summary>
/// Message Counts
/// </summary>
public DbSet<MessageCount> MessageCounts { get; set; }

/// <summary>
/// Gets or sets the anti-alt settings.
/// </summary>
Expand All @@ -40,6 +45,16 @@ public MewdekoContext(DbContextOptions options) : base(options)
/// </summary>
public DbSet<AntiRaidSetting> AntiRaidSettings { get; set; }

/// <summary>
/// Gets or sets ticket panels
/// </summary>
public DbSet<TicketPanel> TicketPanels { get; set; }

/// <summary>
/// Gets or sets ticket buttons
/// </summary>
public DbSet<TicketButton> TicketButtons { get; set; }

/// <summary>
/// Gets or sets the anti-spam ignore settings.
/// </summary>
Expand Down Expand Up @@ -759,6 +774,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.IsUnique();

#endregion

#region Tickets

modelBuilder.Entity<TicketPanel>()
.HasMany(p => p.Buttons)
.WithOne()
.HasForeignKey(b => b.TicketPanelId);

#endregion
}
}
}
Loading

0 comments on commit fe22ea0

Please sign in to comment.