This commit is contained in:
Alexander Popov 2022-12-31 00:26:30 +03:00
commit 56f3239c7d
Signed by: iiiypuk
GPG Key ID: D8C9B59A9F04A70C
4 changed files with 53 additions and 0 deletions

16
.editorconfig Normal file
View File

@ -0,0 +1,16 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[{*.cr,shard.yml}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
bin/

14
shard.yml Normal file
View File

@ -0,0 +1,14 @@
name: irc-cr
version: 0.1.0
authors:
- Alexander Popov <iiiypuk@fastmail.fm>
description: |
Simple IRC bot
targets:
irc-cr:
main: src/irc.cr
license: Unlicense

22
src/irc.cr Normal file
View File

@ -0,0 +1,22 @@
require "socket"
SERVER = "iiiypuk.me"
PORT = 6667
NICK = "irc-cr"
USER = "Axel"
puts "Running..."
irc = TCPSocket.new(SERVER, PORT)
irc << "USER #{NICK} . . :This is a bot!\n"
irc << "NICK #{NICK}\r\n"
irc << "PRIVMSG #{USER} :!time\r\n"
while response = irc.gets
if response.to_s.includes?("PING")
irc << "PONG #{response.to_s.split[1]}\r\n"
end
end
irc << "QUIT\r\n"
irc.close