| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package bot |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "bytes" |
||
| 5 | "fmt" |
||
| 6 | "net/http" |
||
| 7 | ) |
||
| 8 | |||
| 9 | func (ctx *Context) MetricsCommand(command string) { |
||
|
|
|||
| 10 | query := []byte(fmt.Sprintf("commands,server=%v,user=%v command=\"%v\"", ctx.Guild.ID, ctx.Message.Author.ID, command)) |
||
| 11 | addr := fmt.Sprintf("%v/write?db=%v", ctx.Conf.Metrics.Address, ctx.Conf.Metrics.Database) |
||
| 12 | r := bytes.NewReader(query) |
||
| 13 | _, _ = http.Post(addr, "", r) |
||
| 14 | } |
||
| 15 | |||
| 16 | func (ctx *Context) MetricsLog(module string) { |
||
| 17 | query := []byte(fmt.Sprintf("logs,server=%v module=\"%v\"", ctx.Guild.ID, module)) |
||
| 18 | addr := fmt.Sprintf("%v/write?db=%v", ctx.Conf.Metrics.Address, ctx.Conf.Metrics.Database) |
||
| 19 | r := bytes.NewReader(query) |
||
| 20 | _, _ = http.Post(addr, "", r) |
||
| 21 | } |
||
| 22 |