From 44df5790c68d6f1f92412ed5c9f7b8f5db933134 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sun, 9 Aug 2020 23:48:06 -0400 Subject: [PATCH 1/2] Updating for :wot: emoji, and also to permit the status joni / welcome to ONLY send to system status channel --- ChaosBot/Discord/Services/CommandHandler.cs | 29 ++----------------- .../Discord/Services/ExperienceHandler.cs | 8 ++--- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/ChaosBot/Discord/Services/CommandHandler.cs b/ChaosBot/Discord/Services/CommandHandler.cs index b940d98..8c461be 100644 --- a/ChaosBot/Discord/Services/CommandHandler.cs +++ b/ChaosBot/Discord/Services/CommandHandler.cs @@ -98,18 +98,8 @@ namespace ChaosBot.Discord.Services .On(x => new {x.DiscordGuildId, x.DiscordUserId}).RunAsync(); } - string ConfigSet = ConfigurationRepository.GetValue("LevelUp:Channel", user.Guild.Id, "false"); - if (ConfigSet != "false") - { - ulong channelId = Convert.ToUInt64(ConfigSet.Substring(2, ConfigSet.Length - 3)); - - await user.Guild.GetTextChannel(channelId).SendMessageAsync( - $"Welcome {user.Mention}!"); - } - else - { - await user.Guild.SystemChannel.SendMessageAsync($"Welcome {user.Mention}!"); - } + await user.Guild.SystemChannel.SendMessageAsync($"{user.Username} has joined the server."); + } @@ -172,20 +162,7 @@ namespace ChaosBot.Discord.Services .On(x => new { x.DiscordGuildId, x.DiscordUserId}).RunAsync(); } - string ConfigSet = ConfigurationRepository.GetValue("LevelUp:Channel", user.Guild.Id, "false"); - if (ConfigSet != "false") - { - ulong channelId = Convert.ToUInt64(ConfigSet.Substring(2, ConfigSet.Length - 3)); - - await user.Guild.GetTextChannel(channelId).SendMessageAsync( - $"Goodbye {user.Mention}!"); - } - else - { - await user.Guild.SystemChannel.SendMessageAsync($"Goodbye {user.Mention}!"); - } - - + await user.Guild.SystemChannel.SendMessageAsync($"{user.Username} has left the server."); } catch (Exception ex) { diff --git a/ChaosBot/Discord/Services/ExperienceHandler.cs b/ChaosBot/Discord/Services/ExperienceHandler.cs index f697608..3be7731 100644 --- a/ChaosBot/Discord/Services/ExperienceHandler.cs +++ b/ChaosBot/Discord/Services/ExperienceHandler.cs @@ -69,10 +69,10 @@ namespace ChaosBot.Discord.Services { 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:"); + $"Grats <@{context.User.Id}>! You have reached level 1 <:wot:740387232514572310>"); } else - await context.Channel.SendMessageAsync($"Grats <@{context.User.Id}>! You have reached level 1 :wot:"); + await context.Channel.SendMessageAsync($"Grats <@{context.User.Id}>! You have reached level 1! <:wot:740387232514572310>"); } } } @@ -102,10 +102,10 @@ namespace ChaosBot.Discord.Services { ulong channelId = Convert.ToUInt64(ConfigSet.Substring(2, ConfigSet.Length - 3)); await context.Guild.GetTextChannel(channelId).SendMessageAsync( - $"Grats <@{usrExperience.DiscordUserId}>! You have reached level {curLevel} :wot:"); + $"Grats <@{usrExperience.DiscordUserId}>! You have reached level {curLevel} <:wot:740387232514572310>"); } else - await context.Channel.SendMessageAsync($"Grats <@{usrExperience.DiscordUserId}>! You have reached level {curLevel} :wot:"); + await context.Channel.SendMessageAsync($"Grats <@{usrExperience.DiscordUserId}>! You have reached level {curLevel} <:wot:740387232514572310>"); } } catch (Exception ex) From 96561089c223f083af588296808ff7104f9343a8 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Mon, 10 Aug 2020 00:04:15 -0400 Subject: [PATCH 2/2] Adding Nicknaming on Link --- ChaosBot/Discord/Modules/User/Lodestone.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ChaosBot/Discord/Modules/User/Lodestone.cs b/ChaosBot/Discord/Modules/User/Lodestone.cs index 392f858..8cd5c6a 100644 --- a/ChaosBot/Discord/Modules/User/Lodestone.cs +++ b/ChaosBot/Discord/Modules/User/Lodestone.cs @@ -198,7 +198,7 @@ namespace ChaosBot.Discord.Modules.User lsChar.DiscordGuildId = Context.Guild.Id; lsChar.Name = character.Character.Name; lsChar.Avatar = character.Character.Avatar; - + await dbContext.LodestoneCharacter.Upsert(lsChar) .On(x => new {x.DiscordGuildId, x.LodestoneId}).RunAsync(); } @@ -207,6 +207,10 @@ namespace ChaosBot.Discord.Modules.User sb.AppendLine( $"{Context.User.Mention} has been successfully linked to {character.Character.Name}"); embed.Description = sb.ToString(); + + IGuildUser nUser = await Context.Guild.GetUserAsync(Context.User.Id); + await nUser.ModifyAsync(x => { x.Nickname = character.Character.Name; }); + await ReplyAsync(null, false, embed.Build()); } else