:)
This commit is contained in:
commit
ffab8f9a14
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
|
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
11
HISTORY.md
Normal file
11
HISTORY.md
Normal file
@ -0,0 +1,11 @@
|
||||
## Legend
|
||||
- 🐛 - Bug
|
||||
- ✔️ - Fixed
|
||||
- ❌ - Removed
|
||||
- ➕ - Added
|
||||
- ℹ️ - Information
|
||||
- ♻️ - Edited
|
||||
|
||||
## 0.1.0 - [00/09/2022]
|
||||
- ➕ -
|
||||
|
10
README.md
Normal file
10
README.md
Normal file
@ -0,0 +1,10 @@
|
||||
cibot
|
||||
=====
|
||||
|
||||
Build from source
|
||||
-----------------
|
||||
|
||||
```
|
||||
git clone ...
|
||||
shards build --release
|
||||
```
|
14
shard.yml
Normal file
14
shard.yml
Normal file
@ -0,0 +1,14 @@
|
||||
name: cibot
|
||||
version: 0.1.0
|
||||
|
||||
authors:
|
||||
- Alexander Popov <iiiypuk@fastmail.fm>
|
||||
|
||||
description: |
|
||||
cibot is simple IRC bot
|
||||
|
||||
targets:
|
||||
cibot:
|
||||
main: src/cibot.cr
|
||||
|
||||
license: MIT
|
29
src/cibot.cr
Normal file
29
src/cibot.cr
Normal file
@ -0,0 +1,29 @@
|
||||
require "socket"
|
||||
|
||||
SERVER = "iiiypuk.me"
|
||||
PORT = 6667
|
||||
NICK = "crystal"
|
||||
CHANNEL = "#admin"
|
||||
|
||||
puts "Connecting..."
|
||||
irc = TCPSocket.new(SERVER, PORT)
|
||||
|
||||
irc << "USER #{NICK} . . :This is a bot!\n"
|
||||
irc << "NICK #{NICK}\r\n"
|
||||
irc << "JOIN #{CHANNEL}\r\n"
|
||||
irc << "PRIVMSG #{CHANNEL} :!time\r\n"
|
||||
|
||||
while true
|
||||
response = irc.gets
|
||||
puts response
|
||||
|
||||
if response.to_s.includes?("PING")
|
||||
irc << "PONG #{response.to_s.split[1]}\r\n"
|
||||
end
|
||||
|
||||
if response.to_s.includes?("!time")
|
||||
irc << "PRIVMSG #{CHANNEL} :#{Time.local.to_unix}\r\n"
|
||||
end
|
||||
end
|
||||
|
||||
irc.close
|
Loading…
Reference in New Issue
Block a user