Setting default level to 1

This commit is contained in:
Sean "Solao Bajiuik" Stoves 2020-08-09 10:19:29 -04:00
parent 038cd37995
commit 9950801644
2 changed files with 14 additions and 3 deletions

View File

@ -58,10 +58,21 @@ namespace ChaosBot.Discord.Services
usrNewXp.DiscordGuildId = context.Guild.Id; usrNewXp.DiscordGuildId = context.Guild.Id;
usrNewXp.DiscordUserId = context.User.Id; usrNewXp.DiscordUserId = context.User.Id;
usrNewXp.LastUpdated = DateTime.Now; usrNewXp.LastUpdated = DateTime.Now;
usrNewXp.Level = 0; usrNewXp.Level = 1;
await dbContext.ExperiencePoints.Upsert(usrNewXp) await dbContext.ExperiencePoints.Upsert(usrNewXp)
.On(x => new { x.DiscordGuildId, x.DiscordUserId}).RunAsync(); .On(x => new { x.DiscordGuildId, x.DiscordUserId}).RunAsync();
string ConfigSet = ConfigurationRepository.GetValue<string>("LevelUp:Channel", context.Guild.Id, "false");
if (ConfigSet != "false")
{
ulong channelId = Convert.ToUInt64(ConfigSet.Substring(2, ConfigSet.Length - 3));
await context.Guild.GetTextChannel(channelId).SendMessageAsync(
$"Grats <@{context.User.Id}>! You have reached level 1 :wot:");
}
else
await context.Channel.SendMessageAsync($"Grats <@{context.User.Id}>! You have reached level 1 :wot:");
} }
} }
} }
@ -74,7 +85,7 @@ namespace ChaosBot.Discord.Services
public static async Task<ulong> checkLevel(Experience usrExperience, SocketCommandContext context) public static async Task<ulong> checkLevel(Experience usrExperience, SocketCommandContext context)
{ {
ulong curLevel = 0; ulong curLevel = 1;
try try
{ {

View File

@ -17,7 +17,7 @@ namespace ChaosBot.Migrations
DiscordGuildId = table.Column<ulong>(nullable: false), DiscordGuildId = table.Column<ulong>(nullable: false),
DiscordUserId = table.Column<ulong>(nullable: false), DiscordUserId = table.Column<ulong>(nullable: false),
Amount = table.Column<ulong>(nullable: false, defaultValue: 0), Amount = table.Column<ulong>(nullable: false, defaultValue: 0),
Level = table.Column<ulong>(nullable: false, defaultValue: 0), Level = table.Column<ulong>(nullable: false, defaultValue: 1),
lastUpdated = table.Column<DateTime>(nullable:false, defaultValue: "0000-00-00 00:00:00") lastUpdated = table.Column<DateTime>(nullable:false, defaultValue: "0000-00-00 00:00:00")
}, },
constraints: table => constraints: table =>