1 | package cmd |
||
2 | |||
3 | import ( |
||
4 | "fmt" |
||
5 | "github.com/FlameInTheDark/dtbot/api/fun" |
||
6 | "github.com/FlameInTheDark/dtbot/bot" |
||
7 | ) |
||
8 | |||
9 | // SlapCommand returns slap image |
||
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) |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
26 | } |
||
27 | } else { |
||
28 | fmt.Printf(err.Error()) |
||
0 ignored issues
–
show
|
|||
29 | } |
||
30 | } |
||
31 | } |
||
32 | |||
33 | // FUCommand returns FU image |
||
34 | func FUCommand(ctx bot.Context) { |
||
35 | if len(ctx.Args) > 0 { |
||
36 | ctx.MetricsCommand("fun", "fu") |
||
37 | url, err := fun.GetImageURL("fu") |
||
38 | if err == nil { |
||
39 | if len(ctx.Args) > 0 { |
||
40 | var userID string |
||
41 | if len(ctx.Args[0]) > 3 { |
||
42 | userID = ctx.Args[0][2 : len(ctx.Args[0])-1] |
||
43 | } |
||
44 | user := ctx.GetGuildUser(userID) |
||
45 | var mention = ctx.Args[0] |
||
46 | if user != nil { |
||
47 | mention = user.Username |
||
48 | } |
||
49 | ctx.ReplyEmbedAttachmentImageURL("", fmt.Sprintf(ctx.Loc("send_fu"), ctx.User.Username, mention), url) |
||
0 ignored issues
–
show
|
|||
50 | } |
||
51 | } else { |
||
52 | fmt.Printf(err.Error()) |
||
0 ignored issues
–
show
|
|||
53 | } |
||
54 | } |
||
55 | } |