|
230 | 230 | "@commands.has_permissions(${1:permission_name}=True)" |
231 | 231 | ] |
232 | 232 | }, |
| 233 | + "discord.py guild_only template": { |
| 234 | + "prefix": "!guild_only", |
| 235 | + "body": [ |
| 236 | + "@commands.guild_only()", |
| 237 | + ] |
| 238 | + }, |
233 | 239 | "discord.py wait_for template for on_reaction_add": { |
234 | 240 | "prefix": "!waitforreaction", |
235 | 241 | "body": [ |
|
241 | 247 | " $0" |
242 | 248 | ] |
243 | 249 | }, |
244 | | - |
245 | 250 | "discord.py wait_for template for on_message": { |
246 | 251 | "prefix": "!waitformessage", |
247 | 252 | "body": [ |
|
253 | 258 | " $0" |
254 | 259 | ] |
255 | 260 | }, |
256 | | - |
257 | 261 | "discord.py embed page reaction template": { |
258 | 262 | "prefix": "!embpagere", |
259 | 263 | "body": [ |
|
284 | 288 | " await msg.add_reaction(bt)", |
285 | 289 | " except:", |
286 | 290 | " pass", |
287 | | - "try:", |
288 | | - " reaction, user = await ${1|bot,client,self.bot|}.wait_for('reaction_add', check=lambda r, u: ${13:u == ctx.author and r.message.channel.id == ctx.channel.id and and r.emoji in buttons}, timeout=${14|15,30,45,60,120,300,900|})", |
289 | | - "except asyncio.TimeoutError:", |
290 | | - " for btn in buttons:", |
291 | | - " try:", |
292 | | - " await msg.clear_reaction(btn)", |
293 | | - " except:", |
294 | | - " pass", |
295 | | - "else:", |
296 | | - " previous_page = curent", |
297 | | - " if reaction.emoji == buttons[0]:", |
298 | | - " curent = 0", |
299 | | - " try:", |
300 | | - " await msg.remove_reaction(str(reaction.emoji), user)", |
301 | | - " except:", |
302 | | - " pass", |
303 | | - " await msg.edit(embed=${10:embeds}[curent])", |
304 | | - " elif reaction.emoji == buttons[1]:", |
305 | | - " if curent > 0:", |
306 | | - " curent -= 1", |
307 | | - " try:", |
308 | | - " await msg.remove_reaction(str(reaction.emoji), user)", |
309 | | - " except:", |
310 | | - " pass", |
311 | | - " if curent != previous_page:", |
312 | | - " await msg.edit(embed=${10:embeds}[curent])", |
313 | | - " elif reaction.emoji == buttons[3]:", |
314 | | - " if curent < num_of_${10:embeds} - 1:", |
315 | | - " curent += 1", |
316 | | - " try:", |
317 | | - " await msg.remove_reaction(str(reaction.emoji), user)", |
318 | | - " except:", |
319 | | - " pass", |
320 | | - " if curent != previous_page:", |
321 | | - " await msg.edit(embed=${10:embeds}[curent])", |
322 | | - " elif reaction.emoji == buttons[4]:", |
323 | | - " curent = num_of_${10:embeds} - 1", |
324 | | - " try:", |
325 | | - " await msg.remove_reaction(str(reaction.emoji), user)", |
326 | | - " except:", |
327 | | - " pass", |
328 | | - " if curent != previous_page:", |
| 291 | + "while True:", |
| 292 | + " try:", |
| 293 | + " reaction, user = await ${1|bot,client,self.bot|}.wait_for('reaction_add', check=lambda r, u: ${13:u == ctx.author and r.message.channel.id == ctx.channel.id and and r.emoji in buttons}, timeout=${14|15,30,45,60,120,300,900|})", |
| 294 | + " except asyncio.TimeoutError:", |
| 295 | + " for btn in buttons:", |
| 296 | + " try:", |
| 297 | + " await msg.clear_reaction(btn)", |
| 298 | + " except:", |
| 299 | + " pass", |
| 300 | + " else:", |
| 301 | + " previous_page = curent", |
| 302 | + " if reaction.emoji == buttons[0]:", |
| 303 | + " curent = 0", |
| 304 | + " try:", |
| 305 | + " await msg.remove_reaction(str(reaction.emoji), user)", |
| 306 | + " except:", |
| 307 | + " pass", |
329 | 308 | " await msg.edit(embed=${10:embeds}[curent])", |
330 | | - " elif reaction.emoji == buttons[2]:", |
331 | | - " await msg.remove_reaction(buttons[2], ctx.author)", |
332 | | - " for btns in buttons:", |
| 309 | + " elif reaction.emoji == buttons[1]:", |
| 310 | + " if curent > 0:", |
| 311 | + " curent -= 1", |
| 312 | + " try:", |
| 313 | + " await msg.remove_reaction(str(reaction.emoji), user)", |
| 314 | + " except:", |
| 315 | + " pass", |
| 316 | + " if curent != previous_page:", |
| 317 | + " await msg.edit(embed=${10:embeds}[curent])", |
| 318 | + " elif reaction.emoji == buttons[3]:", |
| 319 | + " if curent < num_of_${10:embeds} - 1:", |
| 320 | + " curent += 1", |
| 321 | + " try:", |
| 322 | + " await msg.remove_reaction(str(reaction.emoji), user)", |
| 323 | + " except:", |
| 324 | + " pass", |
| 325 | + " if curent != previous_page:", |
| 326 | + " await msg.edit(embed=${10:embeds}[curent])", |
| 327 | + " elif reaction.emoji == buttons[4]:", |
| 328 | + " curent = num_of_${10:embeds} - 1", |
333 | 329 | " try:", |
334 | | - " await msg.clear_reaction(btns)", |
| 330 | + " await msg.remove_reaction(str(reaction.emoji), user)", |
335 | 331 | " except:", |
336 | 332 | " pass", |
| 333 | + " if curent != previous_page:", |
| 334 | + " await msg.edit(embed=${10:embeds}[curent])", |
| 335 | + " elif reaction.emoji == buttons[2]:", |
| 336 | + " await msg.remove_reaction(buttons[2], ctx.author)", |
| 337 | + " for btns in buttons:", |
| 338 | + " try:", |
| 339 | + " await msg.clear_reaction(btns)", |
| 340 | + " except:", |
| 341 | + " pass", |
337 | 342 | ] |
338 | 343 | }, |
339 | | - |
340 | 344 | "discord.py Exception":{ |
341 | 345 | "prefix": "!except", |
342 | 346 | "body": [ |
|
347 | 351 | ], |
348 | 352 | "description": "Add a basic exception." |
349 | 353 | }, |
350 | | - |
351 | 354 | "discord.py UI Button":{ |
352 | 355 | "prefix": "!button", |
353 | 356 | "body": [ |
|
358 | 361 | ], |
359 | 362 | "description": "Add a basic button." |
360 | 363 | }, |
361 | | - |
362 | | - |
363 | 364 | "discord.py Custom UI Button":{ |
364 | 365 | "prefix": "!cbutton", |
365 | 366 | "body": [ |
|
378 | 379 | ], |
379 | 380 | "description": "Add a button with a custom constructor.." |
380 | 381 | }, |
381 | | - |
382 | 382 | "discord.py UI Select":{ |
383 | 383 | "prefix": "!select", |
384 | 384 | "body": [ |
|
0 commit comments