tangled
alpha
login
or
join now
isabelroses.com
/
blahaj
1
fork
atom
silly goober bot
1
fork
atom
overview
issues
pulls
pipelines
feat: code expantion
isabelroses.com
2 years ago
c7e2299f
95136d04
+465
-11
4 changed files
expand all
collapse all
unified
split
Cargo.lock
Cargo.toml
src
event_handler
code_expantion.rs
mod.rs
+348
-9
Cargo.lock
···
62
]
63
64
[[package]]
0
0
0
0
0
0
65
name = "autocfg"
66
version = "1.3.0"
67
source = "registry+https://github.com/rust-lang/crates.io-index"
···
113
"color-eyre",
114
"dotenv",
115
"humantime",
0
116
"poise",
117
"regex",
0
118
"serenity",
119
"tokio",
120
]
···
464
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
465
466
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
467
name = "form_urlencoded"
468
version = "1.2.1"
469
source = "registry+https://github.com/rust-lang/crates.io-index"
···
611
]
612
613
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
614
name = "hashbrown"
615
version = "0.14.5"
616
source = "registry+https://github.com/rust-lang/crates.io-index"
···
656
]
657
658
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
659
name = "httparse"
660
version = "1.8.0"
661
source = "registry+https://github.com/rust-lang/crates.io-index"
···
683
"futures-channel",
684
"futures-core",
685
"futures-util",
686
-
"h2",
687
"http 0.2.12",
688
-
"http-body",
689
"httparse",
690
"httpdate",
691
"itoa",
···
698
]
699
700
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
701
name = "hyper-rustls"
702
version = "0.24.2"
703
source = "registry+https://github.com/rust-lang/crates.io-index"
···
705
dependencies = [
706
"futures-util",
707
"http 0.2.12",
708
-
"hyper",
709
"rustls 0.21.12",
710
"tokio",
711
"tokio-rustls 0.24.1",
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
712
]
713
714
[[package]]
···
885
]
886
887
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
888
name = "num-conv"
889
version = "0.1.0"
890
source = "registry+https://github.com/rust-lang/crates.io-index"
···
925
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
926
927
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
928
name = "owo-colors"
929
version = "3.5.0"
930
source = "registry+https://github.com/rust-lang/crates.io-index"
···
960
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
961
962
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
963
name = "pin-project-lite"
964
version = "0.2.14"
965
source = "registry+https://github.com/rust-lang/crates.io-index"
···
970
version = "0.1.0"
971
source = "registry+https://github.com/rust-lang/crates.io-index"
972
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
0
0
0
0
0
0
973
974
[[package]]
975
name = "poise"
···
1120
"encoding_rs",
1121
"futures-core",
1122
"futures-util",
1123
-
"h2",
1124
"http 0.2.12",
1125
-
"http-body",
1126
-
"hyper",
1127
"hyper-rustls",
1128
"ipnet",
1129
"js-sys",
···
1134
"percent-encoding",
1135
"pin-project-lite",
1136
"rustls 0.21.12",
1137
-
"rustls-pemfile",
1138
"serde",
1139
"serde_json",
1140
"serde_urlencoded",
···
1150
"wasm-streams",
1151
"web-sys",
1152
"webpki-roots 0.25.4",
1153
-
"winreg",
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1154
]
1155
1156
[[package]]
···
1223
]
1224
1225
[[package]]
0
0
0
0
0
0
0
0
0
0
1226
name = "rustls-pki-types"
1227
version = "1.7.0"
1228
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1265
]
1266
1267
[[package]]
0
0
0
0
0
0
0
0
0
1268
name = "scopeguard"
1269
version = "1.2.0"
1270
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1291
]
1292
1293
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1294
name = "semver"
1295
version = "1.0.23"
1296
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1372
"mime_guess",
1373
"parking_lot",
1374
"percent-encoding",
1375
-
"reqwest",
1376
"secrecy",
1377
"serde",
1378
"serde_cow",
···
1644
]
1645
1646
[[package]]
0
0
0
0
0
0
0
0
0
0
1647
name = "tokio-rustls"
1648
version = "0.24.1"
1649
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1692
"pin-project-lite",
1693
"tokio",
1694
]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1695
1696
[[package]]
1697
name = "tower-service"
···
1892
version = "0.1.0"
1893
source = "registry+https://github.com/rust-lang/crates.io-index"
1894
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
0
0
0
0
0
0
1895
1896
[[package]]
1897
name = "version_check"
···
2190
version = "0.50.0"
2191
source = "registry+https://github.com/rust-lang/crates.io-index"
2192
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
0
0
0
0
0
0
0
0
0
0
2193
dependencies = [
2194
"cfg-if",
2195
"windows-sys 0.48.0",
···
62
]
63
64
[[package]]
65
+
name = "atomic-waker"
66
+
version = "1.1.2"
67
+
source = "registry+https://github.com/rust-lang/crates.io-index"
68
+
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
69
+
70
+
[[package]]
71
name = "autocfg"
72
version = "1.3.0"
73
source = "registry+https://github.com/rust-lang/crates.io-index"
···
119
"color-eyre",
120
"dotenv",
121
"humantime",
122
+
"lazy_static",
123
"poise",
124
"regex",
125
+
"reqwest 0.12.4",
126
"serenity",
127
"tokio",
128
]
···
472
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
473
474
[[package]]
475
+
name = "foreign-types"
476
+
version = "0.3.2"
477
+
source = "registry+https://github.com/rust-lang/crates.io-index"
478
+
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
479
+
dependencies = [
480
+
"foreign-types-shared",
481
+
]
482
+
483
+
[[package]]
484
+
name = "foreign-types-shared"
485
+
version = "0.1.1"
486
+
source = "registry+https://github.com/rust-lang/crates.io-index"
487
+
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
488
+
489
+
[[package]]
490
name = "form_urlencoded"
491
version = "1.2.1"
492
source = "registry+https://github.com/rust-lang/crates.io-index"
···
634
]
635
636
[[package]]
637
+
name = "h2"
638
+
version = "0.4.5"
639
+
source = "registry+https://github.com/rust-lang/crates.io-index"
640
+
checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
641
+
dependencies = [
642
+
"atomic-waker",
643
+
"bytes",
644
+
"fnv",
645
+
"futures-core",
646
+
"futures-sink",
647
+
"http 1.1.0",
648
+
"indexmap",
649
+
"slab",
650
+
"tokio",
651
+
"tokio-util",
652
+
"tracing",
653
+
]
654
+
655
+
[[package]]
656
name = "hashbrown"
657
version = "0.14.5"
658
source = "registry+https://github.com/rust-lang/crates.io-index"
···
698
]
699
700
[[package]]
701
+
name = "http-body"
702
+
version = "1.0.0"
703
+
source = "registry+https://github.com/rust-lang/crates.io-index"
704
+
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
705
+
dependencies = [
706
+
"bytes",
707
+
"http 1.1.0",
708
+
]
709
+
710
+
[[package]]
711
+
name = "http-body-util"
712
+
version = "0.1.1"
713
+
source = "registry+https://github.com/rust-lang/crates.io-index"
714
+
checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d"
715
+
dependencies = [
716
+
"bytes",
717
+
"futures-core",
718
+
"http 1.1.0",
719
+
"http-body 1.0.0",
720
+
"pin-project-lite",
721
+
]
722
+
723
+
[[package]]
724
name = "httparse"
725
version = "1.8.0"
726
source = "registry+https://github.com/rust-lang/crates.io-index"
···
748
"futures-channel",
749
"futures-core",
750
"futures-util",
751
+
"h2 0.3.26",
752
"http 0.2.12",
753
+
"http-body 0.4.6",
754
"httparse",
755
"httpdate",
756
"itoa",
···
763
]
764
765
[[package]]
766
+
name = "hyper"
767
+
version = "1.3.1"
768
+
source = "registry+https://github.com/rust-lang/crates.io-index"
769
+
checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d"
770
+
dependencies = [
771
+
"bytes",
772
+
"futures-channel",
773
+
"futures-util",
774
+
"h2 0.4.5",
775
+
"http 1.1.0",
776
+
"http-body 1.0.0",
777
+
"httparse",
778
+
"itoa",
779
+
"pin-project-lite",
780
+
"smallvec",
781
+
"tokio",
782
+
"want",
783
+
]
784
+
785
+
[[package]]
786
name = "hyper-rustls"
787
version = "0.24.2"
788
source = "registry+https://github.com/rust-lang/crates.io-index"
···
790
dependencies = [
791
"futures-util",
792
"http 0.2.12",
793
+
"hyper 0.14.29",
794
"rustls 0.21.12",
795
"tokio",
796
"tokio-rustls 0.24.1",
797
+
]
798
+
799
+
[[package]]
800
+
name = "hyper-tls"
801
+
version = "0.6.0"
802
+
source = "registry+https://github.com/rust-lang/crates.io-index"
803
+
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
804
+
dependencies = [
805
+
"bytes",
806
+
"http-body-util",
807
+
"hyper 1.3.1",
808
+
"hyper-util",
809
+
"native-tls",
810
+
"tokio",
811
+
"tokio-native-tls",
812
+
"tower-service",
813
+
]
814
+
815
+
[[package]]
816
+
name = "hyper-util"
817
+
version = "0.1.5"
818
+
source = "registry+https://github.com/rust-lang/crates.io-index"
819
+
checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56"
820
+
dependencies = [
821
+
"bytes",
822
+
"futures-channel",
823
+
"futures-util",
824
+
"http 1.1.0",
825
+
"http-body 1.0.0",
826
+
"hyper 1.3.1",
827
+
"pin-project-lite",
828
+
"socket2",
829
+
"tokio",
830
+
"tower",
831
+
"tower-service",
832
+
"tracing",
833
]
834
835
[[package]]
···
1006
]
1007
1008
[[package]]
1009
+
name = "native-tls"
1010
+
version = "0.2.12"
1011
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1012
+
checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466"
1013
+
dependencies = [
1014
+
"libc",
1015
+
"log",
1016
+
"openssl",
1017
+
"openssl-probe",
1018
+
"openssl-sys",
1019
+
"schannel",
1020
+
"security-framework",
1021
+
"security-framework-sys",
1022
+
"tempfile",
1023
+
]
1024
+
1025
+
[[package]]
1026
name = "num-conv"
1027
version = "0.1.0"
1028
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1063
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
1064
1065
[[package]]
1066
+
name = "openssl"
1067
+
version = "0.10.64"
1068
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1069
+
checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f"
1070
+
dependencies = [
1071
+
"bitflags 2.5.0",
1072
+
"cfg-if",
1073
+
"foreign-types",
1074
+
"libc",
1075
+
"once_cell",
1076
+
"openssl-macros",
1077
+
"openssl-sys",
1078
+
]
1079
+
1080
+
[[package]]
1081
+
name = "openssl-macros"
1082
+
version = "0.1.1"
1083
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1084
+
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
1085
+
dependencies = [
1086
+
"proc-macro2",
1087
+
"quote",
1088
+
"syn 2.0.66",
1089
+
]
1090
+
1091
+
[[package]]
1092
+
name = "openssl-probe"
1093
+
version = "0.1.5"
1094
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1095
+
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
1096
+
1097
+
[[package]]
1098
+
name = "openssl-sys"
1099
+
version = "0.9.102"
1100
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1101
+
checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2"
1102
+
dependencies = [
1103
+
"cc",
1104
+
"libc",
1105
+
"pkg-config",
1106
+
"vcpkg",
1107
+
]
1108
+
1109
+
[[package]]
1110
name = "owo-colors"
1111
version = "3.5.0"
1112
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1142
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
1143
1144
[[package]]
1145
+
name = "pin-project"
1146
+
version = "1.1.5"
1147
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1148
+
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
1149
+
dependencies = [
1150
+
"pin-project-internal",
1151
+
]
1152
+
1153
+
[[package]]
1154
+
name = "pin-project-internal"
1155
+
version = "1.1.5"
1156
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1157
+
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
1158
+
dependencies = [
1159
+
"proc-macro2",
1160
+
"quote",
1161
+
"syn 2.0.66",
1162
+
]
1163
+
1164
+
[[package]]
1165
name = "pin-project-lite"
1166
version = "0.2.14"
1167
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1172
version = "0.1.0"
1173
source = "registry+https://github.com/rust-lang/crates.io-index"
1174
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
1175
+
1176
+
[[package]]
1177
+
name = "pkg-config"
1178
+
version = "0.3.30"
1179
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1180
+
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
1181
1182
[[package]]
1183
name = "poise"
···
1328
"encoding_rs",
1329
"futures-core",
1330
"futures-util",
1331
+
"h2 0.3.26",
1332
"http 0.2.12",
1333
+
"http-body 0.4.6",
1334
+
"hyper 0.14.29",
1335
"hyper-rustls",
1336
"ipnet",
1337
"js-sys",
···
1342
"percent-encoding",
1343
"pin-project-lite",
1344
"rustls 0.21.12",
1345
+
"rustls-pemfile 1.0.4",
1346
"serde",
1347
"serde_json",
1348
"serde_urlencoded",
···
1358
"wasm-streams",
1359
"web-sys",
1360
"webpki-roots 0.25.4",
1361
+
"winreg 0.50.0",
1362
+
]
1363
+
1364
+
[[package]]
1365
+
name = "reqwest"
1366
+
version = "0.12.4"
1367
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1368
+
checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10"
1369
+
dependencies = [
1370
+
"base64 0.22.1",
1371
+
"bytes",
1372
+
"encoding_rs",
1373
+
"futures-core",
1374
+
"futures-util",
1375
+
"h2 0.4.5",
1376
+
"http 1.1.0",
1377
+
"http-body 1.0.0",
1378
+
"http-body-util",
1379
+
"hyper 1.3.1",
1380
+
"hyper-tls",
1381
+
"hyper-util",
1382
+
"ipnet",
1383
+
"js-sys",
1384
+
"log",
1385
+
"mime",
1386
+
"native-tls",
1387
+
"once_cell",
1388
+
"percent-encoding",
1389
+
"pin-project-lite",
1390
+
"rustls-pemfile 2.1.2",
1391
+
"serde",
1392
+
"serde_json",
1393
+
"serde_urlencoded",
1394
+
"sync_wrapper",
1395
+
"system-configuration",
1396
+
"tokio",
1397
+
"tokio-native-tls",
1398
+
"tower-service",
1399
+
"url",
1400
+
"wasm-bindgen",
1401
+
"wasm-bindgen-futures",
1402
+
"web-sys",
1403
+
"winreg 0.52.0",
1404
]
1405
1406
[[package]]
···
1473
]
1474
1475
[[package]]
1476
+
name = "rustls-pemfile"
1477
+
version = "2.1.2"
1478
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1479
+
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
1480
+
dependencies = [
1481
+
"base64 0.22.1",
1482
+
"rustls-pki-types",
1483
+
]
1484
+
1485
+
[[package]]
1486
name = "rustls-pki-types"
1487
version = "1.7.0"
1488
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1525
]
1526
1527
[[package]]
1528
+
name = "schannel"
1529
+
version = "0.1.23"
1530
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1531
+
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
1532
+
dependencies = [
1533
+
"windows-sys 0.52.0",
1534
+
]
1535
+
1536
+
[[package]]
1537
name = "scopeguard"
1538
version = "1.2.0"
1539
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1560
]
1561
1562
[[package]]
1563
+
name = "security-framework"
1564
+
version = "2.11.0"
1565
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1566
+
checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0"
1567
+
dependencies = [
1568
+
"bitflags 2.5.0",
1569
+
"core-foundation",
1570
+
"core-foundation-sys",
1571
+
"libc",
1572
+
"security-framework-sys",
1573
+
]
1574
+
1575
+
[[package]]
1576
+
name = "security-framework-sys"
1577
+
version = "2.11.0"
1578
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1579
+
checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7"
1580
+
dependencies = [
1581
+
"core-foundation-sys",
1582
+
"libc",
1583
+
]
1584
+
1585
+
[[package]]
1586
name = "semver"
1587
version = "1.0.23"
1588
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1664
"mime_guess",
1665
"parking_lot",
1666
"percent-encoding",
1667
+
"reqwest 0.11.27",
1668
"secrecy",
1669
"serde",
1670
"serde_cow",
···
1936
]
1937
1938
[[package]]
1939
+
name = "tokio-native-tls"
1940
+
version = "0.3.1"
1941
+
source = "registry+https://github.com/rust-lang/crates.io-index"
1942
+
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
1943
+
dependencies = [
1944
+
"native-tls",
1945
+
"tokio",
1946
+
]
1947
+
1948
+
[[package]]
1949
name = "tokio-rustls"
1950
version = "0.24.1"
1951
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1994
"pin-project-lite",
1995
"tokio",
1996
]
1997
+
1998
+
[[package]]
1999
+
name = "tower"
2000
+
version = "0.4.13"
2001
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2002
+
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
2003
+
dependencies = [
2004
+
"futures-core",
2005
+
"futures-util",
2006
+
"pin-project",
2007
+
"pin-project-lite",
2008
+
"tokio",
2009
+
"tower-layer",
2010
+
"tower-service",
2011
+
]
2012
+
2013
+
[[package]]
2014
+
name = "tower-layer"
2015
+
version = "0.3.2"
2016
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2017
+
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
2018
2019
[[package]]
2020
name = "tower-service"
···
2215
version = "0.1.0"
2216
source = "registry+https://github.com/rust-lang/crates.io-index"
2217
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
2218
+
2219
+
[[package]]
2220
+
name = "vcpkg"
2221
+
version = "0.2.15"
2222
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2223
+
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
2224
2225
[[package]]
2226
name = "version_check"
···
2519
version = "0.50.0"
2520
source = "registry+https://github.com/rust-lang/crates.io-index"
2521
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
2522
+
dependencies = [
2523
+
"cfg-if",
2524
+
"windows-sys 0.48.0",
2525
+
]
2526
+
2527
+
[[package]]
2528
+
name = "winreg"
2529
+
version = "0.52.0"
2530
+
source = "registry+https://github.com/rust-lang/crates.io-index"
2531
+
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
2532
dependencies = [
2533
"cfg-if",
2534
"windows-sys 0.48.0",
+2
Cargo.toml
···
18
color-eyre = "0.6.3"
19
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
20
regex = "1.10.5"
0
0
···
18
color-eyre = "0.6.3"
19
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
20
regex = "1.10.5"
21
+
reqwest = "0.12.4"
22
+
lazy_static = "1.4.0"
+109
src/event_handler/code_expantion.rs
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
use color_eyre::eyre::Result;
2
+
use poise::serenity_prelude::{self as serenity, Context, CreateMessage, FullEvent};
3
+
use regex::Regex;
4
+
use reqwest::Client;
5
+
6
+
pub async fn handle(ctx: &Context, event: &FullEvent) -> Result<()> {
7
+
let pattern =
8
+
r"https?:\/\/github\.com\/([\w-]+\/[\w.-]+)\/blob\/(.+?)\/(.+?)#L(\d+)[~-]?L?(\d*)";
9
+
let re = Regex::new(pattern)?;
10
+
11
+
if let FullEvent::Message { new_message } = event {
12
+
let content = &new_message.content;
13
+
if re.captures(content.as_str()).is_some() {
14
+
let mut code_blocks = Vec::new();
15
+
16
+
for caps in re.captures_iter(content) {
17
+
let full_url = caps.get(0).unwrap().as_str();
18
+
let repo = caps.get(1).unwrap().as_str();
19
+
let reference = caps.get(2).unwrap().as_str();
20
+
let file = caps.get(3).unwrap().as_str();
21
+
let start_str = caps.get(4).unwrap().as_str();
22
+
let start = start_str.parse::<usize>().unwrap_or(1);
23
+
let end = if let Some(end_str) = caps.get(5) {
24
+
end_str.as_str().parse::<usize>().unwrap_or(start)
25
+
} else {
26
+
start
27
+
};
28
+
29
+
let raw_url = format!(
30
+
"https://raw.githubusercontent.com/{}/{}/{}",
31
+
repo, reference, file
32
+
);
33
+
let response = Client::new().get(&raw_url).send().await;
34
+
35
+
if let Ok(response) = response {
36
+
if !response.status().is_success() {
37
+
println!("Failed to fetch {} contents.", full_url);
38
+
continue;
39
+
}
40
+
41
+
let text = response.text().await?;
42
+
let mut content = text
43
+
.lines()
44
+
.skip(start - 1)
45
+
.take(end - start + 1)
46
+
.collect::<Vec<&str>>()
47
+
.join("\n");
48
+
49
+
let mut lines_sliced = 0;
50
+
51
+
while content.len() > 1950 {
52
+
let lines = content.lines().collect::<Vec<&str>>();
53
+
if lines.len() == 1 {
54
+
content = content.chars().take(1950).collect();
55
+
break;
56
+
}
57
+
content = lines[..lines.len() - 1].join("\n");
58
+
lines_sliced += 1;
59
+
}
60
+
let end = end - lines_sliced;
61
+
62
+
let name = format!(
63
+
"{repo}@{} {file} L{start}{}",
64
+
if reference.len() == 40 {
65
+
&reference[..8]
66
+
} else {
67
+
reference
68
+
},
69
+
if end > start {
70
+
format!("-{}", end)
71
+
} else {
72
+
"".to_string()
73
+
}
74
+
);
75
+
76
+
let body = if lines_sliced > 0 {
77
+
format!("... ({} lines not displayed)", lines_sliced)
78
+
} else {
79
+
"".to_string()
80
+
};
81
+
82
+
let language = file.split('.').last().unwrap_or("").to_string();
83
+
code_blocks.push((name, language, content, body));
84
+
}
85
+
}
86
+
87
+
code_blocks.retain(|(_, _, content, _)| !content.trim().is_empty());
88
+
89
+
if !code_blocks.is_empty() {
90
+
let embeds = code_blocks
91
+
.into_iter()
92
+
.map(|(name, language, content, body)| {
93
+
serenity::CreateEmbed::default()
94
+
.title(name)
95
+
.description(format!("```{}\n{}\n```", language, content).to_owned())
96
+
.footer(serenity::CreateEmbedFooter::new(body))
97
+
})
98
+
.collect::<Vec<_>>();
99
+
100
+
new_message
101
+
.channel_id
102
+
.send_message(&ctx, CreateMessage::default().embeds(embeds))
103
+
.await?;
104
+
}
105
+
}
106
+
}
107
+
108
+
Ok(())
109
+
}
+6
-2
src/event_handler/mod.rs
···
1
use color_eyre::eyre::Result;
2
use poise::serenity_prelude::{Context, FullEvent};
3
0
0
4
use crate::Data;
5
6
-
// TODO: add more events
7
-
pub async fn event_handler(_ctx: &Context, event: &FullEvent, _data: &Data) -> Result<()> {
8
if let FullEvent::Ready { data_about_bot } = event {
9
println!("Logged in as {}", data_about_bot.user.name);
10
}
0
0
11
12
Ok(())
13
}
···
1
use color_eyre::eyre::Result;
2
use poise::serenity_prelude::{Context, FullEvent};
3
4
+
mod code_expantion;
5
+
6
use crate::Data;
7
8
+
// TODO: add starboard
9
+
pub async fn event_handler(ctx: &Context, event: &FullEvent, _data: &Data) -> Result<()> {
10
if let FullEvent::Ready { data_about_bot } = event {
11
println!("Logged in as {}", data_about_bot.user.name);
12
}
13
+
14
+
code_expantion::handle(ctx, event).await?;
15
16
Ok(())
17
}