| Conditions | 6 |
| Total Lines | 19 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package cmd |
||
| 10 | func SlapCommand(ctx bot.Context) { |
||
| 11 | if len(ctx.Args) > 0 { |
||
| 12 | ctx.MetricsCommand("fun", "slap") |
||
| 13 | url, err := fun.GetImageURL("slap") |
||
| 14 | if err == nil { |
||
| 15 | if len(ctx.Args) > 0 { |
||
| 16 | var userID string |
||
| 17 | if len(ctx.Args[0]) > 3 { |
||
| 18 | userID = ctx.Args[0][2 : len(ctx.Args[0])-1] |
||
| 19 | } |
||
| 20 | user := ctx.GetGuildUser(userID) |
||
| 21 | var mention= ctx.Args[0] |
||
| 22 | if user != nil { |
||
| 23 | mention = user.Username |
||
| 24 | } |
||
| 25 | ctx.ReplyEmbedAttachmentImageURL("", fmt.Sprintf(ctx.Loc("slapping"), ctx.User.Username, mention), url) |
||
|
|
|||
| 26 | } |
||
| 27 | } else { |
||
| 28 | fmt.Printf(err.Error()) |
||
| 29 | } |
||
| 55 | } |