#discord-bots
1 messages · Page 25 of 1
its not illegal at all and discord doesnt diss allow that
not sure on the context of the conversation but isnt that against tos of their platform? selling accounts?
are you sure? I've seen people receiving discord warnings for being in servers like your gen server
okimii, trust me whatever he's doing is illegal
I havent had a single report from discord. My server doesnt break its terms im quite clear on it.
you don't know me I know what you do
guys is the max amount of button u can put into a subclass view is 4 ?
@slate swan check dms
🧐
you are cringe
either way if its legal or not account selling is against instagrams TOS so you would be breaching discords TOS as you're serving a service on their platform that breaks another platforms TOS which would break discords TOS, so please lets end the conversation and keep the comments to ourselves, please dont ask for further help on the topic as rule 5 exists, if the conversation keeps going on, i will and can contact moderators, please and thank you.
.topic
Suggest more topics here!
god damn
Suggest more topics here!
still waiting for brad to make me a mod😔
vouch
Traceback (most recent call last):
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 382, in _scheduled_task
await item.callback(interaction)
File "c:\Users\ADMIN\Desktop\bot discord\cat.py", line 16, in button_callback
await interaction.response.send_message(view=ORDER48)
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 696, in send_message
payload["components"] = view.to_components()
TypeError: View.to_components() missing 1 required positional argument: 'self'
Whats this error 😭
not custom banners
U need an instance of that view
seems like a skill.......... sad
U are just passing in the class
not a skill!
nothing more than custom emojis
what about message limits?
dont bots have 4k char limits?
how do i run a command without it being invoked
!d discord.ext.commands.Context.invoke
await invoke(command, /, *args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Calls a command with the arguments given.
This is useful if you want to just call the callback that a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") holds internally.
Note
This does not handle converters, checks, cooldowns, pre-invoke, or after-invoke hooks in any matter. It calls the internal callback directly as-if it was a regular function.
You must take care in passing the proper arguments when using this function...
thanks
bots need custom banner access 
👍
read the error message
apparently discord API is lagging
anya forger
@slate swan is spyxfamily good it's on my planning
if you named your bot okimii it could and would take over the world
its really nice , im waiting for s2
well, yes
Youre my world😉
ah ok, I'm finishing up the blood c series
am just a variable with global scope
That i access😳
shush, youre not even fully imported in the file,
typing.TYPE_CHECKING moment
if love was a boolean it would be True because i get imported when sarth is checking types🥺
what the fuck are you talking about
what's going on here
maybe i dont have helper because half of my 44k messages are flirting, or maybe im just trash💀 
zeffo i can explain
wait are you a dude or female?
idk
how do you have more messages than me !!
Nonbinary?
ive been messaging everyday in this channel for more than 1 year you know why
What's even happening here
Might wanna take this to an ot 👀
Literally nothing
this is an ot
How??
ot4-andy-copypasta-spam
why are you always thinking about andy, when you have a lovely person named nova writting you poems bro
Well, I got more messages than both of u (:
you're* 
Almost 43k
So now shut
you?
okimi has 45k
you're a dude
Shows 39k in my client 💀
Ah, u talking about the whole server. I have 43k in this channel alone lol
jesus christ hunter
hunter has never seen the outside world😭
Is there a limit to how often a bot can update its status? or do I need to first clear the existing one before I update it?
every x amount of seconds, I forgot the exact number
It's either 15 or 25 iirc
120/60s iirc
Oh
I'll just set it to update every 5 minutes. It's not necessary to update often.
I wasnt sure which fix I needed to add
i am unable to install discord.py in pip
it says subprocess-exited-with-error
...
what's your python and pip version
U can also set it to 1 minute without any issues
As I said - It's not necessary to update it that often.
5 minutes is fine
Cool
check mine👀
message count dosent show on mobile😔
ok 19906💀
rip
hm.. i guess im finally done with all useful but borind stuff like db, bot subclass, e.t.c. and can finally make commands
currentTime = currentDateAndTime
print(currentTime)
class Status(commands.Cog, name="Status"):
def __init__(self, bot: commands.Bot):
self.__bot = bot
self.status_list = (
nextcord.Activity(type=nextcord.ActivityType.watching, name=(currentTime.strftime("%H:%M"))),
)
self.current_status = random.randint(0, len(self.status_list) - 1)
@commands.Cog.listener()
async def on_ready(self):
print("Status cog is ready!")
self.status_loop.start()
@loop(seconds=600)
async def status_loop(self):
"""Loop to update status"""
self.current_status = (self.current_status + 1) % len(self.status_list)
await self.__bot.change_presence(activity=self.status_list[self.current_status])
def setup(bot):
bot.add_cog(Status(bot))```
How do i make it so it updates the time continuously?
presence update ratelimits are pretty strict
you can change presence 5 times every minute
Guys how we can make alt detector in discord.py?
bruh, that stupid error happens to me, when it says "Unknown message" when trying to delete my ctx.message but my message exists
cant
In discord.js?
no
to detect alt you need what? IP. How can you get IP via discord bot? Nohow
so the answer is: not possible
But I saw there are many alt detector bots
those aren't accurate
How
they don't break rules, but the way they detect alts is not accurate
not at all
They work with a site
ohkay
wdym?
IP grabber 💀
logging someone's ip address isn't illegal, in fact most websites do it
Fun fact: all sites can access your IP
anyways, ip based alt detection is bad
Especially for mobiles
well yes, but.. isn't there some illegal things that you can do if you have person's IP? cus I thought like that
Cuz their IPs are very dynamic
eh not really
there's some stuff that can be done
We can get ur approximate location and zip code
We could determine your home city (unless it's a mobile network)
But like I dont think thats very harmful
Nah IPs can't provide THAT accurate info, maximum home city from what I researched
Oh, cus I was scared that revealing is really bad and something bad will happen
What version of dpy do you have
So the only thing is location as I see
newest
2.0?
i litterally tried everything
pip show discord
There's a possibility of DDoS attack if you don't have any protection against it
But who tf would attack a home computer lmao
it matters, if you just executed pip install discord it would install 1.7.3
package not found
lmao...
😭
pip show discord.py
Yes, thats what approximate location and zip code give u usually
gah
Ok how do you do the import @small pawn
me :beep_boop_baap:
from discord import ui
You can't
from discord.ui import something
If attacker has network of zombie computers
or just import discord
How does it not work
and discord.ui.View
do you have a file called discord.py
or a folder called discord
no
how are you running the code?
vsc python file
wdym
how are you running the python script
what command do you use to run it
can you run it conventionally and see what happens
how do I do that
😳 can bots have two factor?
no ig not
how would you run a normal python script
like that
The account of bot's owner might
run start debugging in vsc
I think dev portal requires you to enable it when you first sign up
that's not how you should do it at all
either use the Run button or use the commandline
Did u get this while trying to do something with ur bot?
py file.py
i use run btn
oh my gosh, I completely forgot that I disabled 2FA when my phone broke
deleting message
on server that requires 2FA for mods
ok, and which python interpreter have you set in vsc
bottom right, click the python version
I think the server ur using this in has 2fa requirement for mods enabled and since you have it disabled the command wont work for you
u mean this?
python!!
No
ok, now go to command line and run py -V
black beans
Python 3.10.5
now py -m pip install git+https://github.com/Rapptz/discord.py
uh it worked but now it says module 'discord.ui' has no attribute 'ButtonStyle' 💀
nvm
ty
async def order(ctx):
vpsembed = discord.Embed(name="chon loai vps ban muon mua", description = "neu chon sai co the dung lai lenh de chon lai", color = 0x00FFFF)
vpsembed.set_image(url = "https://media.discordapp.net/attachments/1001798328641654885/1004595123113439293/unknown.png")
vpsembed.set_author(name = "Magic Shop")
vpsembed.set_footer(text = "Made by kpt#3471")
button = Button(label = "khong gpu", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message(view = NOGPU())
button.callback = button_callback
button1 = Button(label = "co gpu", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message("fak u")
button1.callback = button_callback
view = View()
view.add_item(button)
view.add_item(button1)
async def check(interaction):
if interaction.user and interaction.user.id == ctx.author.id:
return True
await interaction.response.send_message('chit nhau thi dms em nhe', ephemeral=True)
return False
view.interaction_check = check
await ctx.send(embed = vpsembed)
await ctx.send(view = view)
when i use the command nothing happened but after i removed the embed the command works normally, whats the problem?
why aren't you sending embed and view in same message?
await ctx.send(embed=vpsembed, view=view)
i tried but it didnt work so i think seperate them will work
no...
async def order(ctx):
vpsembed = discord.Embed(name="chon loai vps ban muon mua", description = "neu chon sai co the dung lai lenh de chon lai", color = 0x00FFFF)
vpsembed.set_image(url = "https://media.discordapp.net/attachments/1001798328641654885/1004595123113439293/unknown.png")
vpsembed.set_author(name = "Magic Shop")
vpsembed.set_footer(text = "Made by kpt#3471")
button = Button(label = "khong gpu", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message(view = NOGPU())
button.callback = button_callback
button1 = Button(label = "co gpu", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message("fak u")
button1.callback = button_callback
view = View()
view.add_item(button)
view.add_item(button1)
async def check(interaction):
if interaction.user and interaction.user.id == ctx.author.id:
return True
await interaction.response.send_message('chit nhau thi dms em nhe', ephemeral=True)
return False
view.interaction_check = check
await ctx.send(embed = vpsembed, view = view)
still didnt work is there any problem in the embed part
because if i remove the embed it works normally
any errors?
no...
no errors.. that's really weird
yea 😭
but i think the problem is in the embed part
but the embed part is just nothing wrong
Can a normal bot see servers, where the user is in?
weird that it didnt give any error but np
Like in authorization tab it shows Mee6 can see:
normally - no, but if you authorise it, then yes
How can do filter of auto-mod which triggered on recurring messages? discord.py
also, not the bot knows what servers you are in, but application
I thought viewing user servers are only possible through website oauth2?
waht?
I don't get your problem, but discord has implemented auto-mod
There is no such function as 🤔 x184827
Well I thought that, the only way to view user servers - is to redirect them to a new website where they have to authorize it, and only then "web/server" sees user guilds (with oauth2 scopes)
you mean spamming emojis?
oh i see
hmm, I'm not sure what's the way, I'd create cooldown mapping and a Counter in a cog and in on_message get bucket of a mapping and check if bucket.update_rate_limit(message.created_at) (else: Counter.pop(author.id, None)), then add 1 to Counter[author.id], and check if Counter[author.id] >= limit_of_spam @real grail
discord.ext.commands.errors.CheckFailure: The check functions for command pvc failed.
what dose this mean ?
that you have a check for a command and it failed
how can i make it so that people can only press the create channel button once to avoid spamming tickets
like py @command() @has_permissions(administrator=True) async def pvc(ctx): ...
and user doesn't have admin permissions
then it would raise that error
oh got it boss
until the ticket is closed?
def __init__(self , client):
self.client = client
def check_channel(ctx) ->bool:
return ctx.channel.id == 999186452757872701
@commands.command()
@commands.check(check_channel)```
then the command was executed in wrong channel
no
ya ya got it
like i have a command to open the ticket gui and it has a cd of 5 mins but people can press the create ticket button multiple times so how can i avoid that
Uhm, does that command open gui for everyone or only for user who executed it?
so like, everyone can press the button or only executor?
Only the executor
you helped me to make a check that if not the executor then they cant press the button dont u forget 🙂
then you can just delete the message when the button is pressed
or disable the button
or close the view
or remove the view
@short relic
if message.content.startswith('.'): if message.content == 'Hii':
is there a way i can split .Hii to make the second if work?
sir like in this message i reply to you , i want to take you as input , how can i do that
?
!d discord.Message
class discord.Message```
Represents a message from Discord.
x == y Checks if two messages are equal.
x != y Checks if two messages are not equal.
hash(x) Returns the message’s hash.
!d discord.Message.reference
The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.
New in version 1.5.
@limber bison with this
and how can i edit voice chennal ? if i have channel id only ?
!d discord.VoiceChannel.edit
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
Changed in version 2.0: The `region` parameter now accepts [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") instead of an enum...
Wdym
did not see context
Yea I realised 😂 dw
like i have channel id !!
so whats my first step ?
Get VoiceChannel instance
!d discord.Guild.get_channel
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
Changed in version 2.0: `channel_id` parameter is now positional-only.
hello I tried to improve my ticket system by putting a system to add and remove users, but the add a user button does not work....
class AddUser(nextcord.ui.Modal):
def __init__(self, channel):
super().__init__(
"Ajouter une personne dans le ticket",
timeout=300,
)
self.user = nextcord.ui.TextInput(
label= "User ID",
min_length= 2,
max_length= 50,
required=True,
placeholder="Entrez l'ID d'un utilisateur."
)
self.add_item(self.user)
async def callback(self, interaction: nextcord.Interaction) -> None:
user = interaction.guild.get_member(int(self.user.value))
if user is None:
return await interaction.send(f"Utilisateur introuvable, êtes-vous sûr que l'utilisateur se trouve dans le serveur ?")
overwrite= nextcord.PermissionOverwrite()
overwrite.view_channel = True
await self.channel.set_permissions(user, overwrite=overwrite)
await interaction.send(f"{user.mention} à été ajouté au ticket.")
class TicketSettings(nextcord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@nextcord.ui.button(
label=":heavy_plus_sign:︲Add User", style= nextcord.ButtonStyle.green, custom_id="ticket_settings:green"
)
async def add_user(self, boutton: nextcord.ui.Button, interaction: nextcord.Interaction):
await interaction.response.send_modal(AddUser(interaction.channel))
@nextcord.ui.button(
label=":heavy_minus_sign:︲Remove User", style= nextcord.ButtonStyle.gray, custom_id="ticket_settings:gray"
)
async def add_user(self, boutton: nextcord.ui.Button, interaction: nextcord.Interaction):
await interaction.response.send_modal(RemoveUser(interaction.channel))
error? if yes, then what error?
what error?
I don't see any error in my terminal
There is the remove user button but not the add user button
Is it nextcord.ui.Modal or Model?
Modal
Ok
how is Modal Model
Idk nextcord, he might have made a typo
No I only have one
Modal
No you have two
💀 if you insist that you only have 1 then sure, we've told you
OV M'Y BAD
You were right 

I have tow fonction
But
I have another problem
When I enter the ID of a user it does not add it to the ticket
In the Modal
You get the user but u dont do anything else unless user is None
U indented wrong
Ye
everything after it is unreachable
yes'
Im very stupid and blind
Lmao dw it happens
😭 thanks you very much bro's
Np 😂 good luck
['do what', 'dude what', 'something starting with d (duh, dude, etc) why']
oh! and don't want of course
I still have the same problem 
code

class AddUser(nextcord.ui.Modal):
def __init__(self, channel):
super().__init__(
"Ajouter une personne dans le ticket",
timeout=300,
)
self.user = nextcord.ui.TextInput(
label= "User ID",
min_length= 2,
max_length= 50,
required=True,
placeholder="Entrez l'ID d'un utilisateur."
)
self.add_item(self.user)
async def callback(self, interaction: nextcord.Interaction) -> None:
user = interaction.guild.get_member(int(self.user.value))
if user is None:
return await interaction.send(f"Utilisateur introuvable, êtes-vous sûr que l'utilisateur se trouve dans le serveur ?")
overwrite= nextcord.PermissionOverwrite()
overwrite.view_channel = True
await self.channel.set_permissions(user, overwrite=overwrite)
await interaction.send(f"{user.mention} à été ajouté au ticket.")
any errors?
No 
Ignoring exception in modal <__main__.AddUser object at 0x000001E2AE0BA2C0>:
Traceback (most recent call last):
File "C:\Users\momoa\AppData\Roaming\Python\Python310\site-packages\nextcord\ui\modal.py", line 290, in _scheduled_task
await self.callback(interaction)
File "c:\Users\momoa\OneDrive\Documents\Time Is Money bot discord\main.py", line 501, in callback
await self.channel.set_permissions(user, overwrite=overwrite)
AttributeError: 'AddUser' object has no attribute 'channel'
I just got this error
How to do pagination of embeds using interaction?
same, but instead of ctx use interaction
But how to do pagination though?
uhm, there are a lot of different ways
I guess discord.py itself contains one
!d discord.ext.commands.Paginator
class discord.ext.commands.Paginator(prefix='```', suffix='```', max_size=2000, linesep='\n')```
A class that aids in paginating code blocks for Discord messages.
len(x) Returns the total number of characters in the paginator.
Okay
A simple layer over discord.ext.menus using the new discord.ui components in discord.py v2.0. - GitHub - oliver-ni/discord-ext-menus-views: A simple layer over discord.ext.menus using the new disco...
ohh he meant button pagination?
how can i get message author id?
literally message.author.id
🥲 me noob, don't judge
i did not
if i want to add it in a variable?
variable = message.author.id?
🥲 i forgot to use that variable in next line, so it shows error
so, how can i use variables in embed title?
title = ?
title = variable_name
and i can use + to add text to that?
use str(variable) to turn number into a string
!d discord.abc.User.mention
property mention```
Returns a string that allows you to mention the given user.
i can't understand 🥲
Show yr user object variable
just use example variables
in python
title = "User" and i want to print user name there
i know, that's why im here for help
Do u know about classes and objects?
Then use the get_user method for commands.Bot class to get an instance of discord.User class, then use the mention property
🤔
mention doesn't work in titles 👆
and in field?
yes, also in descriptions
and, how can i do that?
description=user.mention
it says user is not defined
.
user = bot.get_user(id)
or
user = guild.get_member(id)
you need members intents for both
oh
why doesn't my bot have a text about me in it even though I entered one?
from discord.ext import commands
client = commands.Bot(command_prefix = '.')
@client.command() async def ping(ctx): await ctx.send('Pong!')
it shows error 🥲
how can i get the channel id where the button interaction is detected
please send
- showing it would help
- im a compiler you need intents
that's the error
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
is this the correct code to purge ```py
channelinteraction = interaction.channel
channelinteraction.purge(limit = 4)
i did all this, and bot won't respond
are you getting an error?
what did you do in discord
If not, do you have an on_message event?
no
yes
😭
@bot.command() async def ping(ctx): await ctx.send('Pong!')
why won't this work? 🥲
.
channelinteraction = interaction.channel
channelinteraction.purge(limit = 4)
why is this not working 😭
it's a coroutine
Guys how we can edit message on button click?
!d discord.InteractionResponse
class discord.InteractionResponse```
Represents a Discord interaction response.
This type can be accessed through [`Interaction.response`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction.response "discord.Interaction.response").
New in version 2.0.
ok so how do i fix that...
check the doc, it has some edit_message method @robust fulcrum
await it
ok
await interaction.response.edit_message(embed=embed,view=self)
Is it correct?
channelinteraction = interaction.channel
await channelinteraction.purge(limit = 4)
still not working 😈
should be. You don't need to do view=self I think
Ok
- more code
y'all gotta learn how to get help
it has the correct indent i just mistype in discord and no error
!paste full code please
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.
Ok
error handler?
switch the positions of your button and interaction parameters
class ORDER416(discord.ui.View):
@discord.ui.button(label = "bam vao day de xac nhan don hang va tien hanh thanh toan", style = discord.ButtonStyle.success)
async def button_callback(self, button, interaction):
await interaction.response.send_message("dang tao don hang")
channelinteraction = interaction.channel
await channelinteraction.purge(limit = 4)
opener = interaction.user.name
user = interaction.user
guild = await bot.fetch_guild(907785823452278865)
mod = guild.get_role(951141051358388365)
overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages = False),
user: discord.PermissionOverwrite(read_messages = True),
mod: discord.PermissionOverwrite(read_messages = True)
}
ticket_channel = await guild.create_text_channel(name = "ticket cua" + "-" + str(opener), overwrites = overwrites)
await ticket_channel.send("don hang cua ban la 4 - 16 no gpu")
await ticket_channel.send("@short relic day ban vps ne con cho")
await ticket_channel.send(embed = paymentembed)
@bot.command()
async def delete(ctx):
if ctx.channel.name.startswith("ticket"):
await ctx.channel.delete()
else:
await ctx.send("this channel cant be deleted")
yeah probably
full code 😈
yeah itll raise a different error because the callback will be called with the wrong number of arguments
!d discord.ui.button
discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.
The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View "discord.ui.View"), the [`discord.Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction "discord.Interaction") you receive and the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button "discord.ui.Button") being pressed.
Note
Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
view, interaction, button
your parameter ordering is wrong ^
😈
wha do you mean 😈
read the doc
😭
yea but like no thing goes wrong
The function being decorated should have three parameters, self representing the discord.ui.View, the discord.Interaction you receive and the discord.ui.Button being pressed.
and see your function params
only the purge function is going wrong 😈
And how can I change button color on click?
ok dont listen to me, idrc
yeah that shouldn't work either
😭
🤨
button.style = ButtonStyle.danger()
im not sure if its style attr
you should recheck docs for that
i think im messing up with the purge so can i ask how do i delete a view instance
you delete the message
im just gonna delete the create button so people cant spam 😈
Bruh why sending this emoji are you gone mad? 😈
no you delete the message not the view
how can i get user nick name?
but its a button not a message 😭 how do i do that
you need a member object, not a user
member.display_name
the button is in a message
class ORDER416(discord.ui.View):
@discord.ui.button(label = "bam vao day de xac nhan don hang va tien hanh thanh toan", style = discord.ButtonStyle.success)
async def button_callback(self, button, interaction):
await interaction.response.send_message("dang tao don hang")
how bro theres only one message which is dang tao don hang and the button is not in any message 😭
do you not wanna delete the text just the button?
yea
its something like this
i want to delete that so people cant spam spam spam create ticket
you have to edit the message with view=None
or delete the message
await interaction.followup.delete() I think
!d discord.Interaction.followup
Returns the follow up webhook for follow up interactions.
ok ill tryy
hm, it's weird
its not working tho, how do i edit the button 😈
!d discord.ButtonStyle
class discord.ButtonStyle```
Represents the style of the button component.
New in version 2.0.
Ok
Thanks for help ☺️
does InteractionResponse.send_message return the message
!d discord.InteractionResponse.send_message
await send_message(content=None, *, embed=..., embeds=..., file=..., files=..., view=..., tts=False, ephemeral=False, allowed_mentions=..., suppress_embeds=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Responds to this interaction by sending a message.
yes it does
but the message doenst have the function to create ticket
the button does so i have to delete or edit it 👿
Is there a way to make my bot join voice and do Text-To-Speech with tts library?
sure
oh wait you just have to edit the original message
yesss how can i do that
I looked at this wrong
Interaction has edit_original_message
await interaction.edit_original_message(content="ticket created", view=None)
finally 😭
interections are so slow
is there a way to preserve variable data, like for balance
database
it stll not editing 😭
help? ;-;
https://sqlbolt.com is a good place to start with SQL. After that you can choose a database, find an async wrapper for it and you're good to go
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
class ORDER416(discord.ui.View):
@discord.ui.button(label = "bam vao day de xac nhan don hang va tien hanh thanh toan", style = discord.ButtonStyle.success)
async def button_callback(self, button, interaction):
await interaction.response.send_message("dang tao don hang")
await interaction.edit_original_message(content="ticket created", view=N
sadly no errro
so, i need to use SQL with python to save data?
what if it had the time to send the message but not to edit, but it won't raise anything cuz it responded afterall
or you have an error handler
SQL to communicate with the database to save and retrieve data efficiently and safely, yes
ohkk
no error but i think because the button isnt a message so it cant delete it
so can i just edit the label and function or basically just delete it
every view is sent with a message...
it's not just floating there on discord
use await interaction.response.defer()
cant you just ```py
message = await interaction.response.send_message("dang tao don hang")
await message.edit(view=None)
or just tell if you have an error handler already
that's not the message with the view
!d discord.InteractionResponse.defer
await defer(*, ephemeral=False, thinking=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Defers the interaction response.
This is typically used when the interaction is acknowledged and a secondary action will be done later.
This is only supported with the following interaction types...
use this at the start
oh yes you're right
i dont think i have that because every error is shown to my terminal
the last line is await interaction.edit_original_message(content="ticket created", view=None) right?
yea
do that before sending the message
or
await interaction.message.edit(view=None)
i tried but nothing happens, i think that is because the button is not in a message or sth
bro there are some changes now, the button stopped working
but it still not create the text channel
there's not even code for that
you tried using interaction.message.edit?
!d discord.Interaction.message
The message that sent this interaction.
it should work 🤷
class ORDER48(discord.ui.View):
@discord.ui.button(label = "bam vao day de xac nhan don hang va tien hanh thanh toan", style = discord.ButtonStyle.success)
async def button_callback(self, button, interaction):
await interaction.message.edit(view=None)
await interaction.response.send_message("dang tao don hang")
discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message
what do you mean it stopped working
like after i pressed the button nothing happened
its nearly what i want but i want it to stop working after it is pressed once and the ticket is created
then there's nothing else on the message you're trying to edit
only a view
yeah the message has to have content...
in which case you should delete it instead
or pass content
you could also just stop the view with self.stop() but that won't remove the components
Oh my gosh, I have to recode almost all of these..
How can i add message content in it tho because it is a subclassed view
await interaction.message.edit(content="I'm the content", view=None)
it either has a view or a content
or both, but one of them at least
I have a ban command but how do I make it so that someone can also use a user ID or display name? Like ".ban zzy#0001 my reason" or ".ban 165023948638126080 my reason"?
@commands.has_permissions(ban_members=True)
@bot.command(aliases=['b', 'banuser', 'banmember'])
async def ban(ctx, member:discord.Member, *, reason=None):
if not reason:
reason = "No reason provided"
else:
pass
Should work as is
how can i make it so that it will do something like this
id = ctx.user.id
ctx.send(<@id>)
but the <@> and the id arent the same type so how can i do that
ctx.author.mention
!d discord.Member.mention
property mention```
Returns a string that allows you to mention the member.
can anyone help
^
helloo
i have a question so i have a token in an .env file and i want to use it how can i?
client.run(TOKEN)
can we do this]
has anyone used a virtual input program to pipe sound into a discord voice channel? I have voicemeter, and I'm using the python module playsound to play audio clips, but I haven't been able to get it to pipe the python sound into discord
import os
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")```
thanks
I'm building a virtual assistant script, and every part is built except the part that pipes the audio into the discord voice channel
name of my dotenv file is lol.env
it shouldn't matter what your file name is for load_dotenv() to find it, it just needs to be in the same directory
hm
and i have another question
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
if reason==None:
reason="no reason provided"
await member.kick()
kick_messages = ["Pichu used charm to kick ", "Pikachu used thunder shock to kick ", "Raichu used walt switch to kick ", "Squirtle used water gun to kick ", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}",
"Venusaur used solar beam to kick ", "Charmander used Flame thrower to kick ", "Charmeleon used metal claw to kick ", "Charizard used inferno to kick "]
await ctx.send(f'{random.choice(kick_messages) + " " + (member.mention)}')
client.run(TOKEN)
i want so that every random reason there is {member.mention}
dotenv.load_dotenv("lol.env")
without the filename in the call, it will read only .env file
please tell
ADD F before " in the strings
then itll work?
YES.
so ill be doing this?...
await ticket_channel.send("don hang cua ban la 4 - 8 no gpu")
interaction.user.mention
await ticket_channel.send(embed = paymentembed)
yes
but inside the send's content kwarg
So its send(content = interaction.user.mention)?
await send(f"Hi {interaction.user.mention}")
Btw whats f and {} do
can someone send me the discord py inv?
how do I check if a member is timed out?
plss
^
yo can anyone help me
with what
i am making a rickroll bot to troll kids
your token is invalid
import random
from discord.ext import commands
TOKEN = 'O
client = commands.Bot(command_prefix='!')
@client.event
async def on_ready():
print('{client.user} is on')
@client.command
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
if reason==None:
reason="no reason provided"
await member.kick()
kick_messages = [f"Pichu used charm to kick ", "Pikachu used thunder shock to kick ", "Raichu used walt switch to kick ", "Squirtle used water gun to kick ", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}",
"Venusaur used solar beam to kick ", "Charmander used Flame thrower to kick ", "Charmeleon used metal claw to kick ", "Charizard used inferno to kick "]
await ctx.send(f'{random.choice(kick_messages) + " " + (member.mention)}')
client.run(TOKEN)
generate a new one
alr
@hearty timber can you send me the discord.py server link?
comand not working
show me the error
client.command()
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "kick" is not found
idk myself
thanks :)
put @commands.has_permissions(kick_members=True) above @client.command
ok
hm
that doesnt matter
ayeeeeeeeeeeee tyyy finally worked but there are 2 spaces between
nothing
ty everyone
@commands.has_permissions(kick_members=True)
async def whois(ctx, member : discord.Member()):
embed = discord.Embed(title = member.name , description = member.mention , color = discord.Color.green())
embed.add.field(name = "ID", value = member.id , inline = True)
await ctx.send(embed=embed)
client.run(TOKEN)
error -Traceback (most recent call last):
File "c:\Users\Dell\Desktop\LEARN BO\afasasa.py", line 27, in <module>
async def whois(ctx, member : discord.Member(), data, guild, state):
TypeError: Member.init() missing 3 required keyword-only arguments: 'data', 'guild', and 'state'
I have a question: Im trying to display a message whenever someone adds my bot to my server. It works in my bot support server but when I added it to one of my friends server it gave me this message discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions Whats going on?
ok'
that means the bot dosent have permissions to send the message
But shouldnt it be able to? I already set the permission to send messages inn a server in the discord developer portal
@commands.has_permissions(kick_members=True)
async def whois(ctx, member : discord.Member()):
embed = discord.Embed(title = member.name , description = member.mention , color = discord.Color.green())
embed.add_field(name = "ID", value = str(member.id) , inline = True)
await ctx.send(embed=embed)
client.run(TOKEN)
```
same error
ok
async def birthday(birthdays, user):
if not str(user.id) in birthdays:
birthdays[str(user.id)] = {'birthday': None, 'age': 0}
async def add_birthday(birthdays, user, birthday):
birthdays[str(user.id)]['birthday'] = birthday
birthdays[str(user.id)]['age'] = (datetime.datetime.now() - birthday).days // 365
Is this good enough?
why would you need to make these function async?
idk
async def birthday(ctx, birthdays, user):
if not str(user.id) in birthdays:
birthdays[str(user.id)] = {'birthday': None, 'age': 0}
await ctx.send(f'{user.mention} has no birthday set, Please add one using the command `!setbirthday <date>`.')
async def set_birthday(ctx, birthdays, user, birthday):
birthdays[str(user.id)]['birthday'] = birthday
birthdays[str(user.id)]['age'] = (datetime.datetime.now() - birthday).days // 365
await ctx.send(f'{user.mention} birthday has been set to ().')
Is this good enough 🤦♂️
now you need async because ctx.send has to be awaited
Bruv
also wth is bitrhday has been set to ()
I have to figure out something for that
good?
well, if birthday's type is datetime.datetime, then good enough
@client.command()
@commands.has_role('General Officer')
async def mute(ctx, member: discord.Member):
mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")
await member.add_roles(mutedRole)
await member.send(f"You have been temporarily muted in **{ctx.guild.name}** by user: **{ctx.author}**.")
embed = discord.Embed(
title = "Server Mute",
description = f"Successfully muted {member.mention}.",
color = 0xe74c3c #RED
)
embed.set_footer(text = "Think this is a mistake? Open a ticket. - USAF Logging")
await ctx.send(embed=embed)
channel = client.get_channel(999759936122794017)
embed = discord.Embed(
title = "Moderation Notice",
description = f"{ctx.author} has used the command: **MUTE** on {member.mention}.",
color = 0x3498db
)
embed.set_footer(text = "USAF Logging | Developed by joshhh.#2142")
embed.set_thumbnail(url = "https://media.discordapp.net/attachments/886694502566330440/1000160324160340018/AFHQ.png")
await channel.send(embed = embed)
I have made a simple mute command. However, every time I execute this in Discord, I get an error saying this.. even though the bot has Administrator perms.
Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
Your bot's role also must be above the mute role in role hierarchy
It's not tbh
Ahh I see. Let me try that.
then you cannot do this operation
@silk fulcrum Works like a charm now! Thanks so much. :)
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Would the permissions have be set to send messages in the server in order for the bot to send the message on join or would the bot have to have the send message command because the bot already has a send message permission
either the bot doesn't have permissions to send a message to the channel you want it to or the bot doesn't have permissions to send messages at all
one thing you can do is check the permissions available when it joins a server (on_guild_join) and just make the bot leave the server if it doesn't have sufficient permissions
ah ok! is there is specific code for me to implement to make it leave a server?
anyone here know how to make a discord bot
did you mean everyone?
A learning guide for the discord.py bot framework written by members of our community.
and if you are new to python then use !resources
so i am trying to get my bot to ban using both pings and/or a user id for member that are not in the server, is this possible?
Yup, and it’s very easy
when i use await user.ban(user) or member.ban(member) itll spit out an error saying (id) not found
Could I see the code?
why would you pass user inside of user.ban or member inside of member.ban
that just doesnt make sence?
Oh you want to ban members not in the server
its probably really bad i am not very good at python
Typehint to discord.User
yea, i got dmed by a scam bot and i wanna use it to set this up
: discord.Member => : discord.User
That’s a problem with replit
The projects share an IP address so if one gets ratelimited everyone does
It should be await ctx.guild.ban(user, reason=reason)
ban*
Yes typo
or await user.ban(reason=reason) iirc
That won’t work for non guild users
if user is discord.Member of course
Yes
im trying to ban a non member
Then this
its not working still
typehint user as discord.User
this?
Yes
that was there before
are you sure you saved file, restarted the bot?
@bot.command()
@mods_or_owner()
async def slowmode(ctx, arg1: int):
await discord.TextChannel.slowmode_delay('arg1')
await ctx.reply("Set channel's slowmode to " + str(arg1) + " seconds!")
Is
code good for setting slowmode in a channel?
also, if i want to send a dm with the server the command was sent in (for example; "you have been banned in server. reason = [reason]") how would i do that
Should be user.send but it can not work for a multitude of reasons to expect it and catch it
dammit i just realized that my unban cmd dosent work
it unbans everyone in the member list instead of just the id i provide
no
How its correct
sdljhfklgdjlihk
its getting all the members in the list and unbanning all of them
but i dont know how to just do id
Why not just pass in the discord.User instance to the unban method? It should be an one like function
1: discord.TextChannel is not possible like that in code
2: you are doing 'arg1' in setting slowmode delay so it will not be set to arg1 but to string 'arg1'
3: f-strings exist, instead of that "..." + arg1 + "..." stuff
^ slowmode_delay isn't a method, it's an attribute. You have to use TextChannel.edit(slowmode_delay=...) to change the value
how do i do that
Typehint to discord.User, pass that instance into unban, easy peasy
!intents you said you had the ID not found error; might be an intents issue
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
||i am beyond awful at python i dont know what that means||
@bot.command
async def unban(context: commands.Context, user: discord.User, ...) -> None:
await context.guild.unban(user)
pretty simple unban command
i changed that so it sends messages if an id is not present and it sends a message and it still unbans all users in the list
Meaning? It worked?
What do you mean by clear the list
unbans all members on the list
I think the best way is to make a Converter BannedMember and get user: Union[BanEntry, BannedMember]
You can check the length of the argument
or Annotated instead of Union
!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.
how i fix this, AttributeError: module 'discord' has no attribute 'ui'
install dpy 2.0
Does Discord.py realy support slash commands?
I have it installed, but not mutch documentation about it
Yes it does
!d discord.app_commands.AppCommand
class discord.app_commands.AppCommand```
Represents a application command.
In common parlance this is referred to as a “Slash Command” or a “Context Menu Command”.
New in version 2.0...
how do i install the version?
Ah dope! Thanks for youre answer!
Gonna look into it in more depth tomorrow
pip install git+https://github.com/Rapptz/discord.py
pip install git+https://github.com/Rapptz/discord.py
i dont have git so how i install git?
On windows in my case:
py -m pip install git+https://github.com/Rapptz/discord.py
install git
pip install git i think
Oh w8 youre right
My bad
Think i used this one
We bring the awesome Git VCS to Windows
this or what?
https://git-scm.com/download/win Or thisone
DOwnloaded that, idk for sure withs page
i try
If it doesnt work, you can ping me!
How Can i do a statu for thé bot ?
@client.command()
async def birthday(ctx, *, member: discord.Member):
if member == None:
member = ctx.author
with open("D:/Desktop/Haryad Bot/data/birthdays.json", "r") as f:
birthdays = json.load(f)
if str(member.id) in birthdays:
await ctx.send(f"{member.mention}'s birthday is {birthdays[str(member.id)]}")
else:
await ctx.send(f"{member.mention} has not set a birthday")
When I do ?birthday it gives me missing arguments error
Did you provide it with a mention?
You also shouldn't need the *, if you're only giving it one mention
i installed it, do i need to enter a command or open something?
No, Isn't that what I'm trying to avoid?
You have to provide a default value of None for member
At terminal: py -m pip install git+https://github.com/Rapptz/discord.py
git bash, or the cmd?
is there a way to the bot to send an txt file without the need to have the file saved locally?
CMD 🙂
!codeblock
I did it in terminal in VScode
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.
Just a tip, you don't need to specify the absolute path for the json file to open()
If you want the member argument to be optional, you need to give it a default value
@client.command()
async def birthday(ctx, member: discord.Member = None):
import asyncio
import re, ast, inspect
from discord.ext import commands
client = commands.Bot(command_prefix=';', help_command=None, case_insensitive=True, intents=discord.Intents.all())
embed = True
timeout = 1
@client.event
async def on_ready():
print("online")
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"]
client.run("token")```
imagine having to worry about cwd
not an code block, because there is a limit of characters
can someone help?
A file has to exist for you to send it
Yep
oh, i asked because in discord.js had it
it worked, so git and the v2 version is now on it?
Where is this text file though?
thanks
Instead of
async def birthday(ctx, *, member: discord.Member):
if member == None:
member = ctx.author
you can write
async def birthday(ctx: commands.Context, member: discord.Member | commands.Author) -> None:
...
??
!d discord.discord.ext.commands.Author
discord.ext.commands.Author```
A default [`Parameter`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Parameter "discord.ext.commands.Parameter") which returns the [`author`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.author "discord.ext.commands.Context.author") for this context.
New in version 2.0.
wtf is commands.Author
wtf
wtf is discord.discord
Their fault
i want to send a string as a text file, example:
string = "extremely long text"
send string as .txt
It's this
yeah
is this normal? when i start the bot
can someone help me rq?
You can do something like
string = "extremely long text"
with StringIO(string) as string_io:
await messageable.send(file=discord.File(string_io, "message.txt"))
provided you have from io import StringIO
You can use a StringIO object
from io import StringIO
text = StringIO("my string with fun text")
...
file_to_send_to_discord = discord.File(text, filename="filename.txt")
It's impractical, ctx.author already exists I mean why the extra stuff
There are Parameter for other stuff, too
thank you guys!
aTodays also my first time with 2.0
It's for the type hinting when you want to use the author of the command as a default value for the argument
does that problem only appear in the docs
please tell me that's not a completely different commands
I guess it's for metadata
Nah that's a weak argument
Its primary function is to add extra metadata to command signatures and stuff
I don't think it's any faster
It's slower. No doubt about it. But that's not the point
ext.commands is so bloated
Well, I doubt it removes the argument from the use string of the command in the help command
Doing =None does
time to make an own discord API wrapper
Been wanting to do that for a while now
One that is more REST-friendly and has a simpler internal design
too lazy, I'll leave this for later, if it makes sence tho
I mean Hikari already nails the REST-friendly part, but it's extremely modular to the point where it can be hard to use
What does it mean to be REST-friendly
Well having the option to use a REST-only client
Or a client that exposes those methods
I mean for example if you have to edit a channel when you only have the ID, you have to first fetch it and then use .edit()
With discord.py's current design, the solution for this issue is just to add classes so that you can construct a partial version of these objects so you can make those api requests. The issue is that they are a pain to implement and PartialMessage is the only one that exists
That’s why there’s lightbulb
I have this 🙂
Lightbulb implements a command framework for Hikari, it's not a standalone lib
I mean why did you even mention lightbulb lol
It wasn't relevant to the discussion whatsoever
yikes we don't help people with malicious intent
Man thought you meant like a fake nitro ( to log)
I’m not saying who (unless required to) someone here is tryna make a logger 🗿
In short you can't
you can?
You can just send the link to a fake nitro
button is just filled with empty symbols to left and to the right
Y’all thinking too small to log… become like the unspoken person and be creative when logging
what does "to log" even mean according to you
No offense but that’s a dumb question regarding what we was talking about
None taken, I just don't know what you're even talking about
I am giving hints on the dude who’s tryna log people
(If you reading this and decided to delete our dm, that would do you much worst)
I genuinely still have no idea what you're saying
Let’s just say it’s best to pay attention to peoples questions and notice what they do and don’t know
As what they say can actually mean for something else
How do i connect to my vps
You're speaking broken English, I'm still lost
what do you guys use? to connect to your vps
I’ll make it blunt. We got a skid here who’s tryna make a “discord verification bot” to log Roblox kids by making them think they need to log-in to verify themselves
how can i add buttons to embed ?
should i install another lib ?
or its in discord.py ?
should i use discord.py or disnake?
Version 2.0 I think
pip install git+https://github.com/Rapptz/discord.py
pip install discord2 // this will work ?
Use this in your terminal
after updating my python am getting a error on this line
bot = commands.Bot(command_prefix = "-")
..and what's the error?
Traceback (most recent call last):
File "main.py", line 4, in <module>
bot = commands.Bot(command_prefix = "-")
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
i never use intents , but everything work fine ! how ?
i use client word
not bot
is Bot a class / object ?
i just got a massive error after doing this
do i have to change my whole script after updating?
It's a class
With proper commands, error handling, etc.
I was talking to @inner perch, sorry
Traceback (most recent call last):
File "main.py", line 71, in <module>
bot.run(TOKEN)
File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 877, in run
But if you're just asking a question, you may be on an old version where intents are not required
Can you post the full error?
old mean 1.7 something ?
🤔 ohhh k lul i use client everywhere
Traceback (most recent call last):
File "main.py", line 71, in <module>
bot.run(TOKEN)
File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 877, in run
asyncio.run(runner())
File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 852, in runner
await self.start(token, reconnect=reconnect)
File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 786, in start
await self.connect(reconnect=reconnect)
File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 717, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Right
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Might be a good idea to follow what the error says
pip install discord2 // is this new version ?
It's not on pip
where ?
See the github homepage to see how to install the dev version (2.0)
Variable names don't matter, but they should be sensible.
If you are instantiating a "bot" from commands.Bot, you should name your variable accordingly (bot).
If you are instantiating a "client" from discord.Client, you should name it client or something.
I'm having a weird issue getting my bot to start. I'm trying to adapt the advanced start-up example (https://github.com/Rapptz/discord.py/blob/master/examples/advanced_startup.py#L84-L90) to work with my codebase but I keep getting a py Traceback (most recent call last): File "C:\Users\Teagan\Documents\Coding\FAQ\main.py", line 29, in <module> client = FAQ_Client( TypeError: FAQ_Client.__init__() missing 1 required positional argument: 'web_client' and my code is https://github.com/SnowyJaguar1034/ModMail-FAQ/blob/master/classes/faq.py#L68-L83. I did just check I have the latest version as I last updated around a month ago, updating to the latest has not fixed my problem. (Discord.py 2.0)
@limber bison run this in your terminal
It installs the version that's on https://github.com/Rappts/discord.py
ohhh got it , bot are same right ? like any big difference ?
I believe commands.Bot subclasses discord.Client
It has a better suited API for developing Discord bots
commands.Bot and discord.Client are not the same, commands.Bot extends discord.Client so it has everything client has + A LOT more features and is generally better
I dont see any option to enable it?
If you can't enable the privileged intent for your application on Discord Developer Portal, it means Discord won't allow you to use it for the application anyway
You'd have to request the use of the specific privileged intent
And you also need to have your bot verified
o
Aside from top.gg, are there any other discord bot websites where you can vote for your bot?
discord.bots.gg and blist.xyz
I have a question
I have @app_commands.checks.has_any_role('Admin', 1002211217349300294)
This limits who can use the slash command.
But can i send instead of "The application did not respond":
You can't access this command?
I want to creat a commane and shere in a room what A website share
but i don't know how
How do I make a Slash Command? (reply please!)
Install latest discord.py version, it supports slash commands
And I assume u use @app.command?
Yeah
I hope to get the "application badge" that bots can get
and I assume that the format is like normal commands?
like @client.cmmand or whatever
what he wants to say ?
Migrating to discord.py 2, you need to change load_extension(...) to await load_extension(...) and so on
There's a page in their documentations website about all the things you need to change
plsss plsss gimme link
This is the documentations website's index page: https://discordpy.readthedocs.io/en/latest/index.html
This is the page about migrating: https://discordpy.readthedocs.io/en/latest/migrating.html
thanksss
🥲
uff
to much changes
