Skip to content

Commit

Permalink
plugins: (doses-logger) Fix automatic file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT2 committed Nov 26, 2022
1 parent 3e81fd5 commit b758fe4
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions plugins/doses-logger/doses-logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,12 @@ func DoseCommand(c bot.Command) error {
}

if res.StatusCode == 404 {
if id, err := cmd.ParseUserArg(c.Args, 2); err != nil {
return err
} else {
file = fmt.Sprintf("http://localhost:6010/public/media/doses-%v.json", id)
file = fmt.Sprintf("http://localhost:6010/public/media/doses-%v.json", c.E.Author.ID)

if res, err := httpBashRequests.Run(fmt.Sprintf("curl -i -s -X POST -H \"Auth: %s\" %s -F \"content=[]\"", p.Config.(config).FohToken, file)); err != nil {
return err
} else if _, err := cmd.SendEmbed(c.E, "", fmt.Sprintf("```\n%s\n```", util.TailLinesLimit(string(res), 2040)), bot.DefaultColor); err != nil {
return err
}
if res, err := httpBashRequests.Run(fmt.Sprintf("curl -i -s -X POST -H \"Auth: %s\" %s -F \"content=[]\"", p.Config.(config).FohToken, file)); err != nil {
return err
} else if _, err := cmd.SendEmbed(c.E, "", fmt.Sprintf("```\n%s\n```", util.TailLinesLimit(string(res), 2040)), bot.DefaultColor); err != nil {
return err
}

cmd.CommandHandlerWithCommand(c.E, c.Name, c.Args)
Expand Down

0 comments on commit b758fe4

Please sign in to comment.