· 4 years ago · Sep 04, 2021, 05:16 PM
1// authenticates you with the API standard library
2const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
3
4const embeds = [
5 {
6 type: 'rich',
7 title: 'You dropped flvchiayi3!',
8 description: '',
9 image: {
10 url: `https://images-ext-1.discordapp.net/external/Lq9Fqv681EOkLYekxCdkJlTOhu19kxfu40rrgV70RUg/https/media.discordapp.net/attachments/876471711200067625/882270843416231996/image0.gif`,
11 },
12 color: 0xffffff
13 },
14{
15 type: 'rich',
16 title: 'You dropped flvdoah3!',
17 description: '',
18 image: {
19 url: `https://images-ext-1.discordapp.net/external/KMMiD6di48EQUvRmKCYm3Az22QOCin8Xl2Y-ulRUGuw/https/media.discordapp.net/attachments/876471711200067625/882274744886517840/image0.gif`,
20 },
21 color: 0xffffff
22 },
23{
24 type: 'rich',
25 title: 'You dropped flvyoonhye3!',
26 description: '',
27 image: {
28 url: `https://images-ext-1.discordapp.net/external/_c3rWMGc17SWGJdEW0OykGsZIlzvF2TjTqIeWHByGQs/https/media.discordapp.net/attachments/876471711200067625/882272388006420480/image0.gif`,
29 },
30 color: 0xffffff
31 },
32 {
33 type: 'rich',
34 title: 'You dropped gdlsoyeon1!',
35 description: '',
36 image: {
37 url: `https://images-ext-1.discordapp.net/external/h5-lHU243lOB1_ZTYwATYGPA96JxyxvzUEy4nQM3JqQ/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882280049724780594/image0.png?width=605&height=907`,
38 },
39 color: 0xffffff
40 },
41 {
42 type: 'rich',
43 title: 'You dropped gdlminnie1!',
44 description: '',
45 image: {
46 url: `https://images-ext-1.discordapp.net/external/kH2MdYHOcvdZv_79Fv-B5AE1YKluEomhL7I0OsBI3VE/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882280050697863178/image1.png?width=605&height=907`,
47 },
48 color: 0xffffff
49 },
50 {
51 type: 'rich',
52 title: 'You dropped gdlsoojin1!',
53 description: '',
54 image: {
55 url: `https://images-ext-1.discordapp.net/external/FmHTSM0Z4QyloSos_wNjUkkt_fEmvZ4jjtPiWE9yUm8/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882280055303176222/image5.png?width=605&height=907`,
56 },
57 color: 0xffffff
58 },
59 {
60 type: 'rich',
61 title: 'You dropped gdlmiyeon1!',
62 description: '',
63 image: {
64 url: `https://images-ext-2.discordapp.net/external/kHjJGVOrKE6F62SKVVy1w56J-Wwh-ZbJo0CIX9_8So4/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882280053931655188/image4.png?width=605&height=907`,
65 },
66 color: 0xffffff
67 },
68 {
69 type: 'rich',
70 title: 'You dropped gdlyuqi1!',
71 description: '',
72 image: {
73 url: `https://images-ext-1.discordapp.net/external/pundA0E6F0MkNQtK-TScfP6iY1FJBD1Jnt6T0CfcrgA/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882280052941787226/image3.png?width=605&height=907`,
74 },
75 color: 0xffffff
76 },
77 {
78 type: 'rich',
79 title: 'You dropped gdlshuhua1!',
80 description: '',
81 image: {
82 url: `https://images-ext-1.discordapp.net/external/Dj86-jDIH9ODI-SxyROiDvJRFaziOK4cQuwScrPB6ig/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882280051859673118/image2.png?width=605&height=907`,
83 },
84 color: 0xffffff
85 },
86 {
87 type: 'rich',
88 title: 'You dropped lnaheejin1!',
89 description: '',
90 image: {
91 url: `https://images-ext-1.discordapp.net/external/-yLAiddXQWFdDN3vCe3Prc_PvQ32TDSkUknxgQRlDYE/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583597536641094/image1.png?width=605&height=907`,
92 },
93 color: 0xffffff
94 },
95 {
96 type: 'rich',
97 title: 'You dropped lnahyunjin1!',
98 description: '',
99 image: {
100 url: `https://images-ext-2.discordapp.net/external/KrZIaL5vbGesqMFtutJ_rwjKe8ulwVHZPf9THFUsjQw/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583346297831464/image2.png?width=605&height=907`,
101 },
102 color: 0xffffff
103 },
104 {
105 type: 'rich',
106 title: 'You dropped lnahaseul1!',
107 description: '',
108 image: {
109 url: `https://images-ext-2.discordapp.net/external/QAs9EsEzjyRGaKDyh12ZUiUns0nakYZpenJZsdRR95U/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583946691477564/image1.png?width=605&height=907`,
110 },
111 color: 0xffffff
112 },
113 {
114 type: 'rich',
115 title: 'You dropped lnayeojin1!',
116 description: '',
117 image: {
118 url: `https://images-ext-2.discordapp.net/external/DseTZY5G_bgm_GWZNGA9vo-OyCut3BUSpVO0F1RSiJc/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583946020401162/image0.png?width=605&height=907`,
119 },
120 color: 0xffffff
121 },
122 {
123 type: 'rich',
124 title: 'You dropped lnavivi1!',
125 description: '',
126 image: {
127 url: `https://images-ext-2.discordapp.net/external/SoqIgF60qbiUpImG6OOiSeU5zsOkGRS30VZ-WXdEmHE/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882584026332921866/image0.png?width=605&height=907`,
128 },
129 color: 0xffffff
130 },
131 {
132 type: 'rich',
133 title: 'You dropped lnakimlip1!',
134 description: '',
135 image: {
136 url: `https://images-ext-1.discordapp.net/external/jjcHVzy13g1dWpjSWstpiZdVdfOk_tyA7rsI-ZgXtaI/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583599092731934/image2.png?width=605&height=907`,
137 },
138 color: 0xffffff
139 },
140 {
141 type: 'rich',
142 title: 'You dropped lnachoerry1!',
143 description: '',
144 image: {
145 url: `https://images-ext-1.discordapp.net/external/KX70Se_ngiqV0BwnNvqw_xMD2qcK6SOApjcF26Cza2Q/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583345287036958/image1.png?width=605&height=907`,
146 },
147 color: 0xffffff
148 },
149 {
150 type: 'rich',
151 title: 'You dropped lnajinsoul1!',
152 description: '',
153 image: {
154 url: `https://images-ext-1.discordapp.net/external/UFEi3eg4a1eqoMRukmce6c2-iut5HMNID3ZS35aKacE/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583947651993600/image2.png?width=605&height=907`,
155 },
156 color: 0xffffff
157 },
158 {
159 type: 'rich',
160 title: 'You dropped lnayves1!',
161 description: '',
162 image: {
163 url: `https://images-ext-2.discordapp.net/external/SWAJFtMu4InKlcQ2AGuO3xT8V_dpomFnGAI92ItVqxg/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583600166498334/image3.png?width=605&height=907`,
164 },
165 color: 0xffffff
166 },
167 {
168 type: 'rich',
169 title: 'You dropped lnachuu1!',
170 description: '',
171 image: {
172 url: `https://images-ext-1.discordapp.net/external/rhKwzW1Ro0-YvcirRX4c9OT6HSrDo-e1LqPFs2AbLp8/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583344179707904/image0.png?width=400&height=600`,
173 },
174 color: 0xffffff
175 },
176 {
177 type: 'rich',
178 title: 'You dropped lnagowon1!',
179 description: '',
180 image: {
181 url: `https://images-ext-2.discordapp.net/external/X-Zb6Hh1lmhMwxxdvIhfsAR8RWeJl6LvJi8lcMxlsNc/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583950004977674/image3.png?width=605&height=907`,
182 },
183 color: 0xffffff
184 },
185 {
186 type: 'rich',
187 title: 'You dropped lnahyejoo1!',
188 description: '',
189 image: {
190 url: `https://images-ext-2.discordapp.net/external/KaQlVRhiov3XNRlK_rSu3u8OGCN54hzotblKgPQiHXE/%3Fwidth%3D780%26height%3D1170/https/media.discordapp.net/attachments/876471711200067625/882583595884101642/image0.png?width=605&height=907`,
191 },
192 color: 0xffffff
193 }
194 ]
195
196if (context.params.event.content.startsWith(';vavi')) {
197 let randomEmbed = embeds[Math.floor(Math.random() * embeds.length)];
198 let rateLimit = await lib.utils.kv['@0.1.16'].get({
199 key: `rate_limit_example_${context.params.event.author.id}`
200 });
201 if (rateLimit) {
202 return lib.discord.channels['@0.1.1'].messages.create({
203 channel_id: `${context.params.event.channel_id}`,
204 content: `Sorry, you gotta wait 20 minutes between drops!`
205 });
206 } else {
207 await lib.utils.kv['@0.1.16'].set({
208 key: `rate_limit_example_${context.params.event.author.id}`,
209 value: `true`,
210 ttl: 1200
211 });
212 return lib.discord.channels['@0.1.1'].messages.create({
213 channel_id: `${context.params.event.channel_id}`,
214 content: '',
215 tts: false,
216 embed: randomEmbed
217 });
218 }
219}