コード例 #1
0
ファイル: CBot.cs プロジェクト: KorStrix/DiscordBot_Unity
        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;
        }
コード例 #2
0
        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);
        }