init
This commit is contained in:
commit
56f3239c7d
16
.editorconfig
Normal file
16
.editorconfig
Normal 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
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
bin/
|
14
shard.yml
Normal file
14
shard.yml
Normal 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
22
src/irc.cr
Normal 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
|
Loading…
Reference in New Issue
Block a user