#discord-bots

1 messages · Page 24 of 1

cold tide
#

What does * mean??

#

I just want it to delete the bots message.

#

@silk fulcrum

silk fulcrum
#

that delay is optional

#

delay is like delete_after in send

cold tide
#

So how do make it delete the bots message just await ctx.delete()

#

im not quite sure.

silk fulcrum
#

nope

cold tide
#

embed=variable

silk fulcrum
#

do you want it to delete the message after some time?

cold tide
#

Yes

oblique root
#

when i made that change, it started to have an error on my "client.run(TOKEN)

cold tide
#

6 seconds

silk fulcrum
#

then it'd be better to use delete_after

silk fulcrum
#

so await ctx.send(..., delete_after-6)

slate swan
oblique root
cold tide
#
client.run(token)
#

@oblique root

silk fulcrum
robust snow
silk fulcrum
#

lmao

slate swan
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

for long code

silk fulcrum
#

@slate swan I had a choice to go sleep or to help here until 3 AM, and I chose help

silk fulcrum
#

now I regret it..

#

there is literally noone to help

slate swan
#

I know

cold tide
#
@bot.command()
async def drop(ctx):
    dropp=discord.Embed(title="Dropping info:",description=f"{ctx.message.content}",color=0xffff00)
    dropp.set_footer(text="This Message will self destruct in 6 seconds !")
    await ctx.send(embed=dropp)
    time.sleep(6)
    await ctx.delete(embed=dropp)
#

😭😭😭

slate swan
#

!d discord.Message.delete

unkempt canyonBOT
#

await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
silk fulcrum
slate swan
#

Master32 is right

silk fulcrum
#

im always r...ong

slate swan
#

what

#

nothing in this channel ever makes any sense

silk fulcrum
slate swan
cold tide
#

@silk fulcrum how do i make a argument so like !drop test then it shows test

silk fulcrum
#

and it's still 11:30 PM tho

real grail
#

How to show class of error in on_command_error?

slate swan
#

Withdraw?

cold tide
#

??

slate swan
slate swan
#

!d discord.Message.content

unkempt canyonBOT
slate swan
silk fulcrum
#

idk what is this but there is example of argument @cold tide

slate swan
#

@silk fulcrum is ctx typehinted with message.Content?

slate swan
crystal glen
#
@client.command()
async def warn(ctx, member: discord.Member, *, reason):
    await ctx.message.delete()
    embed = discord.Embed(title=f"{member.name} has been warned!", color=0xc40c0c)
    embed.set_thumbnail(url=member.avatar_url)
    embed.add_field(name="ID", value=member.id)
    embed.add_field(name="Warned at", value=ctx.message.created_at.strftime("%d-%b-%Y-%H:%M"))
    embed.add_field(name="Warned by", value=ctx.author.name)
    embed.add_field(name="Warned in", value=ctx.channel.name)
    embed.add_field(name="Reason", value=reason)
    await ctx.send(embed=embed)
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "r") as f:
        warnings = json.load(f)
    warnings[str(member.id)] = {"username": member.name, "reason": reason, "warned by": ctx.author.id, "warned at": ctx.message.created_at.strftine("%d-%b-%Y-%H-%M"), "warned in": ctx.channel.name}
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "w") as f:
        json.dump(warnings, f, indent=4)

I get this error:
Ignoring exception in on_command_error Traceback (most recent call last): File "C:\Users\ArasoOsara\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) File "D:\Desktop\Haryad Bot\haryad.py", line 62, in on_command_error await ctx.message.delete() File "C:\Users\ArasoOsara\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\message.py", line 1023, in delete await self._state.http.delete_message(self.channel.id, self.id) File "C:\Users\ArasoOsara\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\http.py", line 250, in request raise NotFound(r, data) discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message

silk fulcrum
#

with commands.Context?

slate swan
#

oh yeah

silk fulcrum
slate swan
#

No

slate swan
silk fulcrum
slate swan
#
@bot.command()
async def drop(ctx: commands.Context, *, argument1: str) -> None:
    await ctx.send(argument1)
    
# will send whatever you type after !drop

idk if this is typehinted correctly someone tell me

crystal glen
slate swan
silk fulcrum
#

*,

slate swan
#

I never typehint args only returns

crystal glen
#

Now it works

silk fulcrum
slate swan
slate swan
#

god nothing in this channel ever makes any sense

slate swan
#

at least that stuff is cool

silk fulcrum
crystal glen
#

should it be a instead of w

slate swan
#

because you are literally replacing it

slate swan
silk fulcrum
crystal glen
slate swan
silk fulcrum
slate swan
crystal glen
slate swan
#

uh append to an array or something, don't replace the previous warning in the mapping with the new warning

silk fulcrum
#

no

crystal glen
#

bruv

slate swan
#

that's the easiest solution

crystal glen
#

what's the hardest then?

slate swan
#

idk and idc

crystal glen
#

wow

slate swan
#

bro it's basic json

crystal glen
#

ok whatever

silk fulcrum
#

use some stupid database and create a column for each warning is probably the hardest solution

slate swan
#

besides you shouldn't use json files as a database

#

it's only slightly harder

#

and better for the long run, you get exposure to databases and how to perform queries

silk fulcrum
slate swan
#

what does that even mean

silk fulcrum
#

0101010 10 110 10110010101 01 01 01 10101010 101 0

slate swan
#

nobody does that

silk fulcrum
#

that's why its the hardest solution

slate swan
#

idk what they meant by hardest solution, it's a meaningless question meant to test the validity of appending things to arrays.

#

which is why i don't care about trying to answer that question

silk fulcrum
#

leamo

crystal glen
#
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "r") as f:
        warnings = json.load(f)
    warnings.append({"user": member.id, "warned by": ctx.author.name, "warned in": ctx.channel.name, "reason": reason, "warned at": ctx.message.created_at.strftime("%d-%b-%Y-%H:%M")})
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "w") as f:
        json.dump(warnings, f, indent=4)

So this doesn't work

slate swan
#

...

silk fulcrum
#

of course

crystal glen
#

Command raised an exception: AttributeError: 'dict' object has no attribute 'append'

#

WHY MAKE IT HARDER THEN, ISNTEAD OF ADDING A FUCKING ATTRIBUTE

slate swan
#

yo stop using json files please

crystal glen
#

no.

crystal glen
#

ok.

silk fulcrum
crystal glen
slate swan
crystal glen
#

I planning on using mongo_db

crystal glen
silk fulcrum
#

||mongo_db === json||

slate swan
crystal glen
slate swan
#

god this channel makes me want to spontaneously combust

crystal glen
#
    # add the warning to the json file and dont delete the older warnings
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "r") as f:
        warnings = json.load(f)
    warnings.append({"user": member.id, "warned by": ctx.author.name, "warned in": ctx.channel.name, "reason": reason, "warned at": ctx.message.created_at.strftime("%d-%b-%Y-%H:%M")})
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "w") as f:
        json.dump(warnings, f, indent=4)
    # Q: Why did you added a attribute to the dict?
    # A: Because I wanted to add a attribute to the dict to make it easier to read and edit.

Co-Pilot is being dumb rn...

silk fulcrum
#

bruh i already wanna sleep, how am i gonna last 3 more hours

robust snow
slate swan
crystal glen
#

bruh....

slate swan
silk fulcrum
#

and you use it as list using append

crystal glen
#

what do I do now

gusty shard
#
  File "main.py", line 558, in <module>
    '8':{'fiyat':databtc['bitcoin']['try'], 'name':'bitcoin'},
KeyError: 'bitcoin'```
#
databtc = requests.get(f"https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=try").json()
dataeth = requests.get(f"https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=try").json()
datadoge = requests.get(f"https://api.coingecko.com/api/v3/simple/price?ids=dogecoin&vs_currencies=try").json()
datatrx = requests.get(f"https://api.coingecko.com/api/v3/simple/price?ids=tron&vs_currencies=try").json()

idler = {
    'boosts': {
    '1':{'fiyat':50000},
    '2':{'fiyat':500000},
    '3':{'fiyat':500000},
    '4':{'fiyat':1000000},
    '5':{'fiyat':1500000},
    '6':{'fiyat':3000000},
    '7':{'fiyat':10000000},
    },
    'coins': {
    '8':{'fiyat':databtc['bitcoin']['try'], 'name':'bitcoin'},
    '9':{'fiyat':dataeth['ethereum']['try'], 'name':'ethereum'},
    '10':{'fiyat':datadoge['dogecoin']['try'], 'name':'doge'},
    '11':{'fiyat':datatrx['tron']['try'], 'name':'tron'},
    },
    'colors':{
    '12':{'fiyat':15000, 'name':'Açık Pembe'},
    '13':{'fiyat':1500, 'name':'Koyu Pembe'},
    '14':{'fiyat':20000, 'name':'Açık Mavi'},
    '15':{'fiyat':10000, 'name':'Kapri Mavisi'},
    '16':{'fiyat':10000, 'name':'Koyu Mavi'},
    '17':{'fiyat':20000, 'name':'Parlak Yeşil'},
    '18':{'fiyat':10000, 'name':'Zümrüt Yeşili'},
    '19':{'fiyat':12500, 'name':'Koyu Yeşil'},
    '20':{'fiyat':15000, 'name':'Çinko Sarısı'},
    '21':{'fiyat':10000, 'name':'Köri Sarısı'},
    '22':{'fiyat':20000, 'name':'Parlak Kırmızı'},
    '23':{'fiyat':15000, 'name':'Koyu Kırmızı'}
    } 
}```
silk fulcrum
#

bruh and how to not spoonfeed in such situatuions?

gusty shard
#

why am i getting that error can somebody help me?

crystal glen
gusty shard
#

wdym

robust snow
#

print your databtc

silk fulcrum
gusty shard
#

it exists

silk fulcrum
#

replit :blobpain:

robust snow
#

you're not using asynchronous functions when you're making network requests

slate swan
crystal glen
#
@client.command()
async def warn(ctx, member: discord.Member, *, reason):
    # append to an array or something, don't replace the previous warning in the mapping with the new warning
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "r") as f:
        warnings = json.load(f)
    warnings[member.id] = warnings.get(member.id, [])
    warnings[member.id].append(reason)
    # save the new mapping to the json file
    with open("warnings.json", "w") as f:
        json.dump(warnings, f, indent=4)
    await ctx.send(f"{member.mention} has been warned for: {reason}")
    await member.send(f"You have been warned for: {reason}")

Give me a hint

slate swan
robust snow
# gusty shard

it doesn't exist at the point of your other code execution

gusty shard
#

its cheap and fast wearyok

slate swan
#
{
   "bitcoin":{
      "try":414747
   }
}

that's how your things formatted what are you tryna access

gusty shard
crystal glen
#

prbably the blokchain

gusty shard
#

it prints it perfectly

#

so whats wrong?

slate swan
#

What part do you want to access?

gusty shard
#

try

slate swan
#

the 414789?

slate swan
gusty shard
#

yep

slate swan
slate swan
# crystal glen <@456226577798135808>

i'm tired, and unfortunately i'm not a very good python interpreter when i'm tired. you what doesn't get tired and is a good and reliable python interpreter? your computer! does it run how you expect it to or are you still getting errors?

crystal glen
slate swan
gusty shard
#

yea..

slate swan
crystal glen
#

What should I do?

slate swan
#

i don't know, reset the json file

#

i doubt its very important

crystal glen
#

I already did....

#

Why is this so complicated

slate swan
#

it's not

#

it's not possible for there to be two keys

#

at least not with your current code

gusty shard
slate swan
robust snow
#

@gusty shard can you add print('yes') the line after your print(databtc)

gusty shard
#

damn yatis

crystal glen
#
# warn a user and send a message to the channel and add it to warnings.json
@client.command()
async def warn(ctx, member: discord.Member, *, reason):
    # append to an array or something, don't replace the previous warning in the mapping with the new warning
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "r") as f:
        warnings = json.load(f)
    warnings[member.id] = warnings.get(member.id, [])
    warnings[member.id].append(reason)
    # save the new mapping to the json file
    with open("D:/Desktop/Haryad Bot/data/warnings.json", "w") as f:
        json.dump(warnings, f, indent=4)
    await ctx.send(f"{member.mention} has been warned for: {reason}")
    await member.send(f"You have been warned for: {reason}")

This is the code, And when I warn my self 2 times, There will be 2 keys

gusty shard
#

why would that affect the program?

slate swan
crystal glen
gusty shard
silk fulcrum
#

that debugging does literally nothing

crystal glen
silk fulcrum
#

it's so obvious that it will print yes if it printed databtc before

gusty shard
slate swan
robust snow
gusty shard
#

can you guys help me?

#

instead of arguing for nothing

slate swan
#

I think it's something to do with the dict

robust snow
#

hbc
try breaking the dict down
bitcoin = databtc['bitcoin']

#

then
bitcoin['try']

#

in your idler dict

gusty shard
#

oke

robust snow
#

print each afterwards to debug

#

failing that, send me ur code and i'll fix it locally 🙂

gusty shard
#

i tried same thing on main file

slate swan
gusty shard
#

its not working

slate swan
#

no clue why the service is returning incorrect data for you

gusty shard
#

i guess something is wrong with the file

slate swan
#

have you checked their docs?

gusty shard
#

it was working like a charm

#

30 min ago

#

im trying to add a shop command now

#

i didnt change anything on that

#

and its not working anymore

robust snow
#

returns okay for me too

silk fulcrum
robust snow
#

the code is correct...

gusty shard
#

theres nothing to fix

silk fulcrum
#

but there is a error...

gusty shard
#

i didnt even saw something like that

robust snow
#

@gusty shard is that your full code?

#

what you pasted earlier?

#

because it runs fine for me

silk fulcrum
#

no, there are 500+ lines as we can see from traceback

gusty shard
#

but none of them bothers the coins

#

they are about working, gambling, stealing money from people and selling drugs

#

import pdb; pdb.set_trace()

#

i used that to found the error

silk fulcrum
#

; 💀

limber bison
#
import discord
from discord.ext import commands
import asyncio
from mongoDB import *



class DurationConverter(commands.Converter):
    async def converter(self ,  ctx , argument):
        amount = argument[:-1]
        unit = argument[-1]

        if amount.isdigit() and unit in ['s' , 'm' , 'h']:
            return (int(amount),unit)

        raise commands.BadArgument(message='Not a vaild duration')    


