#discord-bots
1 messages · Page 24 of 1
nope
embed=variable
do you want it to delete the message after some time?
Yes
when i made that change, it started to have an error on my "client.run(TOKEN)
6 seconds
then it'd be better to use delete_after
Make sure its not indented.
what's your code?
so await ctx.send(..., delete_after-6)

it won't let me share it, it's too long
:chat:
.txt file in DM
lmao
!paste
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.
for long code
what error?
@slate swan I had a choice to go sleep or to help here until 3 AM, and I chose help
I went to sleep
I know
@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)
😭😭😭
!d discord.Message.delete
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.
just await ctx.send(embed=dropp, delete_after=6)... what is so hard
Master32 is right
im always r...ong
yeah, im just half drunk cus of my decision
How 😭
@silk fulcrum how do i make a argument so like !drop test then it shows test
and it's still 11:30 PM tho
pass it into function
just add any argument?
How to show class of error in on_command_error?
Withdraw?
??
pass the argument to the function
!d discord.Message.content
The actual contents of the message. If Intents.message_content is not enabled this will always be an empty string unless the bot is mentioned or the message is a direct message.
idk what you mean by "shows test" but here's how you can capture args
@bot.command(...)
async def foo(ctx, arg):
# "arg" will be the second argument you pass to the command
If you do !foo bar, arg will be "bar"
You can get more info here: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#parameters
idk what is this but there is example of argument @cold tide
@silk fulcrum is ctx typehinted with message.Content?
How does this help anyone
@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
no?
with commands.Context?
oh yeah
its 2 PM for you isnt it?
No
Is your message being deleted by you or another bot?
No
The message you are trying to delete does not exist
Do you have two instances of your bot running by any chance?
@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
Oh, Now a new error
yeah that's fine
thought so
that's fine but it will only send one word
*,
I never typehint args only returns
Now it works
why not)
I know, I thought they wanted only one word
try looking in #esoteric-python 😄
at least that stuff is cool
then you do not make any sence too
Why does it remove old warnings?
should it be a instead of w
because you are literally replacing it
[*map(lambda x : print(x), ["Good night" for n in range(100)])]

