File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ func init() {
42
42
"!histoire-pour-enfant" : doHistoirePourEnfant ,
43
43
"!moulsay" : doMoulsay ,
44
44
"!roulette" : doRoulette ,
45
+ "!nombre" : doNombre ,
45
46
"!ntw" : doNtw ,
46
47
}
47
48
// FIXME: !pause 5min
@@ -150,6 +151,25 @@ func doRecettator(s *discordgo.Session, m *discordgo.MessageCreate) error {
150
151
return nil
151
152
}
152
153
154
+ func doNombre (s * discordgo.Session , m * discordgo.MessageCreate ) error {
155
+ content := strings .Split (m .Content , " " )
156
+ if len (content ) < 3 {
157
+ s .ChannelMessageSend (m .ChannelID , "exemple: !nombre 1 100" )
158
+ return nil
159
+ }
160
+ a , err := strconv .Atoi (content [1 ])
161
+ if err != nil {
162
+ return err
163
+ }
164
+ b , err := strconv .Atoi (content [2 ])
165
+ if err != nil {
166
+ return err
167
+ }
168
+ nbr := rand .Intn (b ) + a
169
+ s .ChannelMessageSend (m .ChannelID , fmt .Sprintf ("%d" , nbr ))
170
+ return nil
171
+ }
172
+
153
173
func doRoulette (s * discordgo.Session , m * discordgo.MessageCreate ) error {
154
174
os .MkdirAll ("data" , 0777 )
155
175
db , err := gorm .Open ("sqlite3" , "data/roulette.db" )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ require (
13
13
github.com/imdario/mergo v0.3.9 // indirect
14
14
github.com/jinzhu/gorm v1.9.12
15
15
github.com/karrick/godirwalk v1.15.6 // indirect
16
+ github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
16
17
github.com/oklog/run v1.1.0
17
18
github.com/peterbourgon/ff/v3 v3.0.0
18
19
github.com/sirupsen/logrus v1.5.0 // indirect
@@ -24,7 +25,7 @@ require (
24
25
moul.io/godev v1.6.0
25
26
moul.io/moulsay v1.3.0
26
27
moul.io/number-to-words v0.6.0
27
- moul.io/pipotron v1.8.1-0.20200416220341-8aa407f4150c
28
+ moul.io/pipotron v1.9.0
28
29
ultre.me/recettator v0.4.0
29
30
)
30
31
Original file line number Diff line number Diff line change @@ -275,6 +275,8 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
275
275
github.com/mattn/go-runewidth v0.0.7 /go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI =
276
276
github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw =
277
277
github.com/mattn/go-sqlite3 v2.0.1+incompatible /go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc =
278
+ github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U =
279
+ github.com/mattn/go-sqlite3 v2.0.3+incompatible /go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc =
278
280
github.com/matttproud/golang_protobuf_extensions v1.0.1 /go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0 =
279
281
github.com/miekg/mmark v1.3.6 /go.mod h1:w7r9mkTvpS55jlfyn22qJ618itLryxXBhA7Jp3FIlkw =
280
282
github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ =
@@ -587,8 +589,8 @@ moul.io/moulsay v1.3.0 h1:7ZV4d2oQRuBH0M7NWKx41gG5edwXotMIgzZ2e1wgMMg=
587
589
moul.io/moulsay v1.3.0 /go.mod h1:m1Bd/M8JhWrsEaBBIRqwW0jgNPLectvU1vfHAv4WhFg =
588
590
moul.io/number-to-words v0.6.0 h1:w5ZaDTFASB0v9SI6fedlwLs5DXnMl9Q7cMlMsatnIKg =
589
591
moul.io/number-to-words v0.6.0 /go.mod h1:y2h2Dy3ksovv3n7oHDypgxqCNc4X9COF0zM3jABnrnA =
590
- moul.io/pipotron v1.8.1-0.20200416220341-8aa407f4150c h1:nfTQCDOPsvI5jrhyUMh/UqZ9UOzB66wJHxeGCAmQZhk =
591
- moul.io/pipotron v1.8.1-0.20200416220341-8aa407f4150c /go.mod h1:rJ2583VCJpb/uHiSB7VzGoSnrDw1m0Erd8PGgdJmDYc =
592
+ moul.io/pipotron v1.9.0 h1:T1IeRiTCAUhxnASVMGfLiDGe8FIarxQuvRsbUtV4hIk =
593
+ moul.io/pipotron v1.9.0 /go.mod h1:rJ2583VCJpb/uHiSB7VzGoSnrDw1m0Erd8PGgdJmDYc =
592
594
moul.io/srand v1.4.0 h1:r5ZMiWDN0ni0lTV7KzJR/jx0K7GivJYW5WaXmufgeik =
593
595
moul.io/srand v1.4.0 /go.mod h1:P2uaZB+GFstFNo8sEj6/U8FRV1n25kD0LLckFpJ+qvc =
594
596
pack.ag/amqp v0.8.0 /go.mod h1:4/cbmt4EJXSKlG6LCfWHoqmN0uFdy5i/+YFz+fTfhV4 =
You can’t perform that action at this time.
0 commit comments