[Activity] Cleanup schema and DueDateTime
This commit is contained in:
@@ -1,152 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using Cocotte.Services;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Cocotte.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(CocotteDbContext))]
|
|
||||||
[Migration("20230325153626_InitialCreate")]
|
|
||||||
partial class InitialCreate
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder.HasAnnotation("ProductVersion", "7.0.4");
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.Activity", b =>
|
|
||||||
{
|
|
||||||
b.Property<ulong>("GuildId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("ChannelId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("MessageId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<bool>("AreRolesEnabled")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("CreatorDisplayName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<ulong>("CreatorUserId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Discriminator")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<uint>("MaxPlayers")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Name")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("ThreadId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasKey("GuildId", "ChannelId", "MessageId");
|
|
||||||
|
|
||||||
b.HasIndex("ThreadId");
|
|
||||||
|
|
||||||
b.ToTable("Activities");
|
|
||||||
|
|
||||||
b.HasDiscriminator<string>("Discriminator").HasValue("Activity");
|
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.ActivityPlayer", b =>
|
|
||||||
{
|
|
||||||
b.Property<ulong>("GuildId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("ChannelId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("MessageId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("UserId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("Discriminator")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("GuildId", "ChannelId", "MessageId", "UserId");
|
|
||||||
|
|
||||||
b.ToTable("ActivityPlayers");
|
|
||||||
|
|
||||||
b.HasDiscriminator<string>("Discriminator").HasValue("ActivityPlayer");
|
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.InterstellarActivity", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("Cocotte.Modules.Activities.Models.Activity");
|
|
||||||
|
|
||||||
b.Property<int>("Color")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("InterstellarActivity");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.StagedActivity", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("Cocotte.Modules.Activities.Models.Activity");
|
|
||||||
|
|
||||||
b.Property<uint>("Stage")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("StagedActivity");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.ActivityRolePlayer", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("Cocotte.Modules.Activities.Models.ActivityPlayer");
|
|
||||||
|
|
||||||
b.Property<byte>("Roles")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("ActivityRolePlayer");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.ActivityPlayer", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Cocotte.Modules.Activities.Models.Activity", "Activity")
|
|
||||||
.WithMany("ActivityPlayers")
|
|
||||||
.HasForeignKey("GuildId", "ChannelId", "MessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Activity");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.Activity", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("ActivityPlayers");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Cocotte.Services;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Cocotte.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(CocotteDbContext))]
|
|
||||||
[Migration("20230325184735_AddActivityCreationDate")]
|
|
||||||
partial class AddActivityCreationDate
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder.HasAnnotation("ProductVersion", "7.0.4");
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.Activity", b =>
|
|
||||||
{
|
|
||||||
b.Property<ulong>("GuildId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("ChannelId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("MessageId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<bool>("AreRolesEnabled")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationDate")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("CreatorDisplayName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<ulong>("CreatorUserId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Discriminator")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<uint>("MaxPlayers")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Name")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("ThreadId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasKey("GuildId", "ChannelId", "MessageId");
|
|
||||||
|
|
||||||
b.HasIndex("ThreadId");
|
|
||||||
|
|
||||||
b.ToTable("Activities");
|
|
||||||
|
|
||||||
b.HasDiscriminator<string>("Discriminator").HasValue("Activity");
|
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.ActivityPlayer", b =>
|
|
||||||
{
|
|
||||||
b.Property<ulong>("GuildId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("ChannelId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("MessageId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<ulong>("UserId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("Discriminator")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("GuildId", "ChannelId", "MessageId", "UserId");
|
|
||||||
|
|
||||||
b.ToTable("ActivityPlayers");
|
|
||||||
|
|
||||||
b.HasDiscriminator<string>("Discriminator").HasValue("ActivityPlayer");
|
|
||||||
|
|
||||||
b.UseTphMappingStrategy();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.InterstellarActivity", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("Cocotte.Modules.Activities.Models.Activity");
|
|
||||||
|
|
||||||
b.Property<int>("Color")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("InterstellarActivity");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.StagedActivity", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("Cocotte.Modules.Activities.Models.Activity");
|
|
||||||
|
|
||||||
b.Property<uint>("Stage")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("StagedActivity");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.ActivityRolePlayer", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("Cocotte.Modules.Activities.Models.ActivityPlayer");
|
|
||||||
|
|
||||||
b.Property<byte>("Roles")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("ActivityRolePlayer");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.ActivityPlayer", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Cocotte.Modules.Activities.Models.Activity", "Activity")
|
|
||||||
.WithMany("ActivityPlayers")
|
|
||||||
.HasForeignKey("GuildId", "ChannelId", "MessageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Activity");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Cocotte.Modules.Activities.Models.Activity", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("ActivityPlayers");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Cocotte.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class AddActivityCreationDate : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<DateTime>(
|
|
||||||
name: "CreationDate",
|
|
||||||
table: "Activities",
|
|
||||||
type: "TEXT",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CreationDate",
|
|
||||||
table: "Activities");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Cocotte.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class AddActivityDueTime : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<TimeOnly>(
|
|
||||||
name: "DueTime",
|
|
||||||
table: "Activities",
|
|
||||||
type: "TEXT",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "DueTime",
|
|
||||||
table: "Activities");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace Cocotte.Migrations
|
namespace Cocotte.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(CocotteDbContext))]
|
[DbContext(typeof(CocotteDbContext))]
|
||||||
[Migration("20230325234255_AddActivityDueTime")]
|
[Migration("20230326083141_InitialCreate")]
|
||||||
partial class AddActivityDueTime
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -51,7 +51,7 @@ namespace Cocotte.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<TimeOnly?>("DueTime")
|
b.Property<DateTime?>("DueDateTime")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<uint>("MaxPlayers")
|
b.Property<uint>("MaxPlayers")
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
@@ -20,11 +21,13 @@ namespace Cocotte.Migrations
|
|||||||
ThreadId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
ThreadId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
CreatorUserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
CreatorUserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
CreatorDisplayName = table.Column<string>(type: "TEXT", nullable: false),
|
CreatorDisplayName = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
DueDateTime = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||||
Description = table.Column<string>(type: "TEXT", nullable: true),
|
Description = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
Name = table.Column<int>(type: "INTEGER", nullable: false),
|
Name = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
AreRolesEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
|
AreRolesEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||||
MaxPlayers = table.Column<uint>(type: "INTEGER", nullable: false),
|
MaxPlayers = table.Column<uint>(type: "INTEGER", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
Discriminator = table.Column<string>(type: "TEXT", nullable: false),
|
Discriminator = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
Color = table.Column<int>(type: "INTEGER", nullable: true),
|
Color = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
Stage = table.Column<uint>(type: "INTEGER", nullable: true)
|
Stage = table.Column<uint>(type: "INTEGER", nullable: true)
|
||||||
@@ -48,7 +48,7 @@ namespace Cocotte.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<TimeOnly?>("DueTime")
|
b.Property<DateTime?>("DueDateTime")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<uint>("MaxPlayers")
|
b.Property<uint>("MaxPlayers")
|
||||||
|
|||||||
@@ -70,13 +70,13 @@ public class ActivityFormatter
|
|||||||
var descriptionBuilder = new StringBuilder();
|
var descriptionBuilder = new StringBuilder();
|
||||||
|
|
||||||
// Add time if specified
|
// Add time if specified
|
||||||
if (activity.DueTime is { } time)
|
if (activity.DueDateTime is { } dueDateTime)
|
||||||
{
|
{
|
||||||
descriptionBuilder.AppendLine($"**:clock2: {TimestampTag.FormatFromDateTime(DateTime.Today.WithTimeOnly(time), TimestampTagStyles.ShortTime)}**");
|
descriptionBuilder.AppendLine($"**:clock2: {TimestampTag.FormatFromDateTime(dueDateTime, TimestampTagStyles.ShortTime)} ― {TimestampTag.FormatFromDateTime(dueDateTime, TimestampTagStyles.Relative)}**");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
descriptionBuilder.AppendLine($"**:clock2: Maintenant**");
|
descriptionBuilder.AppendLine("**:clock2: Maintenant**");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add generic message or specified activity description
|
// Add generic message or specified activity description
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ public partial class ActivityModule : InteractionModuleBase<SocketInteractionCon
|
|||||||
private async Task CreateActivity(ActivityName activityName, string? timeInput, string description, bool areRolesEnabled = true, uint? maxPlayers = null, uint? stage = null, InterstellarColor? interstellarColor = null)
|
private async Task CreateActivity(ActivityName activityName, string? timeInput, string description, bool areRolesEnabled = true, uint? maxPlayers = null, uint? stage = null, InterstellarColor? interstellarColor = null)
|
||||||
{
|
{
|
||||||
// Check time if it's specified
|
// Check time if it's specified
|
||||||
TimeOnly? time = null;
|
DateTime? dueDate = null;
|
||||||
if (timeInput is not null)
|
if (timeInput is not null)
|
||||||
{
|
{
|
||||||
if (!TimeOnly.TryParse(timeInput, out var parsedTime))
|
if (!TimeOnly.TryParse(timeInput, out var parsedTime))
|
||||||
@@ -152,7 +152,7 @@ public partial class ActivityModule : InteractionModuleBase<SocketInteractionCon
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
time = parsedTime;
|
dueDate = DateTimeUtils.NextDateWithTimeOfDay(parsedTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogTrace("{User} is creating activity {Activity}", User.DisplayName, activityName);
|
_logger.LogTrace("{User} is creating activity {Activity}", User.DisplayName, activityName);
|
||||||
@@ -180,7 +180,7 @@ public partial class ActivityModule : InteractionModuleBase<SocketInteractionCon
|
|||||||
CreatorUserId = Context.User.Id,
|
CreatorUserId = Context.User.Id,
|
||||||
CreatorDisplayName = ((SocketGuildUser) Context.User).DisplayName,
|
CreatorDisplayName = ((SocketGuildUser) Context.User).DisplayName,
|
||||||
Description = description,
|
Description = description,
|
||||||
DueTime = time,
|
DueDateTime = dueDate,
|
||||||
Type = activityType,
|
Type = activityType,
|
||||||
Name = activityName,
|
Name = activityName,
|
||||||
AreRolesEnabled = areRolesEnabled,
|
AreRolesEnabled = areRolesEnabled,
|
||||||
@@ -199,7 +199,7 @@ public partial class ActivityModule : InteractionModuleBase<SocketInteractionCon
|
|||||||
CreatorUserId = Context.User.Id,
|
CreatorUserId = Context.User.Id,
|
||||||
CreatorDisplayName = ((SocketGuildUser) Context.User).DisplayName,
|
CreatorDisplayName = ((SocketGuildUser) Context.User).DisplayName,
|
||||||
Description = description,
|
Description = description,
|
||||||
DueTime = time,
|
DueDateTime = dueDate,
|
||||||
Type = activityType,
|
Type = activityType,
|
||||||
Name = activityName,
|
Name = activityName,
|
||||||
AreRolesEnabled = false,
|
AreRolesEnabled = false,
|
||||||
@@ -218,7 +218,7 @@ public partial class ActivityModule : InteractionModuleBase<SocketInteractionCon
|
|||||||
CreatorUserId = Context.User.Id,
|
CreatorUserId = Context.User.Id,
|
||||||
CreatorDisplayName = ((SocketGuildUser) Context.User).DisplayName,
|
CreatorDisplayName = ((SocketGuildUser) Context.User).DisplayName,
|
||||||
Description = description,
|
Description = description,
|
||||||
DueTime = time,
|
DueDateTime = dueDate,
|
||||||
Type = activityType,
|
Type = activityType,
|
||||||
Name = activityName,
|
Name = activityName,
|
||||||
AreRolesEnabled = areRolesEnabled,
|
AreRolesEnabled = areRolesEnabled,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class Activity
|
|||||||
public required ulong ThreadId { get; init; }
|
public required ulong ThreadId { get; init; }
|
||||||
public required ulong CreatorUserId { get; init; }
|
public required ulong CreatorUserId { get; init; }
|
||||||
public required string CreatorDisplayName { get; init; }
|
public required string CreatorDisplayName { get; init; }
|
||||||
public TimeOnly? DueTime { get; init; }
|
public DateTime? DueDateTime { get; init; }
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
public required ActivityType Type { get; init; }
|
public required ActivityType Type { get; init; }
|
||||||
public required ActivityName Name { get; init; }
|
public required ActivityName Name { get; init; }
|
||||||
|
|||||||
@@ -20,4 +20,7 @@ public static class DateTimeUtils
|
|||||||
dateTime.Year, dateTime.Month, dateTime.Day, timeOnly.Hour, timeOnly.Minute, timeOnly.Second
|
dateTime.Year, dateTime.Month, dateTime.Day, timeOnly.Hour, timeOnly.Minute, timeOnly.Second
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DateTime NextDateWithTimeOfDay(TimeOnly timeOfDay) =>
|
||||||
|
DateTime.Now.TimeOfDay.Ticks > timeOfDay.Ticks ? DateTime.Now.AddDays(1).WithTimeOnly(timeOfDay) : DateTime.Now.WithTimeOnly(timeOfDay);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user