本文整理汇总了C#中IrcDotNet.IrcClient类的典型用法代码示例。如果您正苦于以下问题:C# IrcClient类的具体用法?C# IrcClient怎么用?C# IrcClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IrcClient类属于IrcDotNet命名空间,在下文中一共展示了IrcClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handleURL
public bool handleURL(string url, IrcClient ctx, CtcpClient ctpcclient = null, IIrcMessageSource source = null )
{
var title = GetPageTitle(url).Trim();
if (!string.IsNullOrWhiteSpace(title))
{
if(title.ToLower().Contains("Domainpark - Bitte den Rasen nicht betreten".ToLower()))
{
int roll = random.Next(0, 101);
if(roll < 5)
{
if(ctpcclient != null)
{
string textMessage = "slaps " + source.Name + " and screamed:";
BotDeathmicMessageTarget target = new BotDeathmicMessageTarget();
target.Name = Properties.Settings.Default.Channel.ToString();
ctpcclient.SendAction(target, textMessage);
ctx.LocalUser.SendMessage(Properties.Settings.Default.Channel, "Runter vom Rasen!");
}
}
}
else
{
if(title.ToLower() == "Imgur: The most awesome images on the Internet".ToLower())
{
}
else
{
ctx.LocalUser.SendMessage(Properties.Settings.Default.Channel, title);
}
}
}
return true;
}
示例2: SayInChannels
public static void SayInChannels(IrcClient client, string msg)
{
foreach (var channel in client.Channels)
{
client.LocalUser.SendMessage(channel, msg);
}
}
示例3: Execute
public void Execute(IrcClient Client, string channel, IrcUser Sender, string message)
{
message = message.Trim();
if (message == "")
{
Client.LocalUser.SendMessage(channel, horoscopeHelpMsg());
}
else
{
if (!signs.ContainsKey(message))
{
Client.LocalUser.SendMessage(channel, "Why won't you give me a sign~");
return;
}
string html = getHTML(signs[message]);
string horoscope = dropHtmlPrecedingHoroscope(html, message);
horoscope = dropHtmlTailingHoroscope(horoscope);
horoscope = html2Txt(horoscope);
Client.LocalUser.SendMessage(channel, horoscope);
}
}
示例4: HandleEventLoop
private static void HandleEventLoop(IrcClient client)
{
_ircLocaluser = client.LocalUser;
_hostNameToWebSockets.Add("", new WebSocketListenerClient(PrivateConstants.TestAccountWebsocketAuth));
_hostNameToWebSockets[""].Run(sendToIrcProcessor);
bool isExit = false;
while (!isExit) {
Console.Write("> ");
var command = Console.ReadLine();
switch (command) {
case "exit":
isExit = true;
break;
default:
if (!string.IsNullOrEmpty(command)) {
if (command.StartsWith("/") && command.Length > 1) {
client.SendRawMessage(command.Substring(1));
} else {
Console.WriteLine($"Unknown command '{command}'");
}
}
break;
}
}
client.Disconnect();
}
示例5: ChannelSearchViewModel
public ChannelSearchViewModel(IrcClient client)
{
this.client = client;
this.allChannels = new List<BindableChannelInfo>();
this.Channels = new BindableCollection<BindableChannelInfo>();
this.client.ChannelListReceived += ircClient_ChannelListReceived;
this.DisplayName = "Join Channel";
}
示例6: InvalidSyncLibraryCommand
protected void InvalidSyncLibraryCommand(
IrcClient client,
IList<IIrcMessageTarget> replyTarget,
string commandError)
{
client.LocalUser.SendMessage(replyTarget, string.Format("Invalid .sync-command: {0}", commandError));
client.LocalUser.SendMessage(replyTarget, "Usage: .sync-library library-guid");
}
示例7: Start
/// <summary>
///
/// </summary>
/// <param name="twitchUsername"></param>
/// <param name="twitchOAuthToken">
/// A chat login token which can be generated here: http://www.twitchapps.com/tmi/
/// </param>
public void Start(string twitchUsername, string twitchOAuthToken)
{
var client = new IrcClient();
client.Connected += client_Connected;
client.ChannelListReceived += client_ChannelListReceived;
client.RawMessageReceived += client_RawMessageReceived;
client.Connect("irc.twitch.tv", 6667, false, new IrcUserRegistrationInfo() {NickName = twitchUsername, Password = twitchOAuthToken, UserName = twitchUsername, RealName = twitchUsername});
}
示例8: Client
public Client(Server server)
{
client = new IrcClient();
this.server = server;
channels = getChannels(server);
SetEventHandlers();
findClientConfs();
}
示例9: Irc
public ActionResult Irc()
{
var api = new AppHarborApi(new AuthInfo { AccessToken = ConfigurationManager.AppSettings["authToken"] });
var latestBuild = api.GetBuilds(Constants.AppHarborAppName).First();
var testResults = api.GetTests(Constants.AppHarborAppName, latestBuild.ID);
List<AppHarbor.Model.Test> allTests = new List<AppHarbor.Model.Test>();
foreach (var testresult in testResults)
{
FillTests(allTests, testresult);
}
AutoResetEvent are = new AutoResetEvent(false);
IrcDotNet.IrcClient client = new IrcDotNet.IrcClient();
try
{
client.Connect("irc.gamesurge.net", false, new IrcUserRegistrationInfo() { NickName = "crymono-build", RealName = "crymono", UserName = "crymono" });
client.ClientInfoReceived += (s, e) => are.Set();
are.WaitOne();
client.Channels.Join(new string[] { "#crymono" });
Thread.Sleep(200);
string msg = latestBuild.Commit.Message.Replace("\n", "").Replace("\r", "");
client.LocalUser.SendMessage("#crymono", "Build finished, latest commit: " + msg);
Thread.Sleep(200);
int numPassedTests = allTests.Count(t => t.Status == "Passed");
float percentage = (float)numPassedTests / allTests.Count * 100;
client.LocalUser.SendMessage("#crymono", String.Format("Test results: {0} of {1} passed ({2:0}%) - http://crymono.apphb.com/#!/{3} - AppHB: https://appharbor.com/applications/crymonobuild/builds/{3}/tests",
numPassedTests,
allTests.Count,
percentage,
latestBuild.ID
));
Thread.Sleep(200);
}
finally
{
if (client != null && client.IsConnected)
{
client.Quit("to the hills!");
Thread.Sleep(200);
client.Disconnect();
}
}
return Content("OK");
}
示例10: IrcMessageCommand
public IrcMessageCommand(
IrcBot bot,
IrcBotUser user,
IrcClient client,
string[] parameters,
IIrcMessageTarget target,
IIrcMessageSource source
)
: base(bot, user, client, parameters, target, source)
{
}
示例11: IrcQueryViewModel
public IrcQueryViewModel(IrcUser user, IrcClient client, Settings settings)
{
this.Settings = settings;
this.User = user;
this.client = client;
this.DisplayName = user.NickName;
this.Messages = new BindableCollection<Message>();
this.Closable = true;
// TODO
this.client.LocalUser.MessageReceived += this.messageReceived;
}
示例12: IrcStatusTabViewModel
/// <summary>
/// Initializes a new instance of the IrcChannelViewModel class
/// </summary>
public IrcStatusTabViewModel(IrcClient client)
{
this.Messages = new BindableCollection<Message>();
this.Closable = false;
this.DisplayName = "Status";
this.Client = client;
this.Client.LocalUser.MessageReceived += this.localUserMessageReceived;
this.Client.MotdReceived += this.clientMessageOfTheDayReceived;
this.Client.WhoIsReplyReceived += this.clientWhoIsReplyReceived;
}
示例13: ProcessChatCommandHelp
private void ProcessChatCommandHelp(IrcClient client, IIrcMessageSource source,
IList<IIrcMessageTarget> targets, string command, IList<string> parameters)
{
if (parameters.Count != 0)
throw new InvalidCommandParametersException(0);
// List all commands recognized by this bot.
var replyTarget = GetDefaultReplyTarget(client, source, targets);
client.LocalUser.SendMessage(replyTarget, "Commands recognized by bot:");
client.LocalUser.SendMessage(replyTarget, string.Join(", ",
this.ChatCommandProcessors.Select(kvPair => kvPair.Key)));
}
示例14: IrcBot
public IrcBot(IrcBotConfiguration configuration)
{
this.tasks = new List<IIrcTask>();
this.users = new ConcurrentDictionary<string, IrcBotUser>();
configuration.UserName = configuration.UserName ?? configuration.NickName;
configuration.RealName = configuration.RealName?? configuration.NickName;
this.Configuration = configuration;
this.commandPrefix = string.Format("{0}", this.Configuration.NickName.ToLower());
this.client = new IrcClient();
}
示例15: ConnectAndSetup
public void ConnectAndSetup()
{
_client = new IrcClient();
_client.Connect("irc.homelien.no", 6667, false, new IrcUserRegistrationInfo
{
NickName = "testL",
UserName = "testLK",
RealName = "LarsBot"
});
_client.Connected += ClientOnConnected;
_client.Disconnected += _client_Disconnected;
_client.RawMessageReceived += _client_RawMessageReceived;
_client.Error += ClientOnError;
_client.ErrorMessageReceived += ClientOnErrorMessageReceived;
}