class PVC(commands.Cog):
    def __init__(self , client):
        self.client = client


    @commands.command()
    async def pvc(self , ctx , duration : DurationConverter):
        multiplier = {'s': 1 , 'm' : 60 , 'h' : 3600}
        amount , unit = duration
        
        guild = ctx.guild
        user = ctx.author
        id = discord.Object(ctx.author.id) 
        overwrites = {
        guild.default_role: discord.PermissionOverwrite(connect=False) ,
        discord.Object(ctx.author.id): discord.PermissionOverwrite(connect=True)
        }
        


        PVC = await guild.create_voice_channel(f"{ctx.author.name}'s vc" , category = discord.Object(995100986488147990) , overwrites=overwrites)

        await pvcdata.insert_one({"id" : ctx.author.id , "time" : duration })
        await ctx.reply(f"{ctx.author} your vc created named {ctx.author.name}'s vc for {amount}{unit} , enjoy!")
        

        await asyncio.sleep(amount*multiplier)


        await PVC.delete()
        await pvcdata.delete_one({"id" : ctx.author.id })
        await ctx.send(f'{ctx.author.mention} time ended vc deleted') 

    @pvc.error
    async def pvc_error(self,ctx , error):
         await ctx.send('use correctly' , delete_after = 2)
         return   
    

def setup(client):
    client.add_cog(PVC(client))```

converter error
#

??????????????????????????////

gusty shard
#

and replit said that

#

that was so funny

limber bison
gusty shard
slate swan
silk fulcrum
crystal glen
slate swan
#

oh

#

the key just needs to be a string

crystal glen
#

I already gave up

slate swan
#

who does that

#

get back on that thing and fix it

silk fulcrum
#

!d discord.Client.start

unkempt canyonBOT
#

await start(token, *, reconnect=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

A shorthand coroutine for [`login()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.login "discord.Client.login") + [`connect()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.connect "discord.Client.connect").
silk fulcrum
#

ooo thee is this method

slate swan
#

bot.start() will not return until the bot is closed

silk fulcrum
#

you are doing discord.Client, and it has not intents arg im start method

slate swan
#

which means you will have to schedule that as an asyncio task

slate swan
# unkempt canyon

as you can see from this, it calls bot.connect(), which literally contains a while loop to receive gateway events and dispatch events

crystal glen
#
@client.command()
@commands.has_permissions(administrator=True)
async def warn(ctx, member: discord.Member, *, reason):
    if discord.utils.get(member.roles, name="Warned"):
        embed = discord.Embed(title=f"{member.name} has already been warned!", color=0xc40c0c)
        embed.set_thumbnail(url=member.avatar_url)
        embed.add_field(name="What to do", value="This user has already been warned. You should give them another type of punishment such as `muting them :)`.")
        await ctx.send(embed=embed)
        return
    embed = discord.Embed(title=f"{member.name} has been warned!", color=0xc40c0c)
    embed.set_thumbnail(url=member.avatar_url)
    embed.add_field(name="Warned by", value=ctx.author.mention, inline=False)
    embed.add_field(name="Warned At", value=ctx.message.created_at.strftime("%d-%b-%Y-(%H:%M)"), inline=False)
    embed.add_field(name="Reason", value=reason, inline=False)
    await ctx.send(embed=embed)
    role = discord.utils.get(ctx.guild.roles, name="Warned")
    await member.add_roles(role)

@client.command()
@commands.has_permissions(administrator=True)
async def mute(ctx, member: discord.Member, *, reason):
    if discord.utils.get(member.roles, name="Muted"):
        embed = discord.Embed(title=f"{member.name} has already been muted!", color=0xc40c0c)
        embed.set_thumbnail(url=member.avatar_url)
        embed.add_field(name="What to do", value="This user has already been muted. You should give them another type of punishment such as `banning them :)`.")
        await ctx.send(embed=embed)
        return
    embed = discord.Embed(title=f"{member.name} has been muted!", color=0xc40c0c)
    embed.set_thumbnail(url=member.avatar_url)
    embed.add_field(name="Muted by", value=ctx.author.mention, inline=False)
    embed.add_field(name="Muted At", value=ctx.message.created_at.strftime("%d-%b-%Y-(%H:%M)"), inline=False)
    embed.add_field(name="Reason", value=reason, inline=False)
    await ctx.send(embed=embed)
    role = discord.utils.get(ctx.guild.roles, name="Muted")
    await member.add_roles(role)

I did this instead

languid moth
#

Now that, is alot of words.

limber bison
limber bison
#

how can i add confrmation in command ,
user type !createvc
i want bot sends a message type yes to continue else no
than command exicute !!!

slate swan
fallow girder
#
await item.callback(interaction)
  File "c:\Users\momoa\OneDrive\Documents\Time Is Money bot discord\main.py", line 469, in create_ticket
    interaction.guild.default_role: nextcord.PermissionOverwrite(read_message= False),
  File "C:\Users\momoa\AppData\Roaming\Python\Python310\site-packages\nextcord\permissions.py", line 717, in __init__    raise ValueError(f"No permission called {key}.")
ValueError: No permission called read_message.

The permission read_message is not work anyone can help me ?

overwrites = {
            interaction.guild.default_role: nextcord.PermissionOverwrite(read_messages= False),
            interaction.guild.me: nextcord.PermissionOverwrite(read_message=True),
            interaction.guild.get_role(1005605346435412088): nextcord.PermissionOverwrite(read_message=True)
        }
slate swan
slate swan
fallow girder
slate swan
#

👍

unkempt canyonBOT
#

wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
fallow girder
#

but finally I changed read_messages By view_channel by looking in the doc

slate swan
#

Check the docs, there's an example that shows how you can wait for a message event

slate swan
fallow girder
slate swan
#

all guild

slate swan
slate swan
fallow girder
slate swan
#

To set the permissions for the user that created the ticket you need to do this:

overwrites = {
    ...,
    ctx.author: PermissionOverwrite(...)
}
#

The key needs to be the Member object

fallow girder
#

channel= await interaction.guild.create_text_channel(f"{interaction.user.name}︲ticket", overwrites= overwrites)

#

Yes

slate swan
#

is there a way to do eval command in Python? Sorry for the question, I'm a beginner.

fallow girder
#

but I think to avoid this problem I have to create a role temporarily while the ticket is open

#

and the role will be removed when the person closes the ticket

slate swan
slate swan
#

The documentation mentions how the key (the target) can either be a Role or a Member, you need to make it a Member object to set permissions for that user only

fallow girder
fallow girder
# slate swan Do this
Ignoring exception in view <CreateTicket timeout=None children=1> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='🎫︲Créé Un Ticket' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\momoa\AppData\Roaming\Python\Python310\site-packages\nextcord\ui\view.py", line 390, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\momoa\OneDrive\Documents\Time Is Money bot discord\main.py", line 470, in create_ticket
    interaction.ctx.author: nextcord.PermissionOverwrite(view_channel=True),
AttributeError: 'Interaction' object has no attribute 'ctx'
slate swan
#

Uh I used ctx.author as an example, you should use interaction.user

fallow girder
#

Ahh my bad

fallow girder
slate swan
#

👍

#
@bot.command()
async def embed(ctx):
 embed = discord.Embed(
	 description = "test"
 )
await ctx.send(embed=embed)

What's wrong?

#

Your indentation is off, await ctx.send(embed=embed) is outside the function.

#

Just add some space

slate swan
lone lichen
slate swan
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
# slate swan Can you show more code?
from discord.ext import commands
import asyncio
import discord
import os

bot = commands.Bot(command_prefix='!')

@bot.event
async def on_ready():
    print('We have logged in as {0.user}'.format(bot))

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return

@bot.command()
async def embed(ctx):
 embed = discord.Embed(
	 description = "test"
 )
 await ctx.send(embed=embed)
bot.run(os.getenv('TOKEN'))```
slate swan
slate swan
#

Ok

slate swan
#

👍

jagged adder
#

how would i go about changing this into a command that deletes only the current channel? im having trouble workin out which parts i need to be changing ...

def clearall_check(ctx: commands.Context):
    return ctx.author.id in [...]

@bot.command(name="clearall")
@commands.check(clearall_check)
async def command_clearall(ctx: commands.Context):
    if ctx.guild.id == ...:
        bot.category_id = ...
    category: discord.CategoryChannel = ctx.guild.get_channel(ctx.bot.category_id)
    for channel in category.channels:
        await channel.delete()
wicked atlas
slate swan
unkempt canyonBOT
#

await delete(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Deletes the channel.

You must have [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
slate swan
#

ctx.channel is an instance of this if the command was invoked in a guild. You can use ctx.channel.delete()

jagged adder
wicked atlas
#

you're free to do that if you want

jagged adder
#

i could just do it like so right?

    if ctx.guild.id == 123:
        bot.category_id = 123
    category: discord.CategoryChannel = ctx.guild.get_channel(ctx.bot.category_id)
    if ctx.channel in category.channels:
        await ctx.channel.delete()
wicked atlas
#

yep

#

except I don't think you need to do ctx.bot

jagged adder
#

i am just very aware i dont want to accidentally delete anything while testing lol

#

alr

wicked atlas
#

You could though

#

wouldn't change much actually, didn't know Context had a bot attribute

jagged adder
robust snow
#

why dont you just print the channel instead of deleting it in the first instance?

#

Although a test disc server is always a good idea 🙂

limber bison
#

How can I lock a command to a channel ???

#

🤔

#

Channel check??????

slate swan
slate swan
limber bison
#

Hmm only in one

misty robin
#

Hi

limber bison
#

Tell me both

#

Hehehehehe

misty robin
#

How can i do a clear command

slate swan
limber bison
slate swan
misty robin
slate swan
misty robin
slate swan
#

so I'm not sure

misty robin
slate swan
#

@limber bison

if ctx.channel.id == YOUR CHANNEL ID:
    # do something
slate swan
misty robin
#

I learn it

slate swan
slate swan
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

how does someone mention in inside the description in Python?

heavy folio
#

!d discord.ext.commands.check

unkempt canyonBOT
#

@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or its subclasses. These checks could be accessed via [`Command.checks`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.checks "discord.ext.commands.Command.checks").

These checks should be predicates that take in a single parameter taking a [`Context`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context"). If the check returns a `False`-like value then during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure") exception is raised and sent to the [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event.

If an exception should be thrown in the predicate then it should be a subclass of [`CommandError`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError"). Any exception not subclassed from it will be propagated while those subclassed will be sent to [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error").
heavy folio
heavy folio
unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=None, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
slate swan
heavy folio
#

!d discord.Member.mention as i said there would be a .mention attribute, access the author using ctx.author

unkempt canyonBOT
slate swan
#

I'd say the first is easier though

#

well they're both easy

heavy folio
#

it isnt that good i guess

heavy folio
#

what

slate swan
slate swan
slate swan
#

Sure

slate swan
# slate swan Sure
@bot.command()
async def embed(ctx):
 user = f"{user.mention}"
 embed = discord.Embed(
	 description = '{} Hello!'.format(user)
 )
 await ctx.send(embed)```

Is this how it is used or is it wrong?
cloud dawn
#

!f-string

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

slate swan
#

!f

unkempt canyonBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

slate swan
#

that doesnt help either, ratelimits are dynamic

#
data = open(json.load("file.json"))

data["ids"].append(id)

# dump the data here```
what this basically does is store all your ids in the json file in an array which is the value of `ids` key, and when you acess this key in your python code like so
```py
with open(...) as f: data = json.load(f)
ids = data["ids"]

ids is now a python list and has all the functions a list object has
basically what I did is, bind all the ids in an array to a corresponding key

#

how do you mention someone in python?

slate swan
#

If so:
ctx.author.mention

misty robin
misty robin
sick birch
misty robin
#

Yeah

sick birch
#

Figured. Lucas?

misty robin
#

no

#

is it good ?

sick birch
#

No, not really

misty robin
#

who is the best one

sick birch
#

A basic unban command should be like 2 or 3 lines max

sick birch
misty robin
#

ok

sick birch
#

Typehint your member argument to a discord.User, pass it into .unban, easy as that

misty robin
#

that it good ?

jagged adder
#

is it possible to "deploy" a discord bot using a command? what id like to do is when someone (or myself for that matter), invites my bot to a server, i can use a command ( after inviting) that checks for certain category IDs, and granted they dont exist yet, create a new named category in that server/guild, then add that category ID to a list within the bot?

#

i presume u could

#

because my bot only allows people to use certain commands and the like (for safety sake, ie channel deletes) within a select list of category ID's

slate swan
#

my bot does not update with the about me what could be the reason?

slate swan
misty robin
slate swan
misty robin
#

ok

short relic
#

how can i get the id of the channel i just created with create_text_channel

silk fulcrum
unkempt canyonBOT
slate swan
silk fulcrum
#

hey okimii 👋

slate swan
#

✌️

#

hi i how does my bot status change automatically with 2 different texts?

silk fulcrum
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
short relic
# silk fulcrum createe_text_channel returns channel object
 async def button_callback(self, button, interaction):
        await interaction.response.send_message("creating text channel")
        guild = await bot.fetch_guild(1004363397250433024)
        await guild.create_text_channel(name = "ticket num 1")

its like i want to get the id of the "ticket num 1" channel how can i do that

#

guild.get_channel(name = "ticket num 1") ?

meager linden
#

Is there a good replacement for dpy yet? Like something that probably adds onto it?

slate swan
meager linden
#

oH?

silk fulcrum
robust fulcrum
#

Guys any command idea for my bot?

meager linden
#

DAMNNNN

silk fulcrum
#

so ch = await guild.create_...

slate swan
meager linden
#

dude thanks! @slate swan I didn't know!

short relic
slate swan
short relic
silk fulcrum
#

you dont know what are variables?

short relic
#

i know lol but sometime it confuses me 😦

slate swan
# short relic how can i do that 😮
text_channel_ = await guild.create_text_channel(name = "ticket num 1")
tex = guild.get_channel(text_channel_.id) or await guild.fetch_channel(text_channel_.id)
short relic
#

thanks man

slate swan
silk fulcrum
#

get_channel needs await?

slate swan
#

wdym👁️👁️

silk fulcrum
#

i saw that 👁️👁️

slate swan
#

you saw nothing😳

silk fulcrum
#

im not blind

slate swan
silk fulcrum
#

im brainblind

slate swan
#

ok

silk fulcrum
#

@slate swan do you know how to make a help command hybrid? i did not find it in HelpCommands paragraph

short relic
#

wait also one more

await interaction.response.send_message("creating text channel")
        guild = await bot.fetch_guild(1004363397250433024)
        ticket_channel = await guild.create_text_channel(name = "ticket num 1")
        textid = await guild.fetch_channel(ticket_channel.id)
        ticketchannel = guild.get_channel(textid)
        await ticketchannel.message.send("hello ")

it doestn send the message hello in the channel "ticket num 1"
does discord hate me 😢

slate swan
#

idk how to use hybrids really, never touched them

silk fulcrum
#

why all those gets and fetchs? why not just ticket_channel.send()?

short relic
#

oh shit you can even do this lol

slate swan
#

omg i keep having this problem where i make code better and forget about its simple solution😭

short relic
#

😠 wdym

silk fulcrum
#

lemao

slate swan
slate swan
short relic
#

master 🙏

silk fulcrum
slate swan
#

its happen like 2 times already 3 including this time

silk fulcrum
#

instead of all this shit, just do await ticket_channel.send('hello') @short relic

short relic
#

thanks @silk fulcrum @slate swan lemon_eyes

red lake
#

im trying to get the mobile icon status for my discord bot.

silk fulcrum
red lake
silk fulcrum
#

you can

slate swan
#

you can by mutating a header which is againsts tos <3

red lake
#

through WebSocket i can send you the doc

silk fulcrum
#

waht

red lake
slate swan
#

its a simple header iirc, but its againt tos iirc

red lake
#

Even verified bots use it.

slate swan
#

iirc its a header in the IDENTIFYpayload

red lake
#

Bro i don't get it could someone help me in dms?

silk fulcrum
#

wdym reject? discord can't just remove phone status, users can use it

#

and bots are also users

#

but client users

red lake
#

Master you think you could help rq?

silk fulcrum
#

you've already been helped

#

.

red lake
#

I'll send the whole src rq

slate swan
#

you really cant

silk fulcrum
red lake
#

import discord
from discord.ext import commands
import re
import ast
import inspect

bot=commands.Bot(
intents=discord.Intents.all(),
help_command=None,
command_prefix="$",
)

def source(o):
s = inspect.getsource(o).split("\n")
indent = len(s[0]) - len(s[0].lstrip())
return "\n".join(i[indent:] for i in s)

source = source(discord.gateway.DiscordWebSocket.identify)
patched = re.sub(r'(['"]$browser['"]:\s?['"]).+(['"])',
r"\1Discord Android\2", source)

loc = {}
exec(compile(ast.parse(patched), "<string>", "exec"), discord.gateway.dict,
loc)
discord.gateway.DiscordWebSocket.identify = loc["identify"]

bot.run("token")

silk fulcrum
#

but wait then it's rule 5 isnt it

#

!rule 5

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

red lake
#

ohk mb

slate swan
#

its just changing your device for your client which would probably be a pain to parse bots and users

toxic bluff
#

what language do you use to make discord bots

silk fulcrum
#

python.... 💀

slate swan
#

this is a python discord sir

slate swan
#

this is a wendys 😳

red lake
#
from discord.ext import commands
import re
import ast
import inspect

bot=commands.Bot(
    intents=discord.Intents.all(),
    help_command=None,
    command_prefix="$",
)

def source(o):
    s = inspect.getsource(o).split("\n")
    indent = len(s[0]) - len(s[0].lstrip())
    return "\n".join(i[indent:] for i in s)


source = source(discord.gateway.DiscordWebSocket.identify)
patched = re.sub(r'(['"]$browser['"]:\s?['"]).+(['"])',
                 r"\1Discord Android\2", source)

loc = {}
exec(compile(ast.parse(patched), "<string>", "exec"), discord.gateway.dict,
     loc)
discord.gateway.DiscordWebSocket.identify = loc["identify"]


bot.run("token")```
silk fulcrum
slate swan
#

yeah either way its against tos so lets not help on the topic

toxic bluff
#

ok thanks, tbh, I don't even know where to start to make one tho 💀

slate swan
#

master what did i say

#

!rule 5

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

silk fulcrum
#

i just checked if it exists

silk fulcrum
slate swan
silk fulcrum
slate swan
#

yes, either way you shouldve checked it in #bot-commands so i should bonk you twice

toxic bluff
slate swan
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
silk fulcrum
#

go ahead

slate swan
red lake
#

!codeblock

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

silk fulcrum
#

runs for the cat

slate swan
#

😳

red lake
#

but doesnt work

slate swan
#

we cant help you sorry

red lake
#

Why?

silk fulcrum
#

now catty is with me, if you will steal it, you'll reveal yourself:) @slate swan

slate swan
red lake
silk fulcrum
#

go ahead

slate swan
red lake
slate swan
#

and so that changes discords TOS?

red lake
#

bro

silk fulcrum
#

orb

cursive barn
#

what are you trying to do?

red lake
#

through discordwebsocket

short relic
#

how can i create channel with the channel name "channel_name_number" the number is based on how many channel is created

silk fulcrum
cursive barn
slate swan
#

seepithink

short relic
red lake
#

!codeblock

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

silk fulcrum
cursive barn
#

@short relic are you wanting to include voice channels in your indexing as well?

you could try an approach like ```py

channel_number = len(guild.channels) """ or guild.text_channels """
channel = await guild.create_text_channel(f'Channel Name {channel_number}', ...)


If you are trying to build a modmail type system, I would recommend creating a sequential index in your database and using this index in your channel name, but that would be a completely different approach
silk fulcrum
#

he is making tickets sys

short relic
#

i see ill start on learning db

cursive barn
#

I would recommend either aiosqlite or asyncpg for that purpose - aiosqlite will be much easier to get off the ground if you are new to databases

short relic
#

aiosqlite ?

cursive barn
#

its a relational database management system that is extremely compatible with discord bots because it is asynchronous

silk fulcrum
#

sqlite3 is friendliest for begginers imo but it's not very good as a db itself, at least cus it stores data in files

short relic
#

yea i want something that is understandable for me

#

where can i get the docs or guide of that

silk fulcrum
#

sqlite3?

short relic
prime wagon
short relic
#

sh ok

silk fulcrum
#

oh python docs contain tutorial too, ok then

slate swan
prime wagon
#

hi, in the past I used discord.py for creating a discord bot however since then I've notice there are a ton new options out there. hikari, pycord, nextcord etc.. Is there anything I should consider before choosing a module to learn and program my new bot? is discord.py still relevant/competent?

silk fulcrum
#

choosing a lib is more about preference

#

but just to know discord.py is still an option, and a good option

prime wagon
#

oh nice, thanks

slate swan
#

i need help with this

short relic
#

how can i put one variable and one string together

slate swan
#

what do i do to fix this

#

ok so what can i do to fix that?

#

@ me if you know how to fix ikt

silk fulcrum
#

!d ctypes

unkempt canyonBOT
#

ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python.

silk fulcrum
#

there is no windll in ctypes i guess

#

@slate swan

torn sail
slate swan
short relic
#
@bot.command()
        async def delete(ctx):
            if ctx.channel.name():
                await ctx.channel.delete()
            else:
                ctx.send("this channel cant be deleted")

how can i make it so that if the channel name starts with a letter then it will delete the channel, if not it will send ("")

silk fulcrum
#

!startswith

#

:(

#

!d str.startswith

unkempt canyonBOT
#

str.startswith(prefix[, start[, end]])```
Return `True` if string starts with the *prefix*, otherwise return `False`. *prefix* can also be a tuple of prefixes to look for. With optional *start*, test string beginning at that position. With optional *end*, stop comparing string at that position.
silk fulcrum
#

yayy

short relic
#

yaya

#

so its

#

ctx.channel.startswith ? @silk fulcrum

silk fulcrum
#

ctx.channel.name.startswith

#

since channel is not str

short relic
#

@silk fulcrum btw do you know how i can make it so that

#

i cant click the button other people requested

silk fulcrum
#

add a check

#

if the user is creator of the button

short relic
silk fulcrum
#

what is that

#

where is that

short relic
#
@bot.command()
async def vps(ctx):
    button = Button(label = "vps phace", style = discord.ButtonStyle.success)    
    async def button_callback(interaction):
        await interaction.response.send_message(view = vps11())
    button.callback = button_callback
    button1 = Button(label = "vps riel", style = discord.ButtonStyle.success)
    async def button_callback(interaction):
        await interaction.response.send_message(view = vps44())
    button1.callback = button_callback
    if ctx.author.name not in interaction.user.name:
        ctx.send("dung bam nut linh tinh")
    else:
        ctx.send("ok")
    view = View()
    view.add_item(button)
    view.add_item(button1)
    await ctx.send(view = view)
silk fulcrum
#

nah

#

that's not how it works

short relic
silk fulcrum
#
async def check(interaction):
    if interaction.user and interaction.user.id == ctx.author.id:
        return True
    await interaction.response.send_message('These buttons are not for you!', ephemeral=True)
    return False``` and add it to view by `view.interaction_check = check`
silk fulcrum
silk fulcrum
cold tide
#

Anyways

#

How do you send a message if someone executes a command in the wrong channel??

cold tide
#

ive been trying to make mine work but i just eventually got rid of it

short relic
silk fulcrum
slate swan
silk fulcrum
#

but decorators are better, but harder

cold tide
#

So if !test for example works in ctx.channel.id=="696969696": then how do i make it respond if the cmd isn't executed in the right channel?

silk fulcrum
#

cus self would be not defined

silk fulcrum
short relic
cold tide
#

i just want it to send a message saying youve used ctx.author.content in the wrong channel

#

etc

silk fulcrum
#

:reverse: do py if ctx.channel.id != 6969696969696969: await ctx.reply("this is wrong channel, use [#696969696969696969](/guild/267624335836053506/channel/696969696969696969/) one!") return

#

at the beggining of command

cold tide
#

Last time i was told to use decorators and i had 0 clue it looked so jumbled.

#

Alright thankyou!!!

silk fulcrum
#

this is not a decorator tho

cold tide
#

Would i make it a bot.event ??

cold tide
silk fulcrum
#

or you are about a decorator?

cold tide
#

No...

#

i just want it to send a message saying youve use ctx.message.content in the wrong channel!

#

so would it be a @bot.event or @bot.command

silk fulcrum
#

depends on what you are making

silk fulcrum
#

if command, then @bot.command()

cold tide
#

alright.

silk fulcrum
#

if event then @bot.event

cold tide
#

i understand now.

#

thankyou

silk fulcrum
#

it's basic syntax of logical statements

cold tide
#

yes...

#

im just very new to this kinda stuff

#

so a little.

silk fulcrum
#

== is eguals to
!= is does not equal to

slate swan
cold tide
#

Ahh okay

slate swan
#

um im late

cold tide
#

I never new that lol

#

Thankyou for telling me.

slate swan
silk fulcrum
#

bruh

cold tide
#

never been taught it tbh

#

😭

slate swan
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

cold tide
#

im blaming my dad for that

slate swan
#

there are good free tutorials

cold tide
#

yeah ill make sure to read up. Thankyou for letting me know.

silk fulcrum
#

this is not a tutorial, this is a lot of tutorials

silk fulcrum
#

that you can choose from

short relic
#

is this correct now

async def check(interaction):
        if interaction.user and interaction.user.id == ctx.author.id:
            return True
    await ctx.send(view = view, view.interaction_check == check)
slate swan
#

if interaction.user and ?

short relic
slate swan
#

what do u want

short relic
slate swan
#

fix what

silk fulcrum
#

I already sent him a done check but he decided to remove stuff from it

slate swan
#

nice

silk fulcrum
#

and view.interaction_check = check must be with one = and it should be between the check function and ctx.send

short relic
#

oh yea

silk fulcrum
#

not right in ctx.send

cold tide
#
@bot.command()
async def test123(ctx):
		if ctx.channnel.id !=998759012889809046:
		    await ctx.send(f"{ctx.message.content} has been used in a invalid channel, try again!")
       return
silk fulcrum
#

what's with indentation

cold tide
#

Doesn't seem to work.

silk fulcrum
#

return should be in if

#

and why are there... 6 spaces?

#

or it is 8..

short relic
#

indentation 😭

slate swan
#

💀

short relic
#
async def check(interaction):
        if interaction.user and interaction.user.id == ctx.author.id:
            return True
        await interaction.response.send_message('These buttons are not for you!', ephemeral=True)
        return False
    view.interaction_check = check
    await ctx.send(view = view)

is this correct now 😈

cold tide
#

theres no indent errors showing.

short relic
cold tide
#

Wow

silk fulcrum
slate swan
#

a msg that only a person can see

cold tide
#

I put triple nnn

#

😭😭

#

Bruh

silk fulcrum
slate swan
#

nothing

cold tide
slate swan
#

no

silk fulcrum
#

lemao...

slate swan
#

🙂

cold tide
#

alright then

slate swan
#

huh?

short relic
cold tide
slate swan
cold tide
#

Yes

silk fulcrum
short relic
#

i love it

slate swan
short relic
#

btw it worked 😎

silk fulcrum
slate swan
#

when how

slate swan
#

!d discord.ext.commands.Context

unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.

This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.

This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
silk fulcrum
slate swan
#

damn

silk fulcrum
#

oh wait.. but it could be slash commands based context

slate swan
#

YEAH

silk fulcrum
#

i forgot

slate swan
#

BRUH

silk fulcrum
#

yeah.. in hybrid commands for example

#

interaction based context... why not just allow me send ephemeral everywhere

slim acorn
#
    file = resp.attachments[0]
    file.filename = file.filename
    spoiler = await file.to_file()
    mm = await ctx.send(file=spoiler)
    # >>> print(mm.content.url)
```guys I'm sending this image to another channel to change your url and not expire when the channel is deleted...

the bot is sending to another channel but now I need to get the url of this file
slate swan
#

interactions can only be responsed once

#

Whats the upgrade pip command

cold tide
#

How do i show a channel? Like make it so you can click on it and it directs you there.

silk fulcrum
#

add stuff to database?

cold tide
#

i got it dw

#

[#black-formatter](/guild/267624335836053506/channel/846434317021741086/) i did that

#

and it worked

silk fulcrum
#

channelID column in jointocreate table

slate swan
#

Whats the upgrade pip command

lunar bloom
slate swan
#

Whats the upgrade pip command

cold tide
#
@bot.command()
@commands.has_role("Member",)
async def Tiktok(ctx):
	 if ctx.channel.id !=998759012889809046:
		    channel=discord.Embed(title=f"``{ctx.message.content}`` has been used in a invalid channel",description="Please try again ! [#998759012889809046](/guild/267624335836053506/channel/998759012889809046/)",color=0xffff00)
		    await ctx.send(embed=channel)
		    return
		    if ctx.channel.id==998759012889809046:
		        embed=discord.Embed()
		        embed=discord.Embed(title="🤖 Reaper Gen",description="Non-Premium Gen !",color=0xffff00)
		        embed.add_field(name="Tiktok Generated Info:",value=random.choice(tiktokk),inline=True)
		        embed.set_footer(text="Gen Command ! Dev - vd#7157")
		        emb2=discord.Embed()
		        emb2=discord.Embed(title=" Successfully Generated, Tiktok ✅",description=f"Check your inbox {ctx.author} !",color=0xffff00)
		        emb2.set_footer(text="Thankyou for using Reaper Gen 🤖")
		        await ctx.reply(embed=emb2)
		        await ctx.author.send(embed=embed)
		        reward=discord.Embed()
		        reward=discord.Embed(title=f"{ctx.author} !",description=random.choice(loadd),color=0xffff00)
		        reward.set_footer(text="Thankyou for using !tiktok")
		        await ctx.author.send(embed=reward)
silk fulcrum
cold tide
#

I do. Mabye im just not looking properly sorry.

silk fulcrum
#

it doesnt look like you do

cold tide
#

Fixed the indent errors

#

My bad.

vale wing
#

If you have a pc better code on PC

cold tide
#

Its broken.

#

i ran a virus on it without having vm on

#

i thought i did 😭

vale wing
#

Reinstall OS (if it wasn't hardware damaging virus ofc)

cold tide
#

It was lol

#

Rip

#

Tried everything fixing drivers reinstalling os

#

it just died so i removed the parts n scrapped it for like $40

silk fulcrum
#

loame

cold tide
#

i managed to fix the ident errors im pretty sure

silk fulcrum
#

nope you did not as says the error

cold tide
#

Fixed it dw

#

Simple indent errors

#

mb

silk fulcrum
#

yes...

slate swan
#

what can i do so that my bot texts at a particular time, perhaps for a reminder?
it's not gonna be everyday, but on specific days at a specific time
like a birthday bot perhaps (except the time is to be specified asw)

vale wing
unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
slate swan
spiral violet
#

I'm starting to get really confused, My bot's were all working yesterday and now i log in and everything except commands works..? Any ideas?

spiral violet
#

Nope no errors or anything, Just one day it works and the next It's broken..

slate swan
#

Master32 is awake??

silk fulcrum
spiral violet
#

I have all of my intents and a basic command wouldn't be affected by that.

silk fulcrum
#

what? this is not about iintents

#

read the message

slate swan
spiral violet
#

I have no on messages or anything like that

silk fulcrum
#

hmeh

spiral violet
#

Like i said both of my 2 bots were working one day and the next they stop working, was there a update or something??

cold tide
#
@bot.command()
@commands.has_role("Member",)
async def Tiktok(ctx):
	      if ctx.channel.id !=998759012889809046:
	          channel=discord.Embed(title=f"``{ctx.message.content}`` has been used in a invalid channel",description="Please try again ! [#998759012889809046](/guild/267624335836053506/channel/998759012889809046/)",color=0xffff00)
	          await ctx.send(embed=channel)
	          return
	          if ctx.channel.id==998759012889809046:
	              embed=discord.Embed()
	              embed=discord.Embed(title="🤖 Reaper Gen",description="Non-Premium Gen !",color=0xffff00)
	              embed.add_field(name="Tiktok Generated Info:",value=random.choice(tiktokk),inline=True)
	              embed.set_footer(text="Gen Command ! Dev - vd#7157")
	              emb2=discord.Embed()
	              emb2=discord.Embed(title=" Successfully Generated, Tiktok ✅",description=f"Check your inbox {ctx.author} !",color=0xffff00)
	              emb2.set_footer(text="Thankyou for using Reaper Gen 🤖")
	              await ctx.reply(embed=emb2)
	              await ctx.author.send(embed=embed)
	              reward=discord.Embed()
	              reward=discord.Embed(title=f"{ctx.author} !",description=random.choice(loadd),color=0xffff00)
	              reward.set_footer(text="Thankyou for using !tiktok")
	              await ctx.author.send(embed=reward)
#

the command !Tiktok doesnt work...

#

how do i fix this??

silk fulcrum
#

indentions...

cold tide
#

Yeah just noticed lol

#

Nope.

short relic
#
class NOGPU(discord.ui.View):
    @discord.ui.button(label="4 - 8 NO GPU", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.response.send_message(view = )
    @discord.ui.button(label="4 - 16 NO GPU", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.response.send_message(view=)
    @discord.ui.button(label = "8 - 16 NO GPU", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.response.send_message(view = )
    @discord.ui.button(label="8 - 32 NO GPU", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.response.send_message(view =)
    @discord.ui.button(label = "8 - 64 NO GPU", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.response.send_message(view =)

is this the way to add multiple buttons into one view or is this the wrong way ?

cold tide
#

Still errors

silk fulcrum
short relic
silk fulcrum
#

yes

short relic
#

oh ok ill try

cold tide
#
@bot.command()
@commands.has_role("Member",)
async def Tiktok(ctx):
	      if ctx.channel.id !=998759012889809046:
	          channel=discord.Embed(title=f"``{ctx.message.content}`` has been used in a invalid channel",description="Please try again ! [#998759012889809046](/guild/267624335836053506/channel/998759012889809046/)",color=0xffff00)
	          await ctx.send(embed=channel)
	          return
	          if ctx.channel.id==998759012889809046:
	              embed=discord.Embed()
	              embed=discord.Embed(title="🤖 Reaper Gen",description="Non-Premium Gen !",color=0xffff00)
	              embed.add_field(name="Tiktok Generated Info:",value=random.choice(tiktokk),inline=True)
	              embed.set_footer(text="Gen Command ! Dev - vd#7157")
	              emb2=discord.Embed()
	              emb2=discord.Embed(title=" Successfully Generated, Tiktok ✅",description=f"Check your inbox {ctx.author} !",color=0xffff00)
	              emb2.set_footer(text="Thankyou for using Reaper Gen 🤖")
	              await ctx.reply(embed=emb2)
	              await ctx.author.send(embed=embed)
	              reward=discord.Embed()
	              reward=discord.Embed(title=f"{ctx.author} !",description=random.choice(loadd),color=0xffff00)
	              reward.set_footer(text="Thankyou for using !tiktok")
	              await ctx.author.send(embed=reward)
#

Still isnt working...

silk fulcrum
#

still indents wrong...

cold tide
#

Ive checked.

hazy oxide
#

the second if

cold tide
#

Where should it be??

#

Is it unreachable beacuse of the return?

silk fulcrum
#

yes...

cold tide
#

So it shouldnt be indented??

silk fulcrum
#

yes...

cold tide
#

It then says await outside function

silk fulcrum
#

it should be inside the function but inside the previous if, bruh

#

and you say that you understand indents

cold sonnet
#

why are the ifs the same

vocal snow
#

You don't need another if statement either

silk fulcrum
#

yeah, but if indents are hard this will be harder

cold sonnet
#

idk it's a horror on a mobile

cold tide
#
@bot.command()
@commands.has_role("Member")
async def Tiktok(ctx):
	      
	      if ctx.channel.id !=998759012889809046:
	          channel=discord.Embed(title=f"``{ctx.message.content}`` has been used in a invalid channel",description="Please try again ! [#998759012889809046](/guild/267624335836053506/channel/998759012889809046/)",color=0xffff00)
	          await ctx.send(embed=channel)
	          return
	      if ctx.channel.id==998759012889809046:
	              embed=discord.Embed()
	              embed=discord.Embed(title="🤖 Reaper Gen",description="Non-Premium Gen !",color=0xffff00)
	              embed.add_field(name="Tiktok Generated Info:",value=random.choice(tiktokk),inline=True)
	              embed.set_footer(text="Gen Command ! Dev - vd#7157")
	              emb2=discord.Embed()
	              emb2=discord.Embed(title=" Successfully Generated, Tiktok ✅",description=f"Check your inbox {ctx.author} !",color=0xffff00)
	              emb2.set_footer(text="Thankyou for using Reaper Gen 🤖")
	              await ctx.reply(embed=emb2)
	              await ctx.author.send(embed=embed)
	              reward=discord.Embed()
	              reward=discord.Embed(title=f"{ctx.author} !",description=random.choice(loadd),color=0xffff00)
	              reward.set_footer(text="Thankyou for using !tiktok")
	              await ctx.author.send(embed=reward)
#

When running !Tiktok in the right channel it shows the error instead.

slate swan
#

What error

cold tide
#

it shows the first if

cold sonnet
cold tide
#

Not the 2nd if

slate swan
cold tide
#

One is if its not equal to the other is if it is equal to

#

@slate swan

slate swan
#

oh yeah my bad

#

so it's sending what rn?

cold sonnet
#

double check the channel id

cold tide
#

the first if

#

i did @cold sonnet

slate swan
#

yeah check the channel again

cold tide
#

Alr

cold sonnet
#

probably wrong id

slate swan
#

Reaper Gen? what are you making

#

looks like some sort of account generator

#

boost gen hm

cold tide
#

Yes

#

i am :))

slate swan
#

that isn't allowed

cold tide
#

I just had to re type the id and it worked

slate swan
cold tide
#

its not illegal 😭

#

I buy my boosts and sell them.

#

Its nitro**

slate swan
#

generating accounts has got to be illegal

cold tide
#

i buy loads of nitro gifts and put then in there.

#

i mean search it up it doesnt mention it in discords tos

slate swan
#

I don't believe it but idc

cold tide
#

i have paid for them and im distrubiting it.

slate swan
cold tide
#

lol okay

cold tide
slate swan
cold tide
#

nope.

#

i buy them all from trusted sellers.

slate swan
#

how do you think they get it

#

fr

cold tide
#

Not my bussiness how they get it

slate swan
#

they get it not legally

cold tide
#

well i know who i buy from buys them from discord.

#

like the gifts so its legal

short relic
#
class NOGPU(discord.ui.View):
    @discord.ui.button(label="4 - 8 NO GPU", style = discord.ButtonStyle.success)
    async def buttoncallback(self, button, interaction):
        await interaction.response.send_message(view = )
    @discord.ui.button(label="4 - 16 NO GPU", style = discord.ButtonStyle.success)
    async def button1_callback(self, button, interaction):
        await interaction.response.send_message(view=)
    @discord.ui.button(label = "8 - 16 NO GPU", style = discord.ButtonStyle.success)
    async def button2_callback(self, button, interaction):
        await interaction.response.send_message(view = )
    @discord.ui.button(label="8 - 32 NO GPU", style = discord.ButtonStyle.success)
    async def button3_callback(self, button, interaction):
        await interaction.response.send_message(view =)
    @discord.ui.button(label = "8 - 64 NO GPU", style = discord.ButtonStyle.success)
    async def button4_callback(self, button, interaction):
        await interaction.response.send_message(view =)

is this correct for now and i got error output like this
File "c:\Users\ADMIN\Desktop\bot discord\cat.py", line 15
async def buttoncallback(self, button, interaction):
^
IndentationError: unindent does not match any outer indentation level

slate swan
slate swan
# cold tide i sell nitro classic 1 year for $55

All i know is some people expoit the currency from different countries which ig is ok but they login to the account to do it and the other people who do it steal accounts and buy a lots of nitro and distribute them

cold tide
#

hes family are very rich.

#

Hes dad owns some car factory in japan

slate swan
#

thats not a valid explanation its a way to get quick cash

#

you're lying out your ass but Idc. move on

#

fr

cold tide
#

im not but ok loll

slate swan
cold tide
#

still making more money than you

slate swan
#

you'll definitely make it big!

cold tide
#

i am i have 4k in crypto rn

slate swan
cold tide
#

🙃

cold tide
#

tbh mate.

slate swan
cold tide
#

😂😂😂

#

cringey

slate swan
slate swan
slate swan
cold tide
#

Oh no dont bully me beacuse i don't code

#

Boohoo

slate swan
#

you'll make it big!

short relic
#

can someone help whats the problem here

class NOGPU(discord.ui.View):
    @discord.ui.button(label="4 - 8 NO GPU", style = discord.ButtonStyle.success)
    async def buttoncallback(self, button, interaction):
        await interaction.response.send_message(view=)
    @discord.ui.button(label="4 - 16 NO GPU", style = discord.ButtonStyle.success)
    async def button1_callback(self, button, interaction):
        await interaction.response.send_message(view=)
    @discord.ui.button(label = "8 - 16 NO GPU", style = discord.ButtonStyle.success)
    async def button2_callback(self, button, interaction):
        await interaction.response.send_message(view = )
    @discord.ui.button(label="8 - 32 NO GPU", style = discord.ButtonStyle.success)
    async def button3_callback(self, button, interaction):
        await interaction.response.send_message(view =)
    @discord.ui.button(label = "8 - 64 NO GPU", style = discord.ButtonStyle.success)
    async def button4_callback(self, button, interaction):
        await interaction.response.send_message(view =)

it says unindent does not match outer indentation level

slate swan
#

the error tells you ?

short relic
#

this is the error

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

short relic
slate swan
#

perhaps read the embed first & give it a try yourself?

slate swan
blazing beacon
#

how do i get a webhook from its name?

cold tide
#

I cant find the issue 😭

slate swan
slate swan
cold tide
#

Just leave me alone your gonna be 🥒 🚴‍♂️ me all day

short relic
#

yea i dont think there are any indentation errors here lol 😭

blazing beacon
cold tide
#

@slate swan mind if you can help?

slate swan
#

!d discord.Guild.webhooks

unkempt canyonBOT
#

await webhooks()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Gets the list of webhooks from this guild.

Requires [`manage_webhooks`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_webhooks "discord.Permissions.manage_webhooks") permissions.
blazing beacon
#

i found it thank you!

cold tide
#

I cant find the error 😭

silk fulcrum
#

How can I make my HelpCommand hybrid?

blazing beacon
torn sail
cold tide
#

I cant find it

silk fulcrum
torn sail
#

Slash commands already have descriptions and stuff so it’s not really needed

#

Also apparently it would take a lot of reworking

slate swan
cold tide
#

Im not on windows.

slate swan
#

oh

#

then just scroll till you find a duplicate

blazing beacon
#

idr though

cold tide
#

Ive just looked and theres no other command called !netflix

#

What do i do?

slate swan
#

send the code for it

cold tide
#

The whole code??

slate swan
#

you probably have 2 decorators on top of the function

#

remove the @bot.command() on the top

cold tide
#

Oh

silk fulcrum
cold tide
#

Ive also used channel variable more than once

slate swan
#

you only need that decorator once

torn sail
#

Help command only for messages commands tho

silk fulcrum
cold tide
#

Wait nvm

silk fulcrum
#

everything has slash commands but not help

slate swan
torn sail
#

No since app commands have dexrriptions for options and the options are shown and stuff

cold tide
#

Ima try

torn sail
#

Unlike message commands which are not shown in ui

cold tide
#

Yes thankyou

#

@slate swan other issue

slate swan
cold tide
#

im not sure if its a indent error or something else

#

it just doesnt send when running it

#

@slate swan

slate swan
#

make sure the ID is correct

cold tide
#

Shouldn't it not be indented w the return??

#

bc it will show as unreachable code.

slate swan
#

your return statement lol

#

your 2nd if statement also has a space in it

cold tide
#

Thought so.

#

alright ill try fix that

slate swan
#

pretty sure whatever your doing is illegal so I don't wanna help anymore

cold tide
#

its not lool

slate swan
#

and what is with the creation of an instance of Embed and then overwritten it with another?

slate swan
cold tide
#

Ive paid for them...