because you rrewrite them every time?
...
that's the simplest esoteric python snippet i've seen
it shouldn't matter
because I barely know esoteric shit 
How do I fix this then?
uh append to an array or something, don't replace the previous warning in the mapping with the new warning
any easier solution?
no
bruv
that's the easiest solution
what's the hardest then?
idk and idc
wow
bro it's basic json
ok whatever
use some stupid database and create a column for each warning is probably the hardest solution
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
with using binary language 💀
what does that even mean
0101010 10 110 10110010101 01 01 01 10101010 101 0
nobody does that
that's why its the hardest solution
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
leamo
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
...
of course
Command raised an exception: AttributeError: 'dict' object has no attribute 'append'
WHY MAKE IT HARDER THEN, ISNTEAD OF ADDING A FUCKING ATTRIBUTE
yo stop using json files please
no.
chill out
ok.
what do you mean adding attribute? to dict? good luck
tell me something easy as this one
they're genuinely not good
I planning on using mongo_db
.
||mongo_db === json||
no
But better
# 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...
bruh i already wanna sleep, how am i gonna last 3 more hours
It makes me laugh hahaha
Pause
go to sleep, you make not much sense atm
# A: It doesn't work because the json file is not a dict.
bruh....
but here's the solution anyway. your json file should be like this:
{ "<member id>": [ <warning>, ... ] }
it IS a dict
and you use it as list using append
wdym?
why id in quotes :blobpain:
what do I do now
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ı'}
}
}```
bruh and how to not spoonfeed in such situatuions?
why am i getting that error can somebody help me?
good question
wtf is this 😲
wdym
databtc['bitcoin'] doesn't exist
print your databtc
replit :blobpain:
you're not using asynchronous functions when you're making network requests
ah it doesn't matter
@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
the member id should be the key to an array of warnings
it doesn't exist at the point of your other code execution
@slate swan
{
"bitcoin":{
"try":414747
}
}
that's how your things formatted what are you tryna access
prbably the blokchain
What part do you want to access?
try
the 414789?
what am i supposed to say
yep
databtc['bitcoin']['try']
thats what i did
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?
This works, But there are two keys now...
that's weird
yea..
because you were previously using str(member.id) as the key, whereas now you are using member.id (which is an int)
What should I do?
it's not
it's not possible for there to be two keys
at least not with your current code
can you help me?
Probably not
@gusty shard can you add print('yes') the line after your print(databtc)
damn 
# 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
why would that affect the program?
what's the full code of that
It's called debugging 🧂🥸
that debugging does literally nothing
I agree
it's so obvious that it will print yes if it printed databtc before

Doesn't need to be an f string btw
I was checking whether this was all wrapped in an async function and whether yes would print prior to data
I think it's something to do with the dict
hbc
try breaking the dict down
bitcoin = databtc['bitcoin']
then
bitcoin['try']
in your idler dict
oke
print each afterwards to debug
failing that, send me ur code and i'll fix it locally 🙂
i've run this multiple times without any errors
its not working
no clue why the service is returning incorrect data for you
i guess something is wrong with the file
have you checked their docs?
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
returns okay for me too
check if 'bitcoin' is written correct and if yes then try printing databtc right in this file to see what you get from a request
the code is correct...
theres nothing to fix
but there is a error...
i didnt even saw something like that
@gusty shard is that your full code?
what you pasted earlier?
because it runs fine for me
no, there are 500+ lines as we can see from traceback
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
; 💀
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
??????????????????????????////
discord.ext.commands.errors.ConversionError: (<class 'commands.economy.pvc.DurationConverter'>, NotImplementedError('Derived classes need to implement this.')) error !!!

just checking in, did you fix it?
i guess it's async def convert
No I gave up
I already gave up
!d discord.Client.start
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").
ooo thee is this method
bot.start() will not return until the bot is closed
you are doing discord.Client, and it has not intents arg im start method
which means you will have to schedule that as an asyncio task
as you can see from this, it calls bot.connect(), which literally contains a while loop to receive gateway events and dispatch events
no...
@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
Now that, is alot of words.
??
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 !!!
can someone tell me why every command is not listed?
https://i.gyazo.com/345e42c4701c9b1aca33cc7886c5722b.png
they were listed before but now they are just gone. using d.py 2.0
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)
}
did you sync globally
send the message then check if the message content contains either the yes or no
it's read_messages, you're missing an s
Oh shit thanks
👍
!d discord.Client.wait_for
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**...
but finally I changed read_messages By view_channel by looking in the doc
Check the docs, there's an example that shows how you can wait for a message event
no
But there is still a problem
all guild
What is it
it can take up to an hour to update that way
Bah whoever created the ticket can't see the channel
ok
Are you using guild.create_text_channel()?
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
channel= await interaction.guild.create_text_channel(f"{interaction.user.name}︲ticket", overwrites= overwrites)
Yes
is there a way to do eval command in Python? Sorry for the question, I'm a beginner.
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
Yes, but it's not always an easy feat for a beginner. Here's the source code for your reference: https://github.com/Rapptz/RoboDanny/blob/rewrite/cogs/admin.py#L214-#L259
Whatever you do, don't not copy it, that's not the point. Just do a bit of research on all the classes and functions being used so you can create your own deviation.
No
Do this
OK thank you
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
ok i will try thanks
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'
Uh I used ctx.author as an example, you should use interaction.user
Ahh my bad
you're the Boss, it works thank you very much, I did well to come and ask here

👍
@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
There was no error in the console, but the bot does not execute the command
Do you have on message event in your code
Can you show more code?
!paste
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.
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'))```
You were right
Use @bot.listen() instead of @bot.event for your on_message() event listener
Ok
thanks
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()
@bot.command(name="clearall")
@commands.check(clearall_check)
async def command_clearall(ctx: commands.Context):
await ctx.channel.delete()
!d discord.abc.GuildChannel.delete
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.
ctx.channel is an instance of this if the command was invoked in a guild. You can use ctx.channel.delete()
this however isnt checking to make sure its used in a place that its allowed to be used
Well you didn't ask for that
you're free to do that if you want
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()
i am just very aware i dont want to accidentally delete anything while testing lol
alr
You could though
wouldn't change much actually, didn't know Context had a bot attribute
yeah, considering setting up the bot on a test server coz of that
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 🙂
I assume you mean only allow a command to be invoked in a certain channel(s)?
Yessss
🤔 how ?
Will there be more than one channel?
Hmm only in one
Hi
How can i do a clear command
Okay so you can check if the channel Id is equal to the channel you want the command to be invoked in
Search Lukas clear discord on yt !!!
Lucas does not make very good tutorials..
of course
I wouldn't recommend his videos
who is the best one
how do you learn discord.py
@limber bison
if ctx.channel.id == YOUR CHANNEL ID:
# do something
Ohh got it 🤔
learn python first, discord bots are not a very beginner friendly project
I learn it
Should work.
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
how does someone mention in inside the description in Python?
no
!d discord.ext.commands.check
@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").
like you usually do, there should be a .mention attributes
!d discord.TextChannel.purge
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...
@invalid-user I want to make it mention the person who used the command
!d discord.Member.mention as i said there would be a .mention attribute, access the author using ctx.author
property mention```
Returns a string that allows you to mention the member.
they both would work
I'd say the first is easier though
well they're both easy
it isnt that good i guess
I did not make it
what
could you send me an example? (if possible)
for example, f"{member.mention}"
@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?
!f-string
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.
!f
You are not allowed to use that command here. Please use the #bot-commands channel instead.
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?
In a command?
If so:
ctx.author.mention
You can help me ?
Are you following a YouTube tutorial?
Yeah
Figured. Lucas?
No, not really
who is the best one
A basic unban command should be like 2 or 3 lines max
None, most are outdated and have terrible code
ok
Typehint your member argument to a discord.User, pass it into .unban, easy as that
@client.command()
async def unban(ctx, *, member):
banned_users = await ctx.guild.bans()
member_name, member_discriminator = member.split('#')
for ban_entry in banned_users:
user = ban_entry.user
if (user.name, user.discriminator) == (member_name, member_discriminator):
await ctx.guild.unban(user)
await ctx.channel.send(f"Unbanned: {user.mention}")
that it good ?
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
my bot does not update with the about me what could be the reason?
it worked, thanks for the help
Pls help for unban command
sorry but i can't help, i can barely embed 
ok
how can i get the id of the channel i just created with create_text_channel
createe_text_channel returns channel object
The channel ID.
hey master👋
hey okimii 👋
!d discord.ext.tasks.loop
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").
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") ?
Is there a good replacement for dpy yet? Like something that probably adds onto it?
dpy has been resumed so what for?
oH?
.... i just said that create channel func returna channel object
Guys any command idea for my bot?
DAMNNNN
so ch = await guild.create_...
just save the the result of guild.create_text_channel lol
dude thanks! @slate swan I didn't know!
its quite confusing for me sorry
anytime👍
how can i do that 😮
you dont know what are variables?
i know lol but sometime it confuses me 😦
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)
oh yes i can understand this
undefined textchannel_
thanks man
oops
get_channel needs await?
wdym👁️👁️
i saw that 👁️👁️
you saw nothing😳
im not blind
i edited the message btw i was thinking about caching issues but that shouldnt be a problem
im brainblind
ok
@slate swan do you know how to make a help command hybrid? i did not find it in HelpCommands paragraph
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 😢
idk how to use hybrids really, never touched them
check my example lol
why all those gets and fetchs? why not just ticket_channel.send()?
oh shit you can even do this lol
oh right
omg i keep having this problem where i make code better and forget about its simple solution😭
😠 wdym
lemao
do what master said lol
you should ask y9🏃♂️
master 🙏
for what
you should ask y9 about my problem lmao
its happen like 2 times already 3 including this time
instead of all this shit, just do await ticket_channel.send('hello') @short relic
holy shit it worked
thanks @silk fulcrum @slate swan 
you cant lol
you can
you can
you can by mutating a header which is againsts tos <3
through WebSocket i can send you the doc
waht
Everyone does it. I've seen over 5k bots
its a simple header iirc, but its againt tos iirc
Even verified bots use it.
iirc its a header in the IDENTIFYpayload
Bro i don't get it could someone help me in dms?
wdym reject? discord can't just remove phone status, users can use it
and bots are also users
but client users
Master you think you could help rq?
you really cant
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")
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
already did import ast
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.
ohk mb
its just changing your device for your client which would probably be a pain to parse bots and users
what language do you use to make discord bots
python.... 💀
this is a python discord sir
this is a wendys 😳
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")```
this is a ping lemons 😳
yeah either way its against tos so lets not help on the topic
ok thanks, tbh, I don't even know where to start to make one tho 💀
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
i just checked if it exists
lemao
i tried import ast
dont make me bonk you😡
for what? for checking?
yes, either way you shouldve checked it in #bot-commands so i should bonk you twice
anyone know a good resource to learn?
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
try
ill steal your cat and bonk you
go ahead

!codeblock
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.
runs for the cat
😳
we cant help you sorry
Why?
now catty is with me, if you will steal it, you'll reveal yourself:) @slate swan
Because im pretty sure its against tos of discord lol
omg bro its not
ill steal you too
go ahead
How is it not?
Many hundreds of bot use
and so that changes discords TOS?
bro
orb
what are you trying to do?
trying to get mobile icon status on a discord bot
through discordwebsocket
how can i create channel with the channel name "channel_name_number" the number is based on how many channel is created
store amount of channels somewhere and when creating channel add one to it
that is most definitely against discord ToS @red lake
https://discord.com/developers/docs/policies-and-agreements/developer-policy#:~:text=misrepresent or mask either your identity or your application’s identity when using the APIs or developer accounts%3B
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
see
u have any guide or docs on that 😭
!codeblock
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.
well my thingy means using db, well tickets usually use db anyways, so what will be the db is your choice
@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
he is making tickets sys
i see ill start on learning db
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
aiosqlite ?
its a relational database management system that is extremely compatible with discord bots because it is asynchronous
sqlite3 is friendliest for begginers imo but it's not very good as a db itself, at least cus it stores data in files
yea i want something that is understandable for me
where can i get the docs or guide of that
sqlite3?
yea
sh ok
oh python docs contain tutorial too, ok then
Code or error?
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?
yes, discord.py resumed and now has slash commands and all that new stuff
choosing a lib is more about preference
but just to know discord.py is still an option, and a good option
oh nice, thanks
i need help with this
how can i put one variable and one string together
what do i do to fix this
ok so what can i do to fix that?
@ me if you know how to fix ikt
!d ctypes
Maybe cause replit projects are not windows
Nah it aint the reason ive had it working before but now its doing this
@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 ("")
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.
yayy
oh ok tks
@silk fulcrum btw do you know how i can make it so that
i cant click the button other people requested
can i do this like this
if ctx.user.name not in interaction.user.name:
ctx.send("dung bam nut linh tinh")
else:
ctx.send("ok")
one sec it said interaction is not defined
@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)
whats the problem here 😭
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`
everything
Oml 😭
what?
Anyways
How do you send a message if someone executes a command in the wrong channel??
ok man 😎 👍
ive been trying to make mine work but i just eventually got rid of it
i think you check ctx.channel 😈
if right in command then this
What do you consider to be the wrong channel?
but decorators are better, but harder
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?
edited @short relic
cus self would be not defined
so you made if ctx.channel.id == 6969696969669696969?
ok got it
Theoretically yes
i just want it to send a message saying youve used ctx.author.content in the wrong channel
etc
: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
Last time i was told to use decorators and i had 0 clue it looked so jumbled.
Alright thankyou!!!
this is not a decorator tho
Would i make it a bot.event ??
Yeah ik lol
why? you are making a command
or you are about a decorator?
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
depends on what you are making
That^
if command, then @bot.command()
alright.
if event then @bot.event
Whats the use of the "!" ?
do you know programming?
it's basic syntax of logical statements
== is eguals to
!= is does not equal to
!= = not equal
Ahh okay
um im late
its basics
bruh
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
im blaming my dad for that
there are good free tutorials
yeah ill make sure to read up. Thankyou for letting me know.
this is not a tutorial, this is a lot of tutorials
ye typo
that you can choose from
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)
nope
if interaction.user and ?
did i miss something
i want to know how to fix that
fix what
I already sent him a done check but he decided to remove stuff from it
nice
and view.interaction_check = check must be with one = and it should be between the check function and ctx.send
oh yea
not right in ctx.send
@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
what's with indentation
Doesn't seem to work.
indentation 😭
💀
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 😈
should be
btw whats ephemeral
Wow
a message that Only you can see
a msg that only a person can see
damn people still using discord.py
no wonder
what's wrong?
nothing
Issue??
no
lemao...
🙂
alright then
huh?
😈 sound sus

only works with interactions tho
Yes
i love it
how can I run a coro forever? can anyone help in #☕help-coffee
btw it worked 😎
nope, context now has ephemeral in send too
!d discord.ext.commands.Context
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.
damn
oh wait.. but it could be slash commands based context
YEAH
i forgot
BRUH
yeah.. in hybrid commands for example
bruv
interaction based context... why not just allow me send ephemeral everywhere
cuz ephemeral spam
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
How do i show a channel? Like make it so you can click on it and it directs you there.
add stuff to database?
wdym? this? #welcome
i got it dw
[#black-formatter](/guild/267624335836053506/channel/846434317021741086/) i did that
and it worked
channelID column in jointocreate table
Whats the upgrade pip command
And then not await?
Whats the upgrade pip command
@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)
Says
omg if you just completely dont understand indentation then I can't help you
I do. Mabye im just not looking properly sorry.
it doesnt look like you do
If you have a pc better code on PC
Reinstall OS (if it wasn't hardware damaging virus ofc)
It was lol
Rip
Tried everything fixing drivers reinstalling os
it just died so i removed the parts n scrapped it for like $40
loame
nope you did not as says the error
yes...
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)
!d discord.ext.tasks.loop but are the times gonna be hardcoded or not
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").
Guys how we can make alt detector in discord.py?
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?
any errors?
Nope no errors or anything, Just one day it works and the next It's broken..
Master32 is awake??
?
?
I have all of my intents and a basic command wouldn't be affected by that.

I have no on messages or anything like that
hmeh
Like i said both of my 2 bots were working one day and the next they stop working, was there a update or something??
@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??
indentions...
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 ?
Still errors
this is correct but functions should be named different
u mean button_callback?
yes
oh ok ill try
@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...
still indents wrong...
Ive checked.
the second if
yes...
So it shouldnt be indented??
yes...
It then says await outside function
it should be inside the function but inside the previous if, bruh
and you say that you understand indents
why are the ifs the same
You don't need another if statement either
yeah, but if indents are hard this will be harder
idk it's a horror on a mobile
@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.
What error
it shows the first if
update they aren't
Not the 2nd if
you have the same ID twice?
double check the channel id
yeah check the channel again
Alr
probably wrong id
Reaper Gen? what are you making
looks like some sort of account generator
boost gen hm
that isn't allowed
I just had to re type the id and it worked

generating accounts has got to be illegal
i buy loads of nitro gifts and put then in there.
i mean search it up it doesnt mention it in discords tos
I don't believe it but idc
lmg for cheaper?
lol okay
i sell nitro classic 1 year for $55
probably uses stolen tokens
Not my bussiness how they get it
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
With fraudulent cards probably
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
No. He has alot of money.
hes family are very rich.
Hes dad owns some car factory in japan
thats not a valid explanation its a way to get quick cash
you're lying out your ass but Idc. move on
fr
im not but ok loll
go sell your $2 boosts pal
you'll definitely make it big!
i am i have 4k in crypto rn
yet you need help on simple code
🙃
Missing information: nobody cares
makes sense
I don't care
ok
you'll make it big!
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
the error tells you ?
IndentationError: unindent does not match any outer indentation level
this is the error
!indents
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
uh so can u help me to find out the problem in my code i sent earlier 🙂
perhaps read the embed first & give it a try yourself?
just read the error and find its location, sorry im on mobile i barely can see indentation correctly😅
how do i get a webhook from its name?
https://paste.pythondiscord.com/bopoyebixa
that's his code
I cant find the issue 😭
looks better, but i see no indentation error inside of it i just see syntax errors for not providing a value to the view kwarg lol
skill issue?
Just leave me alone your gonna be 🥒 🚴♂️ me all day
yea i dont think there are any indentation errors here lol 😭
mad for what
?
@slate swan mind if you can help?
idk if you can use utils but you can see !d discord.Guild.webhooks
!d discord.Guild.webhooks
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.
i found it thank you!
I cant find the error 😭
How can I make my HelpCommand hybrid?
you have a command with the same name already
U can’t
I cant find it
😳 :(
Slash commands already have descriptions and stuff so it’s not really needed
Also apparently it would take a lot of reworking
ctrl f with the cmd name
Im not on windows.
theres probs something there on pydroid with the same thing
idr though
send the code for it
The whole code??
you probably have 2 decorators on top of the function
remove the @bot.command() on the top
Oh
So I just switch from hybrid commands to slash? Won't it be hard?
Ive also used channel variable more than once
you only need that decorator once
No I would keep both
Help command only for messages commands tho
wont users be mad :lemao:
Wait nvm
everything has slash commands but not help
did it work
No since app commands have dexrriptions for options and the options are shown and stuff
Ima try
Unlike message commands which are not shown in ui
ohh i got it
What is it
im not sure if its a indent error or something else
it just doesnt send when running it
@slate swan
make sure the ID is correct
pretty sure whatever your doing is illegal so I don't wanna help anymore
its not lool
and what is with the creation of an instance of Embed and then overwritten it with another?
Variable? I do it in weird ways
generating instagram accounts and netflix accounts is 'legal'?
Ive paid for them...


