当前位置: 首页>>代码示例>>C#>>正文


C# DiscordClient.GetServer方法代码示例

本文整理汇总了C#中Discord.DiscordClient.GetServer方法的典型用法代码示例。如果您正苦于以下问题:C# DiscordClient.GetServer方法的具体用法?C# DiscordClient.GetServer怎么用?C# DiscordClient.GetServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Discord.DiscordClient的用法示例。


在下文中一共展示了DiscordClient.GetServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public void Run()
        {

            ReadConfig();
            VerifyReady();

            Thread t = new Thread(() =>
            {
                f = new EasyMusicBot.Form1(this);
                Application.EnableVisualStyles();
                Application.Run(f);
            });
            t.SetApartmentState(ApartmentState.STA);
            t.Start();



            Client = new DiscordClient(new DiscordConfig
            {
                AppName = "Easy Music Bot",
                AppUrl = "Put url here",
                //AppVersion = DiscordConfig.LibVersion,
                LogLevel = LogSeverity.Info,
                MessageCacheSize = 0,
                UsePermissionsCache = false
            });



            VidLoopAsync();

            Client.Connected += (s, e) => {
                Console.WriteLine("Connected to Discord with email " + email);
                //Client.SetGame(null);
                foreach (Discord.Channel c in Client.GetServer(104979971667197952).TextChannels)
                {
                    if (c.Name.Equals(Channel))
                    {
                        //MessageBox.Show("che set to " + c.Name);
                        DChannel = c;
                    }
                }
            };


            Client.MessageReceived += (s, e) =>
            {
                LRC = e.Message.Channel;
                Console.WriteLine("Message recieved!");
                InterpretCommand(e.Message);


            };

            try
            {
                Client.Run(async () =>
                {
                    await Client.Connect(email, password);

                });
            }
            catch (Exception e)
            {
                Console.WriteLine("Oh noes! There seems to be a problem with conencting to Discord!");
                Console.WriteLine("Make sure you typed the email and password fields correctly in the config.txt");
                Console.WriteLine("If you happen across the developer, make sure to tell him this: " + e.Message);
            }
            MessageBox.Show("t");
            
        }
开发者ID:nobody647,项目名称:EasyMusicBot,代码行数:71,代码来源:Program.cs

示例2: FinishLoading

            public bool FinishLoading(DiscordClient client)
            {
                if (HostServer != null) throw new InvalidOperationException();

                Server host = client.GetServer(HostServerId);

                if (host == null)
                    return false;

                HostServer = host;
                _client = client;
                return true;
            }
开发者ID:SSStormy,项目名称:Stormbot,代码行数:13,代码来源:AudioStreamModule.cs


注:本文中的Discord.DiscordClient.GetServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。