mirror of
https://github.com/fluffle/goirc
synced 2025-05-21 15:03:19 +00:00
Handle http://youtu.be/ links
This commit is contained in:
parent
c7fce11e01
commit
9e203ff027
1 changed files with 7 additions and 1 deletions
|
@ -61,8 +61,14 @@ func handlePrivmsg(conn *irc.Conn, line *irc.Line) {
|
|||
target := line.Args[0]
|
||||
if isChannel(target) {
|
||||
// message to a channel
|
||||
var video string
|
||||
if start := strings.Index(line.Args[1], "youtube.com/watch?v="); start > -1 {
|
||||
video := line.Args[1][start+20:]
|
||||
video = line.Args[1][start+20:]
|
||||
}
|
||||
if start := strings.Index(line.Args[1], "youtu.be/"); start > -1 {
|
||||
video = line.Args[1][start+9:]
|
||||
}
|
||||
if video != "" {
|
||||
if end := strings.IndexAny(video, " &#"); end > -1 {
|
||||
video = video[0:end]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue