Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @bot.command()
- @commands.cooldown(1, 10.0, commands.BucketType.guild)
- async def embed(ctx):
- def check(msg):
- return msg.channel == ctx.message.channel and msg.author == ctx.message.author
- await ctx.send('''Напишите заголовок для embed'а.''')
- msg = await bot.wait_for('message', check=check)
- title = msg.content
- if len(title) > 256:
- await ctx.send('Вы привысили лимит в 256 символов.')
- else:
- await ctx.send("Напишите текст для embed'а.")
- msg = await bot.wait_for('message', check=check)
- desc = msg.content
- if len(desc) > 2048:
- await ctx.send('Вы привысили лимит в 2048 символов.')
- else:
- await ctx.send("Картинка для embed'а.\n(Напишите любой символ чтобы пропустить)")
- msg = await bot.wait_for('message', check=check)
- message_att = str(msg.attachments)
- if not message_att:
- pass
- if len(message_att) > 3:
- message_att = message_att.replace(">","")
- message_att = message_att.replace("]","")
- message_att = message_att.replace("url=","")
- message_att = message_att.replace("'","")
- message_att = message_att.split()
- message_att = message_att[3]
- if len(message_att) > 3:
- embed = discord.Embed(title=title,description=desc,color=config.embed_basic)
- embed.set_author(name=ctx.message.author.name,icon_url=ctx.message.author.avatar_url)
- embed.set_image(url=message_att)
- await ctx.send('''Предосмотр вашего embed'а:''', embed=embed)
- await ctx.send('Куда отправить? (#канал)')
- msg = await bot.wait_for('message', check=check)
- ch = msg.content
- channel = discord.utils.get(bot.get_all_channels(), mention=ch)
- if channel == None:
- await ctx.send('''Вы отменили отправку embed'a.''')
- else:
- await channel.send(embed=embed)
- await ctx.send('Embed успешно отправлен в '+channel.mention+'.')
- if len(message_att) < 3:
- embed = discord.Embed(title=title,description=desc,color=config.embed_basic)
- embed.set_author(name=ctx.message.author.name,icon_url=ctx.message.author.avatar_url)
- await ctx.send('''Предосмотр вашего embed'а:''', embed=embed)
- await ctx.send('Куда отправить? (#канал)')
- msg = await bot.wait_for('message', check=check)
- ch = msg.content
- channel = discord.utils.get(bot.get_all_channels(), mention=ch)
- if channel == None:
- await ctx.send('''Вы отменили отправку embed'a.''')
- else:
- await channel.send(embed=embed)
- await ctx.send('Embed успешно отправлен в '+channel.mention+'.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement