2013-04-09 21:19:48 +00:00
|
|
|
# ChatSharp
|
|
|
|
|
2013-04-11 02:17:08 +00:00
|
|
|
A C# library for chatting on an IRC (Internet Relay Protocol) network.
|
|
|
|
|
2015-07-31 23:53:43 +00:00
|
|
|
Supports a lot of RFC 1459 and a little of 2812.
|
|
|
|
|
2015-07-31 23:54:03 +00:00
|
|
|
## Example Usage
|
2013-04-11 02:17:08 +00:00
|
|
|
|
2013-07-10 17:34:20 +00:00
|
|
|
```csharp
|
2021-09-17 21:02:16 +00:00
|
|
|
var client = new IrcClient("irc.libera.chat", new IrcUser("ChatSharp", "ChatSharp"));
|
2015-07-31 23:53:43 +00:00
|
|
|
|
2015-01-01 00:07:37 +00:00
|
|
|
client.ConnectionComplete += (s, e) => client.JoinChannel("#botwar");
|
2015-07-31 23:53:43 +00:00
|
|
|
|
2019-02-05 22:56:52 +00:00
|
|
|
client.ChannelMessageReceived += (s, e) =>
|
2013-07-10 17:34:20 +00:00
|
|
|
{
|
|
|
|
var channel = client.Channels[e.PrivateMessage.Source];
|
2015-07-31 23:53:43 +00:00
|
|
|
|
2013-07-10 17:34:20 +00:00
|
|
|
if (e.PrivateMessage.Message == ".list")
|
|
|
|
channel.SendMessage(string.Join(", ", channel.Users.Select(u => u.Nick)));
|
|
|
|
else if (e.PrivateMessage.Message.StartsWith(".ban "))
|
|
|
|
{
|
2015-01-01 00:31:37 +00:00
|
|
|
if (!channel.UsersByMode['@'].Contains(client.User))
|
2013-07-10 17:34:20 +00:00
|
|
|
{
|
|
|
|
channel.SendMessage("I'm not an op here!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var target = e.PrivateMessage.Message.Substring(5);
|
2016-04-06 22:26:02 +00:00
|
|
|
client.WhoIs(target, whois => channel.ChangeMode("+b *!*@" + whois.User.Hostname));
|
2013-07-10 17:34:20 +00:00
|
|
|
}
|
|
|
|
};
|
2015-07-31 23:53:43 +00:00
|
|
|
|
2015-01-01 00:07:37 +00:00
|
|
|
client.ConnectAsync();
|
2013-07-10 17:34:20 +00:00
|
|
|
|
2015-07-31 23:53:43 +00:00
|
|
|
while (true) ; // Waste CPU cycles
|
2013-07-10 17:34:20 +00:00
|
|
|
```
|
2013-04-11 02:17:08 +00:00
|
|
|
|
2015-07-31 23:53:43 +00:00
|
|
|
## Compiling
|
|
|
|
|
2024-04-19 21:42:57 +00:00
|
|
|
dotnet build -c Release
|
2015-07-31 23:53:43 +00:00
|
|
|
|
2024-04-19 21:42:57 +00:00
|
|
|
You'll receive binaries in `ChatSharp/bin/Release/netstandard2.1`. ChatSharp has no dependencies.
|
2015-07-31 23:53:43 +00:00
|
|
|
|
|
|
|
## Support
|
|
|
|
|
2024-04-19 21:41:05 +00:00
|
|
|
Open an [issue](https://tildegit.org/ben/chatsharp/issues) describing your problem.
|
2015-07-31 23:53:43 +00:00
|
|
|
|
|
|
|
## Development / Contributing
|
2013-07-10 17:34:20 +00:00
|
|
|
|
2014-04-12 03:18:31 +00:00
|
|
|
ChatSharp is developed with the following workflow:
|
2013-04-11 02:17:08 +00:00
|
|
|
|
2014-04-12 03:18:31 +00:00
|
|
|
1. Nothing happens for weeks/months/years
|
|
|
|
2. Someone needs it to do something it doesn't already do
|
|
|
|
3. That person implements that something and submits a pull request
|
|
|
|
4. Repeat
|
2013-04-11 02:17:08 +00:00
|
|
|
|
2014-04-12 03:21:30 +00:00
|
|
|
If it doesn't have a feature that you want it to have, add it! The code isn't that scary.
|