import pastep import discord intents = discord.Intents.default() intents.members = True TOKEN = "" PREFIX = "_" FOOTER = "Pastep.com | " ADMINS = ['', ''] client = discord.Client(intents=intents) @client.event async def on_ready(): print(f'{client.user} has connected to Discord!') await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=f"{PREFIX}help | Pastep.com")) @client.event async def on_member_join(member): await member.send( f"""Hi {member.name}, welcome to Pastep.Com Official Discord Server!\nUse /help to get some help, Also visit our website for more informations :)\nسلام {member.name}, به سرور رسمی وبسایت Pastep.com خوش آمدید\nاز دستور /help استفاده کنید تا لیست دتسورات را ببینید و همینطور برای اطلاعات بیشتر به وبسایت ما هم سر بزنید\nWEBSITE ADDRESS: https://pastep.com""" ) @client.event async def on_message(message): if PREFIX in message.content: message.content = message.content.replace(PREFIX, "") content_copy = message.content message.content = message.content.lower() if message.author.id == 806198065337729094: pass elif message.content == "help": embed = discord.Embed(title=f"{PREFIX}{message.content}", description='Shows availaible commands', color = 0xff0000) embed.set_author(name="Pastep Bot!", icon_url = "https://cdn.discordapp.com/attachments/777197110319644703/806203046606012466/images.jpg") embed.set_thumbnail(url='https://cdn.discordapp.com/attachments/777197110319644703/806202270609047602/logo_2_-_Copy.png') embed.add_field(name=f"{PREFIX}search", value=f'Search in pastes, \nEx. {PREFIX}search api - code', inline = False) embed.add_field(name=f"{PREFIX}trendings", value=f'Shows trending pastes, \nEx. {PREFIX}trendings', inline=False) embed.add_field(name=f"{PREFIX}info", value=f'Shows information of a paste, \nEx. {PREFIX}info ', inline=False) embed.add_field(name=f"{PREFIX}user", value=f'Shows information of a user, \nEx. {PREFIX}user ', inline=False) embed.add_field(name=f"{PREFIX}team", value=f'Shows information of PASTEP team, \nEx. {PREFIX}team', inline=False) embed.set_footer(text=f"{FOOTER}Requested By {message.author}", icon_url=message.author.avatar_url) await message.channel.send(embed=embed) elif message.content == "trendings": pastes = pastep.pastep().trending() embed = discord.Embed(title=f"{PREFIX}{message.content}", description='Shows trending pastes', color = 0xff0000) embed.set_author(name="Pastep Bot!", icon_url = "https://cdn.discordapp.com/attachments/777197110319644703/806203046606012466/images.jpg") embed.set_thumbnail( url='https://cdn.discordapp.com/attachments/777197110319644703/806202270609047602/logo_2_-_Copy.png') embed.set_footer(text=f"{FOOTER}Requested By {message.author}", icon_url=message.author.avatar_url) for key in pastes: if key == 'status_code': break paste = pastes[key] embed.add_field(name=f"{int(key)+1}. Title: {paste['title']}", value=f"Views: {paste['views']}\nLanguage: {paste['syntax']}\nLink: [Click Me!]({paste['url']})") await message.channel.send(embed=embed) elif "search" in message.content: query = message.content.replace('search', '') if query == "" or message.content == 'search': return await message.channel.send('Please include a query to search') pastes = pastep.pastep().search(query.lower()[1:], 10) if pastes['status_code'] == 404: return await message.channel.send(f"No result found.") embed = discord.Embed(title=f"{PREFIX}{message.content}", description='Search for a query in pastes', color=0xff0000) embed.set_author(name="Pastep Bot!", icon_url="https://cdn.discordapp.com/attachments/777197110319644703/806203046606012466/images.jpg") embed.set_thumbnail( url='https://cdn.discordapp.com/attachments/777197110319644703/806202270609047602/logo_2_-_Copy.png') embed.set_footer(text=f"{FOOTER}Requested By {message.author}", icon_url=message.author.avatar_url) for key in pastes: if key == 'status_code': break paste = pastes[key] embed.add_field(name=f"{int(key) + 1}. Title: {paste['title']}", value=f"Views: {paste['views']}\nLanguage: {paste['syntax']}\nLink: [Click Me!]({paste['url']})") await message.channel.send(embed=embed) elif 'info' in message.content: id = content_copy.replace('info', '') if id == "" or message.content == 'info': return await message.channel.send('Please include a id to gather data') paste = pastep.pastep().info(id[1:]) if paste['status_code'] == 404: return await message.channel.send(f"Id invalid.") embed = discord.Embed(title=f"{PREFIX}{message.content}", description='Gather data from a paste', color=0xff0000) embed.set_author(name="Pastep Bot!", icon_url="https://cdn.discordapp.com/attachments/777197110319644703/806203046606012466/images.jpg") embed.set_thumbnail( url='https://cdn.discordapp.com/attachments/777197110319644703/806202270609047602/logo_2_-_Copy.png') embed.set_footer(text=f"{FOOTER}Requested By {message.author}", icon_url=message.author.avatar_url) paste = paste['paste'] embed.add_field(name=f"Title {paste['title']}", value=f"ID: {paste['id']}\nAuthor: {paste['user']}\nLanguage: {paste['syntax']}\nViews: {paste['views']}\nExpired? {paste['expire']}\nPublished date: {paste['created_at']}\n Link: [Click me!]({paste['url']})") await message.channel.send(embed=embed) elif 'user' in message.content: id = content_copy.replace('user', '') if id == "" or message.content == 'user': return await message.channel.send('Please include a id to gather data') user = pastep.pastep().user_data(id[1:]) if user['status_code'] == 404: return await message.channel.send(f"Id invalid.") embed = discord.Embed(title=f"{PREFIX}{message.content}", description='Gather data from a user', color=0xff0000) embed.set_author(name="Pastep Bot!", icon_url="https://cdn.discordapp.com/attachments/777197110319644703/806203046606012466/images.jpg") embed.set_thumbnail( url=user['avatar']) embed.set_footer(text=f"{FOOTER}Requested By {message.author}", icon_url=message.author.avatar_url) embed.add_field(name=f"Username:", value=f"{user['username']}") embed.add_field(name="Biography:", value=f'```{user["bio"]}```', inline=False) embed.add_field(name='Link:', value=f'[Click me!](https://pastep.com/accounts/view/{user["username"]})') await message.channel.send(embed=embed) elif message.content == 'team': embed = discord.Embed(title=f"{PREFIX}{message.content}", description='Pastep.com team information', color=0xff0000) embed.set_author(name="Pastep Bot!", icon_url="https://cdn.discordapp.com/attachments/777197110319644703/806203046606012466/images.jpg") embed.set_thumbnail( url='https://cdn.discordapp.com/attachments/777197110319644703/806202270609047602/logo_2_-_Copy.png') embed.set_footer(text=f"{FOOTER}Requested By {message.author}", icon_url=message.author.avatar_url) embed.add_field(name='Pooria Ahmadi', value='Role: Owner & Developer\nDiscord: Pooria#2177') embed.add_field(name="NightFall", value='Role: Discord manager & Idea-manufacturing\nDiscord: ƝƖƓӇƬƑƛԼԼ#8821') await message.channel.send(embed=embed) elif message.content == 'join-voice': author = message.author for admin in ADMINS: if f"{author.id}" == admin: channel = author.voice if channel: return await channel.channel.connect() else: return await message.channel.send("You aren't in a voice channel") return await message.channel.send("You don't have permissions to do that") client.run(TOKEN)