diff --git a/.idea/.idea.ChatSharp/.idea/.gitignore b/.idea/.idea.ChatSharp/.idea/.gitignore new file mode 100644 index 0000000..4a4ccaa --- /dev/null +++ b/.idea/.idea.ChatSharp/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/projectSettingsUpdater.xml +/contentModel.xml +/.idea.ChatSharp.iml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.ChatSharp/.idea/.name b/.idea/.idea.ChatSharp/.idea/.name new file mode 100644 index 0000000..c30f859 --- /dev/null +++ b/.idea/.idea.ChatSharp/.idea/.name @@ -0,0 +1 @@ +ChatSharp \ No newline at end of file diff --git a/.idea/.idea.ChatSharp/.idea/encodings.xml b/.idea/.idea.ChatSharp/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.ChatSharp/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.ChatSharp/.idea/indexLayout.xml b/.idea/.idea.ChatSharp/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.ChatSharp/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.ChatSharp/.idea/misc.xml b/.idea/.idea.ChatSharp/.idea/misc.xml new file mode 100644 index 0000000..1d8c84d --- /dev/null +++ b/.idea/.idea.ChatSharp/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.ChatSharp/.idea/vcs.xml b/.idea/.idea.ChatSharp/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.ChatSharp/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ChatSharp.sln.DotSettings b/ChatSharp.sln.DotSettings new file mode 100644 index 0000000..4a8f327 --- /dev/null +++ b/ChatSharp.sln.DotSettings @@ -0,0 +1,5 @@ + + IP + ISO + MOTD + SSL \ No newline at end of file diff --git a/ChatSharp.sln.DotSettings.user b/ChatSharp.sln.DotSettings.user new file mode 100644 index 0000000..571d759 --- /dev/null +++ b/ChatSharp.sln.DotSettings.user @@ -0,0 +1,7 @@ + + <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <Solution /> +</SessionState> + <SessionState ContinuousTestingMode="0" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <Solution /> +</SessionState> \ No newline at end of file diff --git a/Example/Example.csproj b/Example/Example.csproj new file mode 100644 index 0000000..dd7f5e6 --- /dev/null +++ b/Example/Example.csproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + diff --git a/Example/Program.cs b/Example/Program.cs new file mode 100644 index 0000000..96dd77e --- /dev/null +++ b/Example/Program.cs @@ -0,0 +1,29 @@ +using ChatSharp; + +var client = new IrcClient("irc.libera.chat", new("chatsharp", "chatsharp")); + +client.ConnectionComplete += (_, _) => client.JoinChannel("##chatsharp"); +client.ChannelMessageReceived += (s, e) => +{ + var channel = client.Channels[e.PrivateMessage.Source]; + if (e.PrivateMessage.Message == ".list") + { + channel.SendMessage(string.Join(", ", channel.Users.Select(u => u.Nick))); + } + else if (e.PrivateMessage.Message.StartsWith(".ban ")) + { + if (!channel.UsersByMode['@'].Contains(client.User)) + { + channel.SendMessage("I'm not an op here!"); + return; + } + + var target = e.PrivateMessage.Message[5..]; + client.WhoIs(target, whois => channel.ChangeMode($"+b *!*@{whois.User.Hostname}")); + } +}; + +client.ConnectAsync(); +while (true) +{ +} \ No newline at end of file