Пример #1
0
        static public void DoInitClient(out DiscordClient pClient, out CommandsNextModule pCommandModule)
        {
            XML_Config.Load();
            CBot.pClient = new DiscordClient(new DiscordConfiguration
            {
                Token     = XML_Config.pConfig.strBotToken,
                TokenType = TokenType.Bot,

                UseInternalLogHandler = true,
                LogLevel = DSharpPlus.LogLevel.Debug
            });

            CBot.pClient.Ready += PClinet_Ready;

            CommandsNextConfiguration pConfiguration = new CommandsNextConfiguration();

            if (string.IsNullOrEmpty(XML_Config.pConfig.strCall_ID) == false)
            {
                pConfiguration.StringPrefix = XML_Config.pConfig.strCall_ID;
            }
            else
            {
                ProcNotStringPrefix(pConfiguration);
            }

            pCommands = CBot.pClient.UseCommandsNext(pConfiguration);
            pCommands.RegisterCommands <Commands_Tutorial>();


            pClient        = CBot.pClient;
            pCommandModule = pCommands;
        }
        static public async Task DoStartTutorial(CommandContext pContext)
        {
            var pConfig   = XML_Config.Load();
            var pTutorial = pConfig.pTutorial;

            DiscordEmbedBuilder pEmbedBuilder = new DiscordEmbedBuilder();

            pEmbedBuilder.WithAuthor(pTutorial.strTitle);

            for (int i = 0; i < pTutorial.arrField.Length; i++)
            {
                pEmbedBuilder.AddField(pTutorial.arrField[i].strFieldName, pTutorial.arrField[i].strFieldValue);
            }

            await pContext.RespondAsync(null, false, pEmbedBuilder);
        }