This commit is contained in:
Fijxu 2024-08-19 13:40:29 -04:00
commit 6b1efee8e2
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
4 changed files with 58 additions and 0 deletions

9
shard.yml Normal file
View file

@ -0,0 +1,9 @@
name: twitch-irc-crystal
version: 0.1.0
authors:
- Fijxu <fijxu@nadeko.net>
crystal: '>= 1.13.0'
license: MIT

2
spec/spec_helper.cr Normal file
View file

@ -0,0 +1,2 @@
require "spec"
require "../src/twitch-irc-crystal"

View file

@ -0,0 +1,9 @@
require "./spec_helper"
describe Twitch::Irc::Crystal do
# TODO: Write tests
it "works" do
false.should eq(true)
end
end

38
src/twitch-irc-crystal.cr Normal file
View file

@ -0,0 +1,38 @@
require "socket"
module TwitchIRC
struct Client
@ip_addr : String
@port : String
@ssl : Bool | Nil
@client : TCPSocket
def initialize(@ip_addr, @port, @ssl)
@client = TCPSocket.new(@ip_addr, @port)
end
def listen
spawn do
loop do
puts @client.gets
end
end
sleep
end
def send_raw(msg : String)
@client << "#{msg}"
end
def send(msg : String)
@client << "#{msg}\n"
end
def send_privmsg(msg : String, channel : String)
@client << "PRIVMSG ##{channel} :#{msg}\n"
end
def capabilities
self.send("CAP REQ :twitch.tv/membership twitch.tv/tags twitch.tv/commands")
end
end
end