本文整理汇总了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");
}
示例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;
}