Merge branch 'develop' into 'master'
Setting default level to 1 See merge request discord-bots/chaosbot!13
This commit is contained in:
commit
bd426f44ea
@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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 =>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user