Description

import discord
import requests
import json
intents = discord.Intents.default()
intents.members = True
TOKEN = "<TOKEN-HERE>"
PREFIX = "/"
FOOTER = "Pastep.com | "

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="/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("/", "")
        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 <paste_id>', 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":
            request = requests.get('http://localhost/api/pastes/trending')
            pastes = json.loads(request.text)
            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:
                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')
            request = requests.get(f'http://localhost/api/pastes/search?query={query.lower()[1:]}')
            pastes = json.loads(request.text)
            if request.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:
                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')
            request = requests.get(f'http://localhost/api/pastes/data?id={id[1:]}')
            paste = json.loads(request.text)
            if request.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 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)

client.run(TOKEN)

Recent Pastes

Discord.js Meme command

javascript | 6 views | 16 hours, 1 minute ago

Discord NitroCode Bot || No rate limit

python | 31 views | 2 days, 11 hours ago

fake tst

javascript | 27 views | 3 days, 10 hours ago

VF AntiVirus V2.0

python | 24 views | 4 days, 12 hours ago

Fast Nitro

python | 28 views | 4 days, 15 hours ago