public async Task Add(string groupName) { var translation = await GetTranslation(); if (!IsOwner) { return; } if (groupName.Equals("Default", StringComparison.CurrentCultureIgnoreCase)) { await Context.Channel.SendMessageAsync(translation.GroupCommands.NoCreateDefault); return; } var guildGroup = await _groupManager.GetGuildGroupByGuildIdAndName(Context.Guild.Id, groupName); if (guildGroup != null) { await Context.Channel.SendMessageAsync(translation.GroupCommands.NoCreateExists); } guildGroup = new GuildGroup { GuildId = Cryptography.Encrypt(Context.Guild.Id.ToString()), Name = groupName, StreamChannelId = null, VodChannelId = null, MentionRoleId = null, LiveMessage = translation.Defaults.LiveMessage, VodMessage = translation.Defaults.VodMessage }; await _groupManager.CreateGuildGroup(guildGroup); await Context.Channel.SendMessageAsync(translation.GroupCommands.CreatedSuccessfully); }
private async Task _discord_JoinedGuild(SocketGuild arg) { var guild = await _guildManager.GetGuildById(arg.Id); if (guild == null) { await _guildManager.CreateGuild(new Guild { GuildId = Cryptography.Encrypt(arg.Id.ToString()), OwnerId = Cryptography.Encrypt(arg.OwnerId.ToString()), CreatedDate = DateTime.UtcNow }); } var guildConfiguration = await _guildManager.GetGuildConfigurationByGuildId(arg.Id); if (guildConfiguration == null) { await _guildManager.CreateGuildConfiguration(new GuildConfiguration { GuildId = Cryptography.Encrypt(arg.Id.ToString()), LanguageCode = "en-US" }); } var defaultGroup = await _groupManager.GetGuildGroupByGuildIdAndName(arg.Id, "Default"); if (defaultGroup == null) { await _groupManager.CreateGuildGroup(new GuildGroup { GuildId = Cryptography.Encrypt(arg.Id.ToString()), Name = "Default" }); } }