Skip to content

Commit

Permalink
support nm ids
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtakingiteasy committed Dec 3, 2021
1 parent 5e36b29 commit f1dd286
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions discordbot/modules/nico/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (mod *module) executeFeed(ctx context.Context, feed *feed) error {

feed.Last = r.StartTime

time.Sleep(time.Minute * 5)
time.Sleep(time.Second * 30)
}

if feed.Last.IsZero() {
Expand Down Expand Up @@ -289,7 +289,7 @@ func (mod *module) commandDownload(ctx *router.Context) error {
case "www.nicovideo.jp", "nicovideo.jp":
var m bool

if m, err = regexp.MatchString("^.*/sm[0-9]*$", urlraw); err != nil || !m {
if m, err = regexp.MatchString("^.*/[sn]m[0-9]*$", urlraw); err != nil || !m {
return ErrInvalidURL
}
default:
Expand Down Expand Up @@ -423,8 +423,13 @@ func (mod *module) renderSelection(session *discordgo.Session, msg *discordgo.Me
return
}

postedidx := strings.Index(lines[n+1], " ")
posted := lines[n+1][:postedidx]
posted := lines[n+1]

postedidx := strings.Index(posted, " ")
if postedidx >= 0 {
posted = posted[:postedidx]
}

tags := lines[n+2]

sb := &strings.Builder{}
Expand Down

0 comments on commit f1dd286

Please sign in to comment.