Exemple #1
0
        private async Task RemoveContentCreator(CommandMessage message, ContentCreator.Type type)
        {
            ContentCreator?streamer = await ContentCreatorDatabase.Load(message.Author.Id.ToString());

            if (streamer != null)
            {
                if (streamer.HasOtherStreams(type))
                {
                    // Creator has more than one source - clear current and save
                    streamer.RemoveContentInfo(type);
                    await ContentCreatorDatabase.Save(streamer);
                }
                else
                {
                    // Creator only uses current source - delete record
                    await ContentCreatorDatabase.Delete(streamer);
                }
            }

            // Send Embed
            RestUserMessage response = await message.Channel.SendMessageAsync("Removed Creator Info", messageReference : message.MessageReference);

            // Delay then delete command and response message
            await Task.Delay(2000);

            await response.DeleteAsync();

            message.DeleteMessage();
        }
Exemple #2
0
        private async Task SetContentCreator(CommandMessage message, string identifier, ContentCreator.Type type, string?linkId = null)
        {
            ContentCreator streamer = await ContentCreatorDatabase.LoadOrCreate(message.Author.Id.ToString());

            streamer.DiscordGuildId = message.Guild.Id;
            streamer.DiscordUserId  = message.Author.Id;
            streamer.GuildNickName  = message.Author.GetName();

            streamer.SetContentInfo(identifier, type, linkId);

            await ContentCreatorDatabase.Save(streamer);

            // Send Embed
            RestUserMessage response = await message.Channel.SendMessageAsync("Added Stream Info", messageReference : message.MessageReference);

            // Delay then delete command and response message
            await Task.Delay(2000);

            await response.DeleteAsync();

            message.DeleteMessage();
        }