mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
Merge branch 'v5' of https://gitlab.com/kwoth/nadekobot into v5
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
using NadekoBot.Services.Database.Models;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Utility.Services;
|
namespace NadekoBot.Modules.Utility.Services;
|
||||||
|
|
||||||
public interface IRemindService
|
public interface IRemindService
|
||||||
@@ -8,5 +10,6 @@ public interface IRemindService
|
|||||||
ulong? guildId,
|
ulong? guildId,
|
||||||
bool isPrivate,
|
bool isPrivate,
|
||||||
DateTime time,
|
DateTime time,
|
||||||
string message);
|
string message,
|
||||||
|
ReminderType reminderType);
|
||||||
}
|
}
|
@@ -9,4 +9,11 @@ public class Reminder : DbEntity
|
|||||||
public ulong UserId { get; set; }
|
public ulong UserId { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public bool IsPrivate { get; set; }
|
public bool IsPrivate { get; set; }
|
||||||
|
public ReminderType Type { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ReminderType
|
||||||
|
{
|
||||||
|
User,
|
||||||
|
Timely
|
||||||
}
|
}
|
@@ -149,10 +149,24 @@ public partial class Gambling : GamblingModule<GamblingService>
|
|||||||
ctx.Guild?.Id,
|
ctx.Guild?.Id,
|
||||||
true,
|
true,
|
||||||
when,
|
when,
|
||||||
GetText(strs.timely_time));
|
GetText(strs.timely_time),
|
||||||
|
ReminderType.Timely);
|
||||||
|
|
||||||
await smc.RespondConfirmAsync(_eb, GetText(strs.remind_timely(tt)), ephemeral: true);
|
await smc.RespondConfirmAsync(_eb, GetText(strs.remind_timely(tt)), ephemeral: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NadekoInteraction CreateRemindMeInteraction(int period)
|
||||||
|
{
|
||||||
|
return _inter
|
||||||
|
.Create(ctx.User.Id,
|
||||||
|
new SimpleInteraction<DateTime>(
|
||||||
|
new ButtonBuilder(
|
||||||
|
label: "Remind me",
|
||||||
|
emote: Emoji.Parse("⏰"),
|
||||||
|
customId: "timely:remind_me"),
|
||||||
|
RemindTimelyAction,
|
||||||
|
DateTime.UtcNow.Add(TimeSpan.FromHours(period))));
|
||||||
|
}
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
public async Task Timely()
|
public async Task Timely()
|
||||||
@@ -164,12 +178,20 @@ public partial class Gambling : GamblingModule<GamblingService>
|
|||||||
await ReplyErrorLocalizedAsync(strs.timely_none);
|
await ReplyErrorLocalizedAsync(strs.timely_none);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var inter = CreateRemindMeInteraction(period);
|
||||||
|
|
||||||
if (await _service.ClaimTimelyAsync(ctx.User.Id, period) is { } rem)
|
if (await _service.ClaimTimelyAsync(ctx.User.Id, period) is { } rem)
|
||||||
{
|
{
|
||||||
|
// Removes timely button if there is a timely reminder in DB
|
||||||
|
if (_service.UserHasTimelyReminder(ctx.User.Id))
|
||||||
|
{
|
||||||
|
inter = null;
|
||||||
|
}
|
||||||
|
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
var relativeTag = TimestampTag.FromDateTime(now.Add(rem), TimestampTagStyles.Relative);
|
var relativeTag = TimestampTag.FromDateTime(now.Add(rem), TimestampTagStyles.Relative);
|
||||||
await ReplyPendingLocalizedAsync(strs.timely_already_claimed(relativeTag));
|
await ReplyPendingLocalizedAsync(strs.timely_already_claimed(relativeTag), inter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,19 +201,9 @@ public partial class Gambling : GamblingModule<GamblingService>
|
|||||||
|
|
||||||
await _cs.AddAsync(ctx.User.Id, val, new("timely", "claim"));
|
await _cs.AddAsync(ctx.User.Id, val, new("timely", "claim"));
|
||||||
|
|
||||||
var inter = _inter
|
|
||||||
.Create(ctx.User.Id,
|
|
||||||
new SimpleInteraction<DateTime>(
|
|
||||||
new ButtonBuilder(
|
|
||||||
label: "Remind me",
|
|
||||||
emote: Emoji.Parse("⏰"),
|
|
||||||
customId: "timely:remind_me"),
|
|
||||||
RemindTimelyAction,
|
|
||||||
DateTime.UtcNow.Add(TimeSpan.FromHours(period))));
|
|
||||||
|
|
||||||
await ReplyConfirmLocalizedAsync(strs.timely(N(val), period), inter);
|
await ReplyConfirmLocalizedAsync(strs.timely(N(val), period), inter);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public async Task TimelyReset()
|
public async Task TimelyReset()
|
||||||
|
@@ -209,6 +209,13 @@ public class GamblingService : INService, IReadyExecutor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UserHasTimelyReminder(ulong userId)
|
||||||
|
{
|
||||||
|
var db = _db.GetDbContext();
|
||||||
|
return db.GetTable<Reminder>().Any(x => x.UserId == userId
|
||||||
|
&& x.Type == ReminderType.Timely);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task RemoveAllTimelyClaimsAsync()
|
public async Task RemoveAllTimelyClaimsAsync()
|
||||||
=> await _cache.RemoveAsync(_timelyKey);
|
=> await _cache.RemoveAsync(_timelyKey);
|
||||||
}
|
}
|
@@ -269,8 +269,9 @@ public partial class Gambling
|
|||||||
? "-"
|
? "-"
|
||||||
: string.Join("\n",
|
: string.Join("\n",
|
||||||
itemList.Where(x => waifuItems.TryGetValue(x.ItemEmoji, out _))
|
itemList.Where(x => waifuItems.TryGetValue(x.ItemEmoji, out _))
|
||||||
.OrderBy(x => waifuItems[x.ItemEmoji].Price)
|
.OrderByDescending(x => waifuItems[x.ItemEmoji].Price)
|
||||||
.GroupBy(x => x.ItemEmoji)
|
.GroupBy(x => x.ItemEmoji)
|
||||||
|
.Take(60)
|
||||||
.Select(x => $"{x.Key} x{x.Count(),-3}")
|
.Select(x => $"{x.Key} x{x.Count(),-3}")
|
||||||
.Chunk(2)
|
.Chunk(2)
|
||||||
.Select(x => string.Join(" ", x)));
|
.Select(x => string.Join(" ", x)));
|
||||||
@@ -283,8 +284,10 @@ public partial class Gambling
|
|||||||
|
|
||||||
var fansList = await _service.GetFansNames(wi.WaifuId);
|
var fansList = await _service.GetFansNames(wi.WaifuId);
|
||||||
var fansStr = fansList
|
var fansStr = fansList
|
||||||
.Select((x) => claimsNames.Contains(x) ? $"{x} 💞" : x)
|
.Shuffle()
|
||||||
.Join('\n');
|
.Take(30)
|
||||||
|
.Select((x) => claimsNames.Contains(x) ? $"{x} 💞" : x)
|
||||||
|
.Join('\n');
|
||||||
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(fansStr))
|
if (string.IsNullOrWhiteSpace(fansStr))
|
||||||
@@ -370,4 +373,4 @@ public partial class Gambling
|
|||||||
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
|
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,8 @@ public partial class Utility
|
|||||||
if (!await RemindInternal(target,
|
if (!await RemindInternal(target,
|
||||||
meorhere == MeOrHere.Me || ctx.Guild is null,
|
meorhere == MeOrHere.Me || ctx.Guild is null,
|
||||||
remindData.Time,
|
remindData.Time,
|
||||||
remindData.What))
|
remindData.What,
|
||||||
|
ReminderType.User))
|
||||||
await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ public partial class Utility
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!await RemindInternal(channel.Id, false, remindData.Time, remindData.What))
|
if (!await RemindInternal(channel.Id, false, remindData.Time, remindData.What, ReminderType.User))
|
||||||
await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +173,8 @@ public partial class Utility
|
|||||||
ulong targetId,
|
ulong targetId,
|
||||||
bool isPrivate,
|
bool isPrivate,
|
||||||
TimeSpan ts,
|
TimeSpan ts,
|
||||||
string message)
|
string message,
|
||||||
|
ReminderType reminderType)
|
||||||
{
|
{
|
||||||
var time = DateTime.UtcNow + ts;
|
var time = DateTime.UtcNow + ts;
|
||||||
|
|
||||||
|
@@ -232,7 +232,8 @@ public class RemindService : INService, IReadyExecutor, IRemindService
|
|||||||
ulong? guildId,
|
ulong? guildId,
|
||||||
bool isPrivate,
|
bool isPrivate,
|
||||||
DateTime time,
|
DateTime time,
|
||||||
string message)
|
string message,
|
||||||
|
ReminderType reminderType)
|
||||||
{
|
{
|
||||||
var rem = new Reminder
|
var rem = new Reminder
|
||||||
{
|
{
|
||||||
@@ -242,6 +243,7 @@ public class RemindService : INService, IReadyExecutor, IRemindService
|
|||||||
IsPrivate = isPrivate,
|
IsPrivate = isPrivate,
|
||||||
When = time,
|
When = time,
|
||||||
Message = message,
|
Message = message,
|
||||||
|
Type = reminderType
|
||||||
};
|
};
|
||||||
|
|
||||||
await using var ctx = _db.GetDbContext();
|
await using var ctx = _db.GetDbContext();
|
||||||
|
@@ -58,17 +58,17 @@ public partial class Xp
|
|||||||
[Cmd]
|
[Cmd]
|
||||||
public async Task ClubCreate([Leftover] string clubName)
|
public async Task ClubCreate([Leftover] string clubName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(clubName) || clubName.Length > 20)
|
var result = await _service.CreateClubAsync(ctx.User, clubName);
|
||||||
|
|
||||||
|
if (result == ClubCreateResult.NameTooLong)
|
||||||
{
|
{
|
||||||
await ReplyErrorLocalizedAsync(strs.club_name_too_long);
|
await ReplyErrorLocalizedAsync(strs.club_name_too_long);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await _service.CreateClubAsync(ctx.User, clubName);
|
|
||||||
|
|
||||||
if (result == ClubCreateResult.NameTaken)
|
if (result == ClubCreateResult.NameTaken)
|
||||||
{
|
{
|
||||||
await ReplyErrorLocalizedAsync(strs.club_create_error_name);
|
await ReplyErrorLocalizedAsync(strs.club_name_taken);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,5 +420,32 @@ public partial class Xp
|
|||||||
|
|
||||||
return ctx.Channel.EmbedAsync(embed);
|
return ctx.Channel.EmbedAsync(embed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Cmd]
|
||||||
|
public async Task ClubRename([Leftover] string clubName)
|
||||||
|
{
|
||||||
|
var res = await _service.RenameClubAsync(ctx.User.Id, clubName);
|
||||||
|
|
||||||
|
switch (res)
|
||||||
|
{
|
||||||
|
case ClubRenameResult.NameTooLong:
|
||||||
|
await ReplyErrorLocalizedAsync(strs.club_name_too_long);
|
||||||
|
return;
|
||||||
|
case ClubRenameResult.Success:
|
||||||
|
{
|
||||||
|
var embed = _eb.Create().WithTitle(GetText(strs.club_renamed(clubName))).WithOkColor();
|
||||||
|
await ctx.Channel.EmbedAsync(embed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case ClubRenameResult.NameTaken:
|
||||||
|
await ReplyErrorLocalizedAsync(strs.club_name_taken);
|
||||||
|
return;
|
||||||
|
case ClubRenameResult.NotOwnerOrAdmin:
|
||||||
|
await ReplyErrorLocalizedAsync(strs.club_admin_perms);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -22,6 +22,9 @@ public class ClubService : INService, IClubService
|
|||||||
|
|
||||||
public async Task<ClubCreateResult> CreateClubAsync(IUser user, string clubName)
|
public async Task<ClubCreateResult> CreateClubAsync(IUser user, string clubName)
|
||||||
{
|
{
|
||||||
|
if (!CheckClubName(clubName))
|
||||||
|
return ClubCreateResult.NameTooLong;
|
||||||
|
|
||||||
//must be lvl 5 and must not be in a club already
|
//must be lvl 5 and must not be in a club already
|
||||||
|
|
||||||
await using var uow = _db.GetDbContext();
|
await using var uow = _db.GetDbContext();
|
||||||
@@ -316,4 +319,31 @@ public class ClubService : INService, IClubService
|
|||||||
using var uow = _db.GetDbContext();
|
using var uow = _db.GetDbContext();
|
||||||
return uow.Set<ClubInfo>().GetClubLeaderboardPage(page);
|
return uow.Set<ClubInfo>().GetClubLeaderboardPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ClubRenameResult> RenameClubAsync(ulong userId, string clubName)
|
||||||
|
{
|
||||||
|
if (!CheckClubName(clubName))
|
||||||
|
return ClubRenameResult.NameTooLong;
|
||||||
|
|
||||||
|
await using var uow = _db.GetDbContext();
|
||||||
|
|
||||||
|
var club = uow.Set<ClubInfo>().GetByOwnerOrAdmin(userId);
|
||||||
|
|
||||||
|
if (club is null)
|
||||||
|
return ClubRenameResult.NotOwnerOrAdmin;
|
||||||
|
|
||||||
|
if (await uow.Set<ClubInfo>().AnyAsyncEF(x => x.Name == clubName))
|
||||||
|
return ClubRenameResult.NameTaken;
|
||||||
|
|
||||||
|
club.Name = clubName;
|
||||||
|
|
||||||
|
await uow.SaveChangesAsync();
|
||||||
|
|
||||||
|
return ClubRenameResult.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool CheckClubName(string clubName)
|
||||||
|
{
|
||||||
|
return !(string.IsNullOrWhiteSpace(clubName) || clubName.Length > 20);
|
||||||
|
}
|
||||||
}
|
}
|
@@ -21,6 +21,7 @@ public interface IClubService
|
|||||||
ClubUnbanResult UnBan(ulong ownerUserId, string userName, out ClubInfo club);
|
ClubUnbanResult UnBan(ulong ownerUserId, string userName, out ClubInfo club);
|
||||||
ClubKickResult Kick(ulong kickerId, string userName, out ClubInfo club);
|
ClubKickResult Kick(ulong kickerId, string userName, out ClubInfo club);
|
||||||
List<ClubInfo> GetClubLeaderboardPage(int page);
|
List<ClubInfo> GetClubLeaderboardPage(int page);
|
||||||
|
Task<ClubRenameResult> RenameClubAsync(ulong userId, string clubName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ClubApplyResult
|
public enum ClubApplyResult
|
||||||
|
@@ -6,4 +6,5 @@ public enum ClubCreateResult
|
|||||||
AlreadyInAClub,
|
AlreadyInAClub,
|
||||||
NameTaken,
|
NameTaken,
|
||||||
InsufficientLevel,
|
InsufficientLevel,
|
||||||
|
NameTooLong
|
||||||
}
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
namespace NadekoBot.Modules.Xp.Services;
|
||||||
|
|
||||||
|
public enum ClubRenameResult
|
||||||
|
{
|
||||||
|
NotOwnerOrAdmin,
|
||||||
|
Success,
|
||||||
|
NameTaken,
|
||||||
|
NameTooLong
|
||||||
|
}
|
@@ -238,10 +238,11 @@ public abstract class NadekoContext : DbContext
|
|||||||
.HasForeignKey<ClubInfo>(x => x.OwnerId)
|
.HasForeignKey<ClubInfo>(x => x.OwnerId)
|
||||||
.OnDelete(DeleteBehavior.SetNull);
|
.OnDelete(DeleteBehavior.SetNull);
|
||||||
|
|
||||||
ci.HasAlternateKey(x => new
|
ci.HasIndex(x => new
|
||||||
{
|
{
|
||||||
x.Name
|
x.Name
|
||||||
});
|
})
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
3633
src/NadekoBot/Migrations/Mysql/20230813113816_timely-reminder-type.Designer.cs
generated
Normal file
3633
src/NadekoBot/Migrations/Mysql/20230813113816_timely-reminder-type.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace NadekoBot.Db.Migrations.Mysql
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class timelyremindertype : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "type",
|
||||||
|
table: "reminders",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "type",
|
||||||
|
table: "reminders");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3633
src/NadekoBot/Migrations/Mysql/20230903153202_clubinfo-name-index.Designer.cs
generated
Normal file
3633
src/NadekoBot/Migrations/Mysql/20230903153202_clubinfo-name-index.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,73 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace NadekoBot.Db.Migrations.Mysql
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class clubinfonameindex : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropUniqueConstraint(
|
||||||
|
name: "ak_clubs_name",
|
||||||
|
table: "clubs");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "name",
|
||||||
|
table: "clubs",
|
||||||
|
type: "varchar(20)",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: true,
|
||||||
|
collation: "utf8mb4_bin",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(20)",
|
||||||
|
oldMaxLength: 20,
|
||||||
|
oldCollation: "utf8mb4_bin")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_clubs_name",
|
||||||
|
table: "clubs",
|
||||||
|
column: "name",
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "ix_clubs_name",
|
||||||
|
table: "clubs");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "clubs",
|
||||||
|
keyColumn: "name",
|
||||||
|
keyValue: null,
|
||||||
|
column: "name",
|
||||||
|
value: "");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "name",
|
||||||
|
table: "clubs",
|
||||||
|
type: "varchar(20)",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: false,
|
||||||
|
collation: "utf8mb4_bin",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(20)",
|
||||||
|
oldMaxLength: 20,
|
||||||
|
oldNullable: true,
|
||||||
|
oldCollation: "utf8mb4_bin")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddUniqueConstraint(
|
||||||
|
name: "ak_clubs_name",
|
||||||
|
table: "clubs",
|
||||||
|
column: "name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -135,7 +135,6 @@ namespace NadekoBot.Db.Migrations.Mysql
|
|||||||
.HasColumnName("imageurl");
|
.HasColumnName("imageurl");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(20)
|
.HasMaxLength(20)
|
||||||
.HasColumnType("varchar(20)")
|
.HasColumnType("varchar(20)")
|
||||||
.HasColumnName("name")
|
.HasColumnName("name")
|
||||||
@@ -152,8 +151,9 @@ namespace NadekoBot.Db.Migrations.Mysql
|
|||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_clubs");
|
.HasName("pk_clubs");
|
||||||
|
|
||||||
b.HasAlternateKey("Name")
|
b.HasIndex("Name")
|
||||||
.HasName("ak_clubs_name");
|
.IsUnique()
|
||||||
|
.HasDatabaseName("ix_clubs_name");
|
||||||
|
|
||||||
b.HasIndex("OwnerId")
|
b.HasIndex("OwnerId")
|
||||||
.IsUnique()
|
.IsUnique()
|
||||||
@@ -2112,6 +2112,10 @@ namespace NadekoBot.Db.Migrations.Mysql
|
|||||||
.HasColumnType("bigint unsigned")
|
.HasColumnType("bigint unsigned")
|
||||||
.HasColumnName("serverid");
|
.HasColumnName("serverid");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnName("type");
|
||||||
|
|
||||||
b.Property<ulong>("UserId")
|
b.Property<ulong>("UserId")
|
||||||
.HasColumnType("bigint unsigned")
|
.HasColumnType("bigint unsigned")
|
||||||
.HasColumnName("userid");
|
.HasColumnName("userid");
|
||||||
|
3781
src/NadekoBot/Migrations/Postgresql/20230813113832_timely-reminder-type.Designer.cs
generated
Normal file
3781
src/NadekoBot/Migrations/Postgresql/20230813113832_timely-reminder-type.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace NadekoBot.Db.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class timelyremindertype : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "type",
|
||||||
|
table: "reminders",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "type",
|
||||||
|
table: "reminders");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3781
src/NadekoBot/Migrations/Postgresql/20230903154851_clubinfo-name-index.Designer.cs
generated
Normal file
3781
src/NadekoBot/Migrations/Postgresql/20230903154851_clubinfo-name-index.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace NadekoBot.Db.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class clubinfonameindex : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropUniqueConstraint(
|
||||||
|
name: "ak_clubs_name",
|
||||||
|
table: "clubs");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "name",
|
||||||
|
table: "clubs",
|
||||||
|
type: "character varying(20)",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "character varying(20)",
|
||||||
|
oldMaxLength: 20);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_clubs_name",
|
||||||
|
table: "clubs",
|
||||||
|
column: "name",
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "ix_clubs_name",
|
||||||
|
table: "clubs");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "name",
|
||||||
|
table: "clubs",
|
||||||
|
type: "character varying(20)",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "character varying(20)",
|
||||||
|
oldMaxLength: 20,
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddUniqueConstraint(
|
||||||
|
name: "ak_clubs_name",
|
||||||
|
table: "clubs",
|
||||||
|
column: "name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -17,7 +17,7 @@ namespace NadekoBot.Db.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "6.0.7")
|
.HasAnnotation("ProductVersion", "7.0.4")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
@@ -144,7 +144,6 @@ namespace NadekoBot.Db.Migrations
|
|||||||
.HasColumnName("imageurl");
|
.HasColumnName("imageurl");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(20)
|
.HasMaxLength(20)
|
||||||
.HasColumnType("character varying(20)")
|
.HasColumnType("character varying(20)")
|
||||||
.HasColumnName("name");
|
.HasColumnName("name");
|
||||||
@@ -160,8 +159,9 @@ namespace NadekoBot.Db.Migrations
|
|||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_clubs");
|
.HasName("pk_clubs");
|
||||||
|
|
||||||
b.HasAlternateKey("Name")
|
b.HasIndex("Name")
|
||||||
.HasName("ak_clubs_name");
|
.IsUnique()
|
||||||
|
.HasDatabaseName("ix_clubs_name");
|
||||||
|
|
||||||
b.HasIndex("OwnerId")
|
b.HasIndex("OwnerId")
|
||||||
.IsUnique()
|
.IsUnique()
|
||||||
@@ -2212,6 +2212,10 @@ namespace NadekoBot.Db.Migrations
|
|||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("serverid");
|
.HasColumnName("serverid");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("type");
|
||||||
|
|
||||||
b.Property<decimal>("UserId")
|
b.Property<decimal>("UserId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("userid");
|
.HasColumnName("userid");
|
||||||
|
2914
src/NadekoBot/Migrations/Sqlite/20230813110732_timely-reminder-type.Designer.cs
generated
Normal file
2914
src/NadekoBot/Migrations/Sqlite/20230813110732_timely-reminder-type.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace NadekoBot.Db.Migrations.Sqlite
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class timelyremindertype : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Type",
|
||||||
|
table: "Reminders",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Type",
|
||||||
|
table: "Reminders");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2914
src/NadekoBot/Migrations/Sqlite/20230903153230_clubinfo-name-index.Designer.cs
generated
Normal file
2914
src/NadekoBot/Migrations/Sqlite/20230903153230_clubinfo-name-index.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace NadekoBot.Db.Migrations.Sqlite
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class clubinfonameindex : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropUniqueConstraint(
|
||||||
|
name: "AK_Clubs_Name",
|
||||||
|
table: "Clubs");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Clubs",
|
||||||
|
type: "TEXT",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldMaxLength: 20);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Clubs_Name",
|
||||||
|
table: "Clubs",
|
||||||
|
column: "Name",
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Clubs_Name",
|
||||||
|
table: "Clubs");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Clubs",
|
||||||
|
type: "TEXT",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "TEXT",
|
||||||
|
oldMaxLength: 20,
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddUniqueConstraint(
|
||||||
|
name: "AK_Clubs_Name",
|
||||||
|
table: "Clubs",
|
||||||
|
column: "Name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -109,7 +109,6 @@ namespace NadekoBot.Db.Migrations.Sqlite
|
|||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(20)
|
.HasMaxLength(20)
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
@@ -121,7 +120,8 @@ namespace NadekoBot.Db.Migrations.Sqlite
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasAlternateKey("Name");
|
b.HasIndex("Name")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.HasIndex("OwnerId")
|
b.HasIndex("OwnerId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
@@ -1648,6 +1648,9 @@ namespace NadekoBot.Db.Migrations.Sqlite
|
|||||||
b.Property<ulong>("ServerId")
|
b.Property<ulong>("ServerId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("UserId")
|
b.Property<ulong>("UserId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
@@ -2364,3 +2364,7 @@ doas:
|
|||||||
desc: "Execute the command as if you were the target user. Requires bot ownership and server administrator permission."
|
desc: "Execute the command as if you were the target user. Requires bot ownership and server administrator permission."
|
||||||
args:
|
args:
|
||||||
- "@Thief .give all @Admin"
|
- "@Thief .give all @Admin"
|
||||||
|
clubrename:
|
||||||
|
desc: "Renames your club. Requires you club ownership or club-admin status."
|
||||||
|
args:
|
||||||
|
- "New cool club name"
|
@@ -841,7 +841,6 @@
|
|||||||
"club_insuff_lvl": "You're insufficient level to join that club.",
|
"club_insuff_lvl": "You're insufficient level to join that club.",
|
||||||
"club_join_banned": "You're banned from that club.",
|
"club_join_banned": "You're banned from that club.",
|
||||||
"club_already_in": "You are already a member of a club.",
|
"club_already_in": "You are already a member of a club.",
|
||||||
"club_create_error_name": "Failed creating the club. A club with that name already exists.",
|
|
||||||
"club_name_too_long": "Club name is too long.",
|
"club_name_too_long": "Club name is too long.",
|
||||||
"club_created": "Club {0} successfully created!",
|
"club_created": "Club {0} successfully created!",
|
||||||
"club_create_insuff_lvl": "You don't meet the minimum level requirements in order to create a club.",
|
"club_create_insuff_lvl": "You don't meet the minimum level requirements in order to create a club.",
|
||||||
@@ -875,6 +874,8 @@
|
|||||||
"club_apps_for": "Applicants for {0} club",
|
"club_apps_for": "Applicants for {0} club",
|
||||||
"club_leaderboard": "Club leaderboard - page {0}",
|
"club_leaderboard": "Club leaderboard - page {0}",
|
||||||
"club_kick_hierarchy": "Only club owner can kick club admins. Owner can't be kicked.",
|
"club_kick_hierarchy": "Only club owner can kick club admins. Owner can't be kicked.",
|
||||||
|
"club_renamed": "Club has been renamed to {0}",
|
||||||
|
"club_name_taken": "A club with that name already exists.",
|
||||||
"template_reloaded": "Xp template has been reloaded.",
|
"template_reloaded": "Xp template has been reloaded.",
|
||||||
"expr_edited": "Expression Edited",
|
"expr_edited": "Expression Edited",
|
||||||
"self_assign_are_exclusive": "You can only choose 1 role from each group.",
|
"self_assign_are_exclusive": "You can only choose 1 role from each group.",
|
||||||
|
Reference in New Issue
Block a user