BREAKING CHANGE: store repos under a subdir of the mapper id
This commit is contained in:
parent
6b60c43b00
commit
eabf16899e
3 changed files with 5 additions and 5 deletions
|
@ -100,7 +100,7 @@ func (bot *Bot) NotifyNewBeatmap(channels []string, newMaps []osuapi.Beatmapset)
|
||||||
|
|
||||||
// try to open a repo for this beatmap
|
// try to open a repo for this beatmap
|
||||||
var repo *git.Repository
|
var repo *git.Repository
|
||||||
repoDir := path.Join(bot.config.Repos, strconv.Itoa(beatmapSet.ID))
|
repoDir := path.Join(bot.config.Repos, strconv.Itoa(beatmapSet.UserID), strconv.Itoa(beatmapSet.ID))
|
||||||
if _, err := os.Stat(repoDir); os.IsNotExist(err) {
|
if _, err := os.Stat(repoDir); os.IsNotExist(err) {
|
||||||
os.MkdirAll(repoDir, 0777)
|
os.MkdirAll(repoDir, 0777)
|
||||||
}
|
}
|
||||||
|
@ -181,11 +181,11 @@ func (bot *Bot) NotifyNewBeatmap(channels []string, newMaps []osuapi.Beatmapset)
|
||||||
Title: fmt.Sprintf("Update: %s - %s", beatmapSet.Artist, beatmapSet.Title),
|
Title: fmt.Sprintf("Update: %s - %s", beatmapSet.Artist, beatmapSet.Title),
|
||||||
Timestamp: eventTime.Format(time.RFC3339),
|
Timestamp: eventTime.Format(time.RFC3339),
|
||||||
Author: &discordgo.MessageEmbedAuthor{
|
Author: &discordgo.MessageEmbedAuthor{
|
||||||
URL: "https://osu.ppy.sh/u/" + strconv.Itoa(beatmapSet.UserId),
|
URL: "https://osu.ppy.sh/u/" + strconv.Itoa(beatmapSet.UserID),
|
||||||
Name: beatmapSet.Creator,
|
Name: beatmapSet.Creator,
|
||||||
IconURL: fmt.Sprintf(
|
IconURL: fmt.Sprintf(
|
||||||
"https://a.ppy.sh/%d?%d.png",
|
"https://a.ppy.sh/%d?%d.png",
|
||||||
beatmapSet.UserId,
|
beatmapSet.UserID,
|
||||||
time.Now().Unix(),
|
time.Now().Unix(),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,7 @@ type Beatmapset struct {
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
TitleUnicode string `json:"title_unicode"`
|
TitleUnicode string `json:"title_unicode"`
|
||||||
Creator string `json:"creator"`
|
Creator string `json:"creator"`
|
||||||
UserId int `json:"user_id"`
|
UserID int `json:"user_id"`
|
||||||
|
|
||||||
Covers BeatmapCovers `json:"covers"`
|
Covers BeatmapCovers `json:"covers"`
|
||||||
Beatmaps []Beatmap `json:"beatmaps,omitempty"`
|
Beatmaps []Beatmap `json:"beatmaps,omitempty"`
|
||||||
|
|
|
@ -50,7 +50,7 @@ func RunScraper(config *config.Config, bot *discord.Bot, db *db.Db, api *osuapi.
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
mapperId := beatmapSet.UserId
|
mapperId := beatmapSet.UserID
|
||||||
if _, ok := trackedMappers[mapperId]; ok {
|
if _, ok := trackedMappers[mapperId]; ok {
|
||||||
if _, ok2 := allNewMaps[mapperId]; !ok2 {
|
if _, ok2 := allNewMaps[mapperId]; !ok2 {
|
||||||
allNewMaps[mapperId] = make([]osuapi.Beatmapset, 0)
|
allNewMaps[mapperId] = make([]osuapi.Beatmapset, 0)
|
||||||
|
|
Loading…
Reference in a new issue