public async Task AddServerInfoAsync() { var response = await DynamoSystem.QueryItemAsync <GuildInfo>("GuildName", QueryOperator.Equal, this.Context.Guild.Name) .ConfigureAwait(false); if (response.Count < 1) { var existsResponse = EmbedHandler.GenerateEmbedResponse( "This server already exists in the DB", Color.Teal); await this.ReplyAsync("", false, existsResponse).ConfigureAwait(false); return; } var item = new GuildInfo { GuildGuid = this.Context.Guild.Id.ToString(), GuildName = this.Context.Guild.Name }; await DynamoSystem.PutItemAsync(item).ConfigureAwait(false); var addedResponse = EmbedHandler.GenerateEmbedResponse( "This server has been added to the DB", Color.Green); await this.ReplyAsync("", false, addedResponse).ConfigureAwait(false); }
private static async Task OnJoiningGuild([NotNull] SocketGuild arg) { var item = new GuildInfo { GuildGuid = arg.Id.ToString(), GuildName = arg.Name }; await DynamoSystem.PutItemAsync(item).ConfigureAwait(false); var embed = EmbedHandler.GenerateEmbedResponse( "Hey friends! Nice to meet you!\r\n" + "Type `!help` to get to know me more and find out what I can do!"); await arg.DefaultChannel.SendMessageAsync("", false, embed); }
private static async Task OnJoinedGuildAsync([NotNull] SocketGuild arg) { var guild = await DynamoSystem.GetItemAsync <GuildInfo>(arg.Id).ConfigureAwait(false); if (guild != null) { return; } guild = new GuildInfo { GuildGuid = arg.Id.ToString(), GuildName = arg.Name }; await DynamoSystem.PutItemAsync(guild).ConfigureAwait(false); }