コード例 #1
0
        public async Task NPCPost([Remainder] string NPCNameAndOptionalGame = "")
        {
            ChannelSettings channelSettings = await ChannelSettings.GetChannelSettingsAsync(Context.Channel.Id);

            var game = Utilities.GetGameContainedInString(NPCNameAndOptionalGame);

            if (game != GameName.None)
            {
                NPCNameAndOptionalGame = Utilities.RemoveGameNamesFromString(NPCNameAndOptionalGame);
            }
            if (game == GameName.None && channelSettings != null)
            {
                game = channelSettings.DefaultGame;
            }

            var NPCGen = new NpcFactory(serviceProvider).GetNPCGenerator(game);

            var msg = await ReplyAsync(embed : NPCGen.Build(NPCNameAndOptionalGame).GetEmbed());

            if (NPCGen.ReactionsToAdd != null)
            {
                await Task.Run(async() =>
                {
                    foreach (var emote in NPCGen.ReactionsToAdd)
                    {
                        await msg.AddReactionAsync(emote);
                    }
                }).ConfigureAwait(false);
            }
        }
コード例 #2
0
        public async Task NPCPost([Remainder] string NPCArguments = "")
        {
            ChannelSettings channelSettings = await ChannelSettings.GetChannelSettingsAsync(Context.Channel.Id);

            var game = Utilities.GetGameContainedInString(NPCArguments);

            if (game != GameName.None)
            {
                NPCArguments = Utilities.RemoveGameNamesFromString(NPCArguments);
            }
            if (game == GameName.None && channelSettings != null)
            {
                game = channelSettings.DefaultGame;
            }

            var NPCGen = new NpcFactory(serviceProvider).GetNPCGenerator(game);

            await ReplyAsync(embed : NPCGen.Build(NPCArguments).GetEmbed());
        }