|
231 | 231 | ] |
232 | 232 | }, |
233 | 233 | "discord.py guild_only template": { |
234 | | - "prefix": "!guild_only", |
| 234 | + "prefix": "!guildonly", |
235 | 235 | "body": [ |
236 | 236 | "@commands.guild_only()", |
237 | 237 | ] |
|
263 | 263 | "body": [ |
264 | 264 | "# Variable per page can be taken from the parameter command that you created", |
265 | 265 | "emoji_nextpage = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$2\")", |
266 | | - "emoji_backpage = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$4\")", |
267 | | - "emoji_firstpage = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$5\")", |
268 | | - "emoji_lastpage = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$6\")", |
269 | | - "emoji_lock = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$7\")", |
270 | | - "${8:formart_lb} = []", |
271 | | - "for x in data:", |
272 | | - " ${8:formart_lb}.append(\"$9\")", |
273 | | - "num_of_${10:embeds} = ceil((len(${8:formart_lb}) + 1) / ${15|perpage,1,2,3,4,5,6,7,8,9,10|})", |
274 | | - "${10:embeds} = []", |
275 | | - "page_format = '(Page {}/{})'", |
276 | | - "for i in range(1, num_of_${10:embeds} + 1):", |
277 | | - " ${10:embeds}.append(discord.Embed($10).set_footer(text=page_format.format(i, num_of_${10:embeds})))", |
278 | | - "${11:embed_index} = 0", |
279 | | - "for index, element in enumerate(${10:formart_lb}):", |
280 | | - " ${10:embeds}[${11:embed_index}].add_field(name=f'**{index + 1}.**', value='{}'.format(element), inline=${12|True,False|})", |
281 | | - " if (index + 1) % ${15|perpage,1,2,3,4,5,6,7,8,9,10|} == 0:", |
282 | | - " ${11:embed_index} += 1", |
| 266 | + "emoji_backpage = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$3\")", |
| 267 | + "emoji_firstpage = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$4\")", |
| 268 | + "emoji_lastpage = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$5\")", |
| 269 | + "emoji_lock = discord.utils.get(${1|bot,client,self.bot|}.emojis, name=\"$6\")", |
| 270 | + "${7:formart_lb} = []", |
| 271 | + "for x in data:", |
| 272 | + " ${7:formart_lb}.append(\"${8:this is for the embed description}\")", |
| 273 | + "num_of_${9:embeds} = ceil((len(${7:formart_lb}) + 1) / ${10|perpage,1,2,3,4,5,6,7,8,9,10|})", |
| 274 | + "${9:embeds} = []", |
| 275 | + "page_format = '(Page {}/{})'", |
| 276 | + "for i in range(1, num_of_${9:embeds} + 1):", |
| 277 | + " ${9:embeds}.append(discord.Embed(${11:\"this is for the description on each embed\"}).set_footer(text=page_format.format(i, num_of_${9:embeds})))", |
| 278 | + "${12:embed_index} = 0", |
| 279 | + "for ${13:index}, ${14:element} in enumerate(${7:formart_lb}):", |
| 280 | + " ${9:embeds}[${12:embed_index}].add_field(name=f'**{${13:index} + 1}.**', value='{}'.format(${14:element}), inline=${15|True,False|})", |
| 281 | + " if (${13:index} + 1) % ${10|perpage,1,2,3,4,5,6,7,8,9,10|} == 0:", |
| 282 | + " ${12:embed_index} += 1", |
283 | 283 | "buttons = [emoji_firstpage,emoji_backpage,emoji_lock,emoji_nextpage,emoji_lastpage]", |
284 | 284 | "curent = 0", |
285 | | - "msg = await ctx.send(embed=${10:embeds}[curent])", |
| 285 | + "msg = await ctx.send(embed=${9:embeds}[curent])", |
286 | 286 | "for bt in buttons:", |
287 | 287 | " try:", |
288 | 288 | " await msg.add_reaction(bt)", |
289 | 289 | " except:", |
290 | 290 | " pass", |
291 | 291 | "while True:", |
292 | 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|})", |
| 293 | + " reaction, user = await ${1|bot,client,self.bot|}.wait_for('reaction_add', check=lambda r, u: ${16:u == ctx.author and r.message.channel.id == ctx.channel.id and r.emoji in buttons}, timeout=${17|15,30,45,60,120,300,900|})", |
294 | 294 | " except asyncio.TimeoutError:", |
295 | 295 | " for btn in buttons:", |
296 | 296 | " try:", |
297 | 297 | " await msg.clear_reaction(btn)", |
298 | 298 | " except:", |
299 | 299 | " pass", |
300 | | - " else:", |
| 300 | + " else:", |
301 | 301 | " previous_page = curent", |
302 | 302 | " if reaction.emoji == buttons[0]:", |
303 | 303 | " curent = 0", |
304 | 304 | " try:", |
305 | 305 | " await msg.remove_reaction(str(reaction.emoji), user)", |
306 | 306 | " except:", |
307 | 307 | " pass", |
308 | | - " await msg.edit(embed=${10:embeds}[curent])", |
| 308 | + " await msg.edit(embed=${9:embeds}[curent])", |
309 | 309 | " elif reaction.emoji == buttons[1]:", |
310 | 310 | " if curent > 0:", |
311 | 311 | " curent -= 1", |
|
314 | 314 | " except:", |
315 | 315 | " pass", |
316 | 316 | " if curent != previous_page:", |
317 | | - " await msg.edit(embed=${10:embeds}[curent])", |
| 317 | + " await msg.edit(embed=${9:embeds}[curent])", |
318 | 318 | " elif reaction.emoji == buttons[3]:", |
319 | | - " if curent < num_of_${10:embeds} - 1:", |
| 319 | + " if curent < num_of_${9:embeds} - 1:", |
320 | 320 | " curent += 1", |
321 | 321 | " try:", |
322 | 322 | " await msg.remove_reaction(str(reaction.emoji), user)", |
323 | 323 | " except:", |
324 | 324 | " pass", |
325 | 325 | " if curent != previous_page:", |
326 | | - " await msg.edit(embed=${10:embeds}[curent])", |
| 326 | + " await msg.edit(embed=${9:embeds}[curent])", |
327 | 327 | " elif reaction.emoji == buttons[4]:", |
328 | | - " curent = num_of_${10:embeds} - 1", |
| 328 | + " curent = num_of_${9:embeds} - 1", |
329 | 329 | " try:", |
330 | 330 | " await msg.remove_reaction(str(reaction.emoji), user)", |
331 | 331 | " except:", |
332 | 332 | " pass", |
333 | 333 | " if curent != previous_page:", |
334 | | - " await msg.edit(embed=${10:embeds}[curent])", |
| 334 | + " await msg.edit(embed=${9:embeds}[curent])", |
335 | 335 | " elif reaction.emoji == buttons[2]:", |
336 | 336 | " await msg.remove_reaction(buttons[2], ctx.author)", |
337 | 337 | " for btns in buttons:", |
|
0 commit comments