#discord-bots
1 messages · Page 248 of 1
why am i not not eligible for the Active Developer Badge although i have slash commands?
You have to claim it in dev portal
it says i am not eligible
Used slash command?
works on server of 3 ppl?
Doesn't matter
Have you ever made a bot before?
I still can't memorise what order each lib has haha
You want the ready code or you want to learn how to make one?
used all commands bus still not eligible
You sure you did all the steps:
- create application on dev portal
- invite the bot to your server
- code and run the script
- use any command and make sure it responds
Ready code
Github is the way to go then
Yeah oka
can u help me guys, my bot cannot leave the voice channel if the voice channel's name contain emoji on it. i'm just start learning to make discord bot
here is the code :
client = commands.Bot(command_prefix = '!', intents =discord.Intents.all())
@client.event #starting the bot
async def on_ready():
print("success : now bot is connected to discord")
@client.command()
async def join(ctx):
if ctx.author.voice is None:
await ctx.send("you are not in a voice channel")
channel = ctx.author.voice.channel
if ctx.voice_client is None and "mig" not in channel.name:
await channel.connect()
await ctx.send(f"joined {channel}")
else:
await ctx.vocie_client.move_to(channel)
await ctx.send(f"moved to {channel}")
@client.command(name='leave')
async def leave(ctx):
voice_client = ctx.message.guild.voice_client
if voice_client.is_connected():
await voice_client.disconnect()
await ctx.send('Bot left the voice channel')
else:
await ctx.send("The bot is not connected to a voice channel.")
Any errors?
no error
yes
but still cannot leave the voice channel
You refreshed the page?
Make sure you are using this account on dev portal too
Literally no output at all?
yea
It should either throw an error (unless your error handler is too hungry and eats them) or respond with "not connected to voice channel"
That's weird
Bro what it blocked discord devs server invite
Cmon the heck
@hollow osprey why is it blocked tho
👍
what should i do
Go to this server and ask in channel dedicated to dev badge, they might help you more since it doesn't seem to be code issue
Anyone got a ticket bot with buttons i can get
thats an event
you use it as all events
examples/basic_bot.py lines 19 to 21
@bot.event
async def on_ready():
print(f"Logged in as {bot.user} (ID: {bot.user.id})")```
Yeah i knwo but i want ...
here is example event called on_ready
make it
if you want to use that event in a cog instead main file you can use @nextcord.ext.commands.Cog.listener() decorator
I want to return it likely so for the logs
!pastebin
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.
im not good at coding python
on_command_completion only has ctx obj as param its likely thats only for normal commands
slash command may have another event
gist of it is no different from on_ready except it has a positional parameter
it might be better to start with simpler projects to build up your skill set then
yeah okayy
also python is not the only language that can be used so if u know other languages feel free to use them
Im only good at LUA
say less
Anyone here that deploy a discord bot throughout docker before?
burp
I'm stuck with an error called open /dev/ptmx: no such file or directory
I made a ticket discord bot and when a user opens a ticket, i made a code so there is a close button, but there's not one. There is no errors.
send your code?
do you want to add the button after user selects?
might have to subclass your views
or define another callback for it
i want it here
attach another view with the button to that message then
you didn't do that in your message
i have an error
Traceback (most recent call last):
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/ui/view.py", line 427, in _scheduled_task
await item.callback(interaction)
TypeError: ticketcallback() got an unexpected keyword argument 'view'
your ticket callback didn't define any kwargs
wdym
async def ticketcallback(interaction):
yeah?
i didnt change something there
the only thing i did
is
in async def ticket(ctx): i replaced button.callback = ticketcallback with button.callback = partial(ticketcallback, view=View(timeout=None))
should i do async def ticketcallback(interaction, view):?
you should make a new view anyway
same error but on different function
Traceback (most recent call last):
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/ui/view.py", line 427, in _scheduled_task
await item.callback(interaction)
TypeError: ticketcallback() missing 1 required positional argument: 'view'
i cant find ```
await item.callback(interaction)```
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: open /dev/ptmx: no such file or directory: unknown.
Anyone can help me with this?
Dockerfile error
what view=?
in your function call
which one
ok I think you didn't change your select callback
forget about all these things first
k
revert this
and make a new view with the cancel button attached to message in channel.send
button = Button(label="❌ Close", style=discord.ButtonStyle.red)
async def close_callback(interaction):
await channel.delete()
await interaction.response.send_message("Ticket closed successfully.", ephemeral=True)
button.callback = close_callback
view.add_item(button)
isnt this working?
no
i fixed the "this interaction failed"
firstly, you added the button before the view is even defined
but theres no button
second you have to attach the view to your message
they are different messages
the one sent by the command and the one sent once a ticket is created
so you have to attach another view
delete_view = View()
delete_view.add_item(button)
.
.
.
await channel.send(..., view=delete_view)
so should i attach it to this somehow?
yes
should i add the button = ... inside the function?
button = Button(label="❌ Close", style=discord.ButtonStyle.red)
async def close_callback(interaction):
await channel.delete()
await interaction.response.send_message("Ticket closed successfully.", ephemeral=True)
delete_view = View()
delete_view.add_item(button)
.
.
.
await channel.send(..., view=delete_view)
like that?
If you expect it to work with those ... I'd be interesting
Those are called embeds
You make an instance of discord.Embed and pass it to the embed kwarg of Messageable.send
!d discord.Embed
class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
x == y Checks if two embeds are equal.
New in version 2.0...
Supporting documentation ^
the picture on the top right of that embed seems redundant
yea ik
if codeblocks are also perfectly parsed, then it's perfectly fine
*cti py print("hello world!")
try C#
ah, I get it, the first argument of the command is the language
and all that follows is the code, so I want to see that in codeblocks
if it shows it parsed correctly in the image, then you're all set I guess
that's not in codeblocks though
+cti c#
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}```
if you want to copy it exactly:
+cti c#
```
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
```
what was the actual command?
anyways, remove that thumbnail too (top right)
dont even know what that is
this is a codeblock
here is what it looks like
here is what I actually typed
!codeblock
is it even useful ??
ofcourse it is
just on discord dude
print("Isn't this a lot more readable code?")
class Poop:
def __init__(self, person_pants):
# ...
instead of this terrible thing
print("Isn't this a lot more readable code?")
class Poop:
def init(self, person_pants):
# ...
well, your command is too... right?
yes but wdc on the image its right soo
just the command is unreadable but the ilmage result is ok
it's your command, I mean, you can at least try and see if codeblocks get parsed correctly...
poop your self 😔
it dosent i sai you
fixed
said
I would definitely add that
i personally dont, ik i asked if it missed something but its a way more practical to just copy paste the code instead of puting the "`````", the code name, close it, its long dude
definitely not for developers, I'm also quite sure this is messed up if you were to do it on mobile
bro who codes on mobile
you'd freak out if you were to see some forum screenshots...
anyone knows how to fix this from happening
[2023-06-02 19:41:13] [WARNING ] discord.gateway: Shard ID None heartbeat blocked for more than 10 seconds.
if you provide full code i'll be more able to help you m8
fixed it
they told me requests was being blocked
and to replace it if aiohttp
Hello, I need suggestions for commands for my discord bot. My server is about a Roblox game studio. So far I got these commands.
an anounce command
to make an announcement
Ok any others?
yes
auto mod]
kick command
time out command
and un time out command
clear command
to purge the messages
I already use wick for moderation so I don't any moderation commands currently. I might switch over some day but Wick is good at moderation.
oh. ok
no
ok
hello
i got alot basics ones
ok
these are easy, practical and a little bit inovating (+cti, +ld, +lock)
indeed ty
Either, you can ask GPT for creative commands
oh good idea
yea
forgot about that 💀
i dont, nice for homework 💀
thats usefull fr
You will not get help to violate Discord's Terms of Services, automating your user account will lead to your account getting terminated by Discord.
Hello, I'm trying to handle buttons with "discord.ui.view" but I can't combine them with "cogs", how can I do this with both classes?
what do you mean you cannot combine them with cogs? Views and Cogs are completely seperate things
Maybe I'm explaining myself wrong but I'm having trouble using both, I have a button on an embed but when I click on it the interaction fails
how are you responding to the interaction?
Hello I need some help, in my on_member_join function I am tracking invites and also sending a welcome embed
Until now I didn't have the welcome embed implemented, and invite tracking was working fine. Right after adding welcome embed, it works fine, but the invite tracking isn't working.
I tried to remove the welcome embed and then test the invite tracking and it worked
I'm not sure how the welcome embed is breaking the invite tracking because it doesn't have any errors, nothing in the console, the invite tracking embed just doesn't send
please show us "code that works" vs "code that doesn't work" in 1 link
You're everywhere
I saw a message in the discord.py server from 2 years ago and noticed you were there as well haha
I'm in quite some help servers, that's a fact
not true
experience-wise I just have seen a lot of dpy.
and since 80% of these questions are for beginners, it's not hard
i am ever-present and none-knowing
And I'm never-present and none-knowing
what language is in your profile picture
i can't figure it out
Mix of Python and JS with a higher emphasis on Python
if sad() == true:
OOP at it's max
that true is the only reason I have to add JS 😭😔
Create models per guild, using guild id as primary key to distingue guilds
basically i can't set the channel id due to this failing row
The select option works well in discord, but when I click the select menu in the option, it says 'The interaction failed' from bot. may i know what i missing?
a cool thing would be to have a setup command that server owners can run where you could run something like !welcome setup Welcome {mention}! You are the {number} member to join the server! and it would add the guild id and message to the database, then when a member joins it could say something like py await member.send(welcome_message.format( mention=member.mention, number=f"{guild.member_count}th" )) and the output would be ```
Welcome @mudkip#0001! You are the 167th member to join the server!
Can you print self.values
where are you calling variable_selects
i changed the name variable_selects to callback and its working now
Sounds about right
@client.tree.command(name="anti-spam-on", description="blocks spamming from your server")
@app_commands.default_permissions(manage_guild=True)
async def antispam_on(interaction: discord.Interaction, mute_duration: int):
##with open('server-block.json','r',encoding='utf-8') as f:
#key = json.load(f)
#key[str(interaction.guild.id)]=str("on")
#with open('server-block.json','w',encoding='utf-8') as f:
#json.dump(key,f,indent=4,ensure_ascii=False)
key = db.keys()
if f'1 {interaction.guild.id}' in key:
pass
await interaction.response.send_message("Anti spam is already on")
else:
db[f"1 {str(interaction.guild.id)}"] =str(mute_duration)
await interaction.response.send_message("Anti spam is on")
channel2 = client.get_channel(1112053260879147130)
await channel2.send(f"anti-spam-on command used by {interaction.user}")
@client.tree.command(name="anti-spam-off", description="Stops blocking spamming you have it on")
@app_commands.default_permissions(manage_guild=True)
async def antispam_off(interaction: discord.Interaction):
#with open('server-block.json','r') as f:
#key = json.load(f)
db[f"1 {str(interaction.guild.id)}"]
key = db.keys()
if f'1 {interaction.guild.id}' not in key:
pass
else:
#del key[f'{interaction.guild.id}']
del db[f"1 {str(interaction.guild.id)}"]
#key['off']='off'
##with open('server-block.json','w') as f:
#json.dump(key,f,indent=2)
await interaction.response.send_message("Anti spam is off")
channel2 = client.get_channel(1112053260879147130)
await channel2.send(f"anti-spam-off command used by {interaction.user}")
``` On the first command im storing the mute_duration in the db
author_id = message.author.id
# Get current epoch time in milliseconds
curr_time = datetime.datetime.now().timestamp() * 1000
# Make empty list for author id, if it does not exist
if not author_msg_times.get(author_id, False):
author_msg_times[author_id] = []
# Append the time of this message to the users list of message times
author_msg_times[author_id].append(curr_time)
# Find the beginning of our time window.
expr_time = curr_time - time_window_milliseconds
# Find message times which occurred before the start of our window
expired_msgs = [
msg_time for msg_time in author_msg_times[author_id]
if msg_time < expr_time
]
# Remove all the expired messages times from our list
for msg_time in expired_msgs:
author_msg_times[author_id].remove(msg_time)
# ^ note: we probably need to use a mutex here. Multiple threads
# might be trying to update this at the same time. Not sure though.
if len(author_msg_times[author_id]) > max_msg_per_window:
key = db.keys()
db[f"1 {str(message.guild.id)}"]
if f'{message.guild.id}' not in key:
pass
duration = datetime.timedelta(minutes=db)
embed = discord.Embed(title="User muted", description=f" {message.author.mention} has been muted", color=discord.Color.blue())
embed.add_field(name = "Reason",value = "spamming")
embed.add_field(name = "Mute duration",value = f"{duration} minutes")
await message.author.timeout(duration)
await message.channel.send(embed=embed)
``` how can i put it the duration
nvm
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.
I would like a role to be tagged as a required field when making a slash command. I tested a way earlier this week but can’t remember exactly my error but I know I was having some issues. I would like team:str to be a required ROLE from the sever
‘’’Python
@client.tree.command(name="snakes", description="Find the ladders and watch out for snakes!")
async def Game(interaction: discord.Interaction, team: str):
‘’’
team: discord.Role
what is this ?
A timer going down
how to use it?
Also
up..
Down
Once it reaches 0 it still goes down in negative
Hence the "xx seconds ago"
Yes the number of seconds elapsed after 0 goes up, which is basically front-end only, though the timer itself continues going down
It doesn't do
3
2
1
0
1
2
3
Code that works: https://paste.pythondiscord.com/gicadacuja
Code that doesn't work: https://paste.pythondiscord.com/udoruwatuy.py
So after I added the welcome embed in the start everything invite related stopped working, if I remove it, it works again
Edit: Nevermind I figured it out
I changed my bot's name and suddenly discord says I am requesting intents I did not enable?
wth
nvm I did something stupid lol
how can i add !close to my ticket bot?
ik its wierd but someone can come in my server and just test my bot for a few minutes, ask MP please
async def suggest(interaction: discord.Interaction, title: str, suggestion: str):
suggestion_channel_id = 1106959842901504060
suggestion_channel = bot.get_channel(suggestion_channel_id)
if suggestion_channel is None:
print(f"Could not find channel with ID {suggestion_channel_id}")
return
embed = discord.Embed(title=title, color=discord.Color.blurple())
embed.add_field(name="User ID", value=str(interaction.user.id))
embed.add_field(name="Suggestion", value=suggestion)
suggestion_message = await suggestion_channel.send(embed=embed)
await suggestion_message.add_reaction(':white_check_mark:')
await suggestion_message.add_reaction(':x:')
await interaction.response.send_message("Your suggestion has been submitted!")
Quick question, instead of the user Id, How would you make the username and tag of the person who used the command appear on the top with there pfp. Like carls suggestion command if you have seen it
Please don't joke about things like this. I'd suggest you delete that.
I Have a problem
i made a ticket bot, but there is no button to the text to open a ticket
no button
the problem is what did you use pycord or discord_components?
the problem is, i used ctx to send the message, but then changed it to embed
it was working with the ctx
can i see the code
!paste
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.
@bot.command()
async def ticket(ctx):
button = Button(label="Ανοίξτε ένα ticket.", style=discord.ButtonStyle.green)
button.callback = ticketcallback
view = View(timeout=None)
view.add_item(button)
embed2 = discord.Embed(title="TICKET", description="Ανοίξτε ένα ticket χρησιμοποιώντας το menu παρακάτω.")
await ctx.send(embed=embed2)
ill show u only this part
oh
or just do liek this
the customer said embed
Ανοίξτε ένα ticket χρησιμοποιώντας το menu παρακάτω. like this.
wdym
try
wait lemme show u the whole code
!paste
wait a sec
@slate swan https://paste.pythondiscord.com/udacopunus
try
k
ohh
u forgot #
whar
what i forgot?
LOL
i think you made a lil mistake
or just
decode the lin of Choose an option below.
wym
idk why my python doesnt work
LOL
i tried but it didnt work.
better discord?
^^ anyone know?
Try using docker compose, it's a lot better than that...
What kind of metrics does @lusty spear tracks.
@north kiln
Hey
button = Button(label="Close", style=discord.Buttonstyle.red)
async def button_callback(interaction, view):
await channel.delete()
await interaction.response.send_message("Ticket closed successfully.", ephemeral=True)
button.callback = button_callback
view = View()
view.add_item(button)
await channel.send(''' Καλήσπερα, ανοίξατε ένα donate ticket.. Παρακαλώ περιμένετε έναν ανώτερο. Όταν φτάσει, παρακαλώ ακολουθήστε προσεκτικά τις οδηγίες του.''')
Do you think this will work?
or should i use discord.ui
did you save on the dev portal?
don't expose yourself blud 😭
Does anyone know how they make the buttons un-clickable and also less visible like this after they timeout?
And can it be done in discord.py?
!d discord.Button
class discord.Button```
Represents a button from the Discord Bot UI Kit.
This inherits from [`Component`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Component "discord.Component").
Note
The user constructible and usable type to create a button is [`discord.ui.Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button "discord.ui.Button") not this one.
New in version 2.0.
disabled attribute
class discord.Button```
Represents a button from the Discord Bot UI Kit.
This inherits from [`Component`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Component "discord.Component").
Note
The user constructible and usable type to create a button is [`discord.ui.Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button "discord.ui.Button") not this one.
New in version 2.0.
Yes that's pretty much 1 to 1 what is 2 messages above
How would I make a input box in a modal that is optional?
use the on_timeout method and loop over all UI elements and disable them
set required to false
ah did not know you can disable them, thank you very much
does the variable become None if they don't enter anything?
i don't think so, i think it's an empty string
i will just print it once and test it out
Hello bit of a python noob and i stupidly started playing around with making a discord bot for fun, and I am trying to get what's probably a simple thing to work but i need some help please
name = input("what is your name? ")
print("hello " + name)
How do i Incorporate something like the above code into the bot command I have been using below so the bot will ask your name, and then reply hello plus the name that was input
@bot.command()
async def test (ctx):
await ctx.send(test complete)
If anyone can write it as a working line it would be amazing my brain has been fried trying to work this out today lol
you'd use the wait_for method for this
https://discordpy.readthedocs.io/en/stable/api.html#discord.Client.wait_for
it's a method the client/bot object has
it can basically wait for a response from a user and take that input
OR you could use forms nowadays, if the question the person has to fill in is always the same and doesn't change based on previous answers
Brilliant thank you will go look at how to do that
a discord form would look like this:
@bot.tree.command(name="requestpromotion", description="Request a promotion to the next tier.")
async def requestpromotion(interaction : discord.Interaction):
guild = bot.get_guild(1039553876778561536)
check_if_cc = guild.get_member(interaction.user.id)
if check_if_cc == None:
await interaction.response.send_message("You cannot use this command.", ephemeral=True)
return
dm_channel = await interaction.user.create_dm()
if not interaction.channel.id == dm_channel.id:
await interaction.response.send_message("Please use this command in DMs!", ephemeral=True)
return
await interaction.response.send_modal(promotionrequestmodal())```
Getting this error from this command, not sure what it is
Command 'requestpromotion' raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components: Must be between 1 and 5 in length.
this is the wrong part of the code, you need to show the modal
class promotionrequestmodal(ui.Modal, title = "Request Tier Promotion"):
channel_link = ui.TextInput(label="Channel to evalute", style=discord.TextStyle.short, placeholder="Your channel link", required=True, max_length=200)
analytic_attachments = ui.TextInput(label="Channel analytics for past 2 months.", style=discord.TextStyle.long, placeholder="Analytics image links", required=True, max_length=200)
additional_info = ui.TextInput(label="Additional Info", style=discord.TextStyle.long, placeholder="Any additional info you want to give", required=False, max_length=2000)
channel_link = channel_link.value
analytic_attachments = analytic_attachments.value
additional_info = additional_info.value
async def on_submit(self, interaction : discord.Interaction):
embed = discord.Embed(
color=discord.Colour.from_rgb(34, 255, 221),
title="Promotion Request",
description=f"""
[Channel To Evaluate]({self.channel_link})
**Additional Text**
{self.additional_info}"""
)
embed.set_author(name=f"{interaction.user} ({interaction.user.id})", icon_url=interaction.user.avatar)
guild = bot.get_guild(1039553876778561536)
channel = guild.get_channel(1110895460090118194)
await channel.send(embed=embed)
await channel.send(f"**Analytics (Past 2 Months):**\n{self.analytic_attachments}")
await interaction.response.send_message("Thank you for submitting a request! It has been sent to our team and will be reviewed as soon as possible.")
channel_link = channel_link.value
analytic_attachments = analytic_attachments.value
additional_info = additional_info.value
what is this
getting their value? or do the variables just contain that automatically
yes but you do that in on_submit, not in the class
ah okay thank you
remove that part of the code and use {self.channel_link.value} instead
gotcha tysm!!
I don't get errors sometimes man like how does that error explain that the issue is here
still if you looked at the docs you would see the correct way of using it
!d discord.TextChannel.create_webhook
await create_webhook(*, name, avatar=None, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a webhook for this channel.
You must have [`manage_webhooks`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_webhooks "discord.Permissions.manage_webhooks") to do this.
Changed in version 1.1: Added the `reason` keyword-only parameter.
yeah that's an asset
i got hella shit open tbh
oh right you're using disnake
Yeah
quick question
why does it create 3 times?
there's only 1 isistance running
that part of the code is probably running multiple times then
it is not
Also I have this check for a wait_for function
dm_channel = await interaction.user.create_dm()
def check(message):
if interaction.channel.id == dm_channel.id and message.author == interaction.user:
return True
else:
return False
Butt it still returns True even if the message is sent by that user in a server channel which the bot is in too
def check_for_something_specific_because_i_like_descriptive_functions(message):
return interaction.channel.id == dm_channel.id and message.author == interaction.user```
interaction.user.dm_channel?
oh yeah true
I did not know that the order made a difference -.-
I didn't change the order
all I did was change
if poop == "nice":
return True
else:
return False```
to
```py
return poop == "nice"```
see how much shorter that is for the exact same thing?
yeah but it doesn't change that it is not working 
you're not showing is where you're using that function
channel_link = await bot.wait_for("message", check=check, timeout=240)
channel_link = channel_link.content
also "it doesn't work" should be something you don't want to say
let's say I say "my browser doesn't work"
what do you understand by that? indeed, almost nothing other than something is wrong
so the timeout exception gets thrown?
Nope, I wrote at the bottom here, if the user sends a message in a server it takes that too, even tho it is not supposed to because the check makes it so
you have to work with the message parameter in that check function
if message.channel.id == <user_dm_channel_id> and ...
that'll do 😉
ah yes sorry that is such a obvious mistake
Thank you very much
or just do ```py
isinstance(message.channel, discord.DMChannel) and message.channel.recipient == user
mind accepting my friend request?
what's so confusing about "my dms are closed"
Yeah but if we become friends, they won't be closed anymore 
or you can ask literally anywhere else like here or my discord server
I will in a minute.
I am looking rn thru disnake docs
and i don't see the permissions to manage sounboards
like there's nothing in the docs
i don't think disnake has that feature yet, when it does it will probably be called Permission.manage_expressions
discord.py called it create_expressions actually
I think just installing it again will overwrite the previous version
but uhm, python -m pip install --upgrade <package_name> it is
how can i make it so only a certain user use a command
write a check for it
!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").
How can i send a message using a webhook url?
i need it for bot logs x)
!d discord.Webhook.from_url
classmethod from_url(url, *, session=..., client=..., bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook "discord.Webhook") from a webhook URL.
Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.11)") instead of `InvalidArgument`.
make a Webhook object with this, then use webhook.send
How can I join a discord group dm call with python
you can't
No
it is possible, but would be against discord's terms of service
im not using it for illegal purposes I just want to accomplish the fact that I made that because that is the only thing that I have not made
does not matter it would still be against TOS
yes
pycord has never ran the show lmao
no
Should I use nextcord, pycord, or discord.py for future projects?
what about disnake
i stopped caring about discord bot development before 2022
so not sure about what came afterI
I want to do a Python project or maybe something in JavaScript now that I'm majoring in CS
Java is not a suitable language for discord bot creation so idk
you are probably going to find more people who can help you with discord.py but it still doesn't mean it's better
i've made a bot in java before what do you mean
not ideal I mean
It's possible
you're probably referring to javascript though i just realized i didn't read your message
lmao ur good
JS was named that way bc Java was most popular lang at the time and the devs wanted to ride off the coattails
yep lol
i use java a lot for projects that wouldn't work well in python
i would recommend scrolling through discord.py disnake or nextcord docs to see which one seems easier for you
You can use embed timestamp
The timestamp arg in the constructor
That's called a method not a constructor
embed = discord.Embed(timestamp=datetime_obj)```
!d discord.Embed
class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
x == y Checks if two embeds are equal.
New in version 2.0...
no it can't display relative time
Outputting one of the functions in fred_data.py via the first select option results in an interaction failed error in discord. however, if i make and execute a command like the second picture, it works normally. what could be the problem?
If i use the select option function, does the interaction failed error occur because the function doesn't wait for the time to receive and visualize the data while the function is operating?
Repeating code 🤢
Indeed
send_message is the same in every condition yet not brought out
And that if chain can be done with dict
hmm..
solved. i modified to add interaction.defer() and interaction.fllowup.send instead of interaction.send_message
ephemeral keyword argument in discord.InteractionResponse.send_message
discord.InteractionResponse.send_message("test")
no
that doesn't mean you have to include discord.InteractionResponse in your code
you have to get an InteractionResponse object by using interaction.response and also awaiting it
k i did it
worked
another problem
every time i run !clear
i have this error
Traceback (most recent call last):
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 314, in clear
await ctx.send(f'Έσβησα ', {amount}, ' Μηνύματα.')
TypeError: Context.send() takes from 1 to 2 positional arguments but 4 were given
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1023, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 238, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Context.send() takes from 1 to 2 positional arguments but 4 were given
@bot.command()
async def clear(ctx, amount=10):
await ctx.channel.purge(limit=amount+1)
await ctx.send(f'Έσβησα ', {amount}, ' Μηνύματα.')
await asyncio.sleep(2)
await ctx.channel.purge(limit=amount)
!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.
also, it ignores this line ```py
await ctx.send(f'Έσβησα ', {amount}, ' Μηνύματα.')
fix your f-string signature
done
?
fixed
then show fixed code
await ctx.send(f"Έσβησα ', {amount}, ' Μηνύματα.")
that is not how you create f-strings
bruh
look at the example
i forgot
its my old code, its there since i started python
!e f"Έσβησα ', {amount}, ' Μηνύματα."
@slate swan :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | f"Έσβησα ', {amount}, ' Μηνύματα."
004 | ^^^^^^
005 | NameError: name 'amount' is not defined
hm
await ctx.send(f"Έσβησα {amount} Μηνύματα.")
!e amount = 1; f"Έσβησα ', {amount}, ' Μηνύματα."
@slate swan :warning: Your 3.11 eval job has completed with return code 0.
[No output]
wait but it would work
how to add more selections
shut, discord formatting lost me
just add more?
what have you done so far that you have two?
!paste
(ignore the button, its in another message)
add another SelectOption to options list
like you did before
add like a 3rd?
select = Select(options=[
discord.SelectOption(label="Support Ticket", value="01", emoji="📄", description="Open a support ticket."),
discord.SelectOption(label="Donate ticket", value="02", emoji="💸", description="Open a Donate ticket.")
])
there you create select
add another option
why does everyone like instantiating View directly instead of subclassing it
cuz better
your code is basically unreadable
no idea
you can't easily see where this separates
whereas you could split it up into different functions
select = Select(options=[
discord.SelectOption(label="Support Ticket", value="01", emoji="📄", description="Open a support ticket."),
discord.SelectOption(label="Donate ticket", value="02", emoji="💸", description="Open a Donate ticket."),
discord.SelectOption(label="SR ticket", value="02", emoji="⭐", description="Become SR.")
wait
i forgot 03
select = Select(options=[
discord.SelectOption(label="Support Ticket", value="01", emoji="📄", description="Open a support ticket."),
discord.SelectOption(label="Donate ticket", value="02", emoji="💸", description="Open a Donate ticket."),
discord.SelectOption(label="SR ticket", value="03", emoji="⭐", description="Become SR.")
])
add like elif select.values[0] == "02":
@slate swan
show me the error
theres no error, but it shows this
if there is no error then whats the problem
no problem
the problem is my question

hello
yellow ☎️
if select.values[0] == "03":
^
IndentationError: unindent does not match any outer indentation level```
help me
why do you keep putting y in your messages 😭
why does replit keep giving me errors 😭
maybe it's your code
fix your indentation
what's the error?
wdym
look at the line
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.
try it and see
also why did you replace all elifs with ifs
i didnt
only that one
why
or not
you just did
sure
Okay so
Im making a bot for a customer, and he told me to: When a user joins a specific vc, he wants to move him in another one
how to do that?
voice rooms or just the moving part?
!d discord.on_voice_state_update
discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceState "discord.VoiceState").
The following, but not limited to, examples illustrate when this event is called...
well that's not just moving to a new channel
you have to create and delete it too
but just use the on_voice_state_update event
have you never used an event listener before?
it doesn't matter which events you use they all work the same
@bot.event
async def on_member_join(member):
role = discord.utils.get(member.guild.roles, name = "Civilian")
await member.add_roles(role)
channel = bot.get_channel(1091042545133437015)
still
idk
you first have to create the channel too
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, news=False, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you must have [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.11)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
thats not Asher thats Ash
global author_msg_counts
author_id = message.author.id
# Get current epoch time in milliseconds
curr_time = datetime.datetime.now().timestamp() * 1000
# Make empty list for author id, if it does not exist
if not author_msg_times.get(author_id, False):
author_msg_times[author_id] = []
# Append the time of this message to the users list of message times
author_msg_times[author_id].append(curr_time)
# Find the beginning of our time window.
expr_time = curr_time - time_window_milliseconds
# Find message times which occurred before the start of our window
expired_msgs = [
msg_time for msg_time in author_msg_times[author_id]
if msg_time < expr_time
]
# Remove all the expired messages times from our list
for msg_time in expired_msgs:
author_msg_times[author_id].remove(msg_time)
# ^ note: we probably need to use a mutex here. Multiple threads
# might be trying to update this at the same time. Not sure though.
if len(author_msg_times[author_id]) > max_msg_per_window:
key = db.keys()
db[f"1 {str(message.guild.id)}"]
if f'1 {message.guild.id}' not in key:
pass
else:
duration = datetime.timedelta(minutes=10)
embed = discord.Embed(title="User muted", description=f"{message.author.mention} has been muted", color=discord.Color.blue())
embed.add_field(name = "Reason",value = "spamming")
embed.add_field(name = "Mute duration",value = "10 minutes")
await message.author.timeout(duration)
await message.channel.send(embed=embed)
``` can someone help me im making an anti spam system but its not working the guild id is in the db
i think discord is having problems
Why?
nvm
no errors
this was working until i switched the code a bit
and then put it back to normal
I doubt await message.author.timeout(duration) ever worked
Since you need the member object
But a lot of your code is undefined, hard to know what's wrong
Add a few print statements inbetween your code to narrow down the cause.
ok
its not printing
can ayone say how to make an embed colour bar less in discord py
To make it look like it disappears? You use the color code of the background
no no
there is a setting which we can do
Then use that one haha
I don't know one
If you do color=None it will still use a color
Are you sure that whatever event/function your code is inside of, is actually being called?
yes
!paste
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.
full code
@wanton quiver are you sure that person isn't just using the same color code as the embed? try switching to light theme and checking
I see no where in that link you sent that matches the code you sent
it is the full code in the file
I don't think I'm that blind
It's in his on_message event, around line 300. It's best to only send the code that's failing though @formal basin. Along with other relevant stuff.
I think Discord servers are slow today 
Alright then
@client.event
async def on_message(message):
if message.author.id == client.user.id:
return
await client.process_commands(message)
discord_server = ["discord.gg"]
if message.author.guild_permissions.ban_members:
pass
else:
if any (word in message.content.lower() for word in discord_server):
key = db.keys()
db[str(message.guild.id)]
if f'{message.guild.id}' not in key:
pass
else:
await message.delete()
await message.channel.send(f"{message.author.mention} you can not send discord servers here")
author_id = message.author.id
curr_time = datetime.datetime.now().timestamp() * 1000
if not author_msg_times.get(author_id, False):
author_msg_times[author_id] = []
author_msg_times[author_id].append(curr_time)
expr_time = curr_time - time_window_milliseconds
expired_msgs = [
msg_time for msg_time in author_msg_times[author_id]
if msg_time < expr_time
]
for msg_time in expired_msgs:
author_msg_times[author_id].remove(msg_time)
if len(author_msg_times[author_id]) > max_msg_per_window:
key = db.keys()
db[f"1 {str(message.guild.id)}"]
if f'1 {message.guild.id}' not in key:
pass
print("no server id in db")
else:
print("server id in db")
duration = datetime.timedelta(minutes=10)
embed = discord.Embed(title="User muted", description=f"{message.author.mention} has been muted", color=discord.Color.blue())
embed.add_field(name = "Reason",value = "spamming")
embed.add_field(name = "Mute duration",value = "10 minutes")
await message.author.timeout(duration)
await message.channel.send(embed=embed)```
should i send the commands to setup this anti spam
@client.event
async def on_message(message):
if message.author.id == client.user.id:
return
await client.process_commands(message)
discord_server = ["discord.gg"]
if message.author.guild_permissions.ban_members:
pass
else:
if any (word in message.content.lower() for word in discord_server):
key = db.keys()
db[str(message.guild.id)]
if f'{message.guild.id}' not in key:
pass
else:
await message.delete()
await message.channel.send(f"{message.author.mention} you can not send discord servers here")
author_id = message.author.id
curr_time = datetime.datetime.now().timestamp() * 1000
if not author_msg_times.get(author_id, False):
author_msg_times[author_id] = []
author_msg_times[author_id].append(curr_time)
expr_time = curr_time - time_window_milliseconds
expired_msgs = [
msg_time for msg_time in author_msg_times[author_id]
if msg_time < expr_time
]
for msg_time in expired_msgs:
author_msg_times[author_id].remove(msg_time)
if len(author_msg_times[author_id]) > max_msg_per_window:
key = db.keys()
db[f"1 {str(message.guild.id)}"]
if f'1 {message.guild.id}' not in key:
pass
print("no server id in db")
else:
print("server id in db")
duration = datetime.timedelta(minutes=10)
embed = discord.Embed(title="User muted", description=f"{message.author.mention} has been muted", color=discord.Color.blue())
embed.add_field(name = "Reason",value = "spamming")
embed.add_field(name = "Mute duration",value = "10 minutes")
await message.author.timeout(duration)
await message.channel.send(embed=embed)```
should i send the commands to setup this anti spam
Anyway I can't tell you what's going wrong so we're either both missing something obvious or there's an issue outside your code (DB issue perhaps).
Best bet is to probably do as I said earlier, add a print statement after any line of code that may be error-prone, or after any conditional statements. Check they're actually running as expected, and check variables against their expected values.
Stop replying with the same message
should he send the commands to setup this anti spam?
should i send the commands to setup this anti spam
wait wth
You know what, I give up
why is it replying so many times
yes sure
i only did once
Use that excuse on someone else
I'm not entirely sure how they're doing it then if None doesn't work, sorry
I swear
discord is going mad it is taking so long to send
!d discord.Color.dark_embed
No documentation found for the requested symbol.
i just saw this happen in a different discord lol
take so long
I'm having issues but it's not sending my messages twice or anything, though I heard somewhere it was an issue with the mobile client
im not on moblie
discord itself is experiencing major lag right now, i doubt they're doing it on purpose
yeah it's with the app
Eh, why would someone try to reply another time before the first message is sent anyway
maybe this the reason why my anti spam aint working
oh im on the laptop app
Good job
told you
discord itself is experiencing major lag right now, i doubt they're doing it on purpose
Use that excuse on someone else
why is your theme so dark like very dark
what the heck
maybe this the reason why my anti spam aint working
what the heck is happening
lmaoo
amoled mode
told you
Eh, why would someone try to reply another time before the first message is sent anyway
ahahahahaha this is so funny
my bot just broke
why is your theme so dark like very dark
yeah i just tried to test my anti spam
not a good idea in this situation
my bot just broke
yeah i just tried to test my anti spam
not a good idea in this situation

not a good idea in this situation


Can discord bots delete channel
discord is back?
Yes
!d discord.GuildChannel.delete
No documentation found for the requested symbol.
my bot got hacked.
So?
then take better steps to ensure it's secure
sigh. I stored it like this
there's more to bot security than just hiding the token
they only deleted all the channels they didn't ban the 1k members
but still a big loss.
what does that have to do with what i just said
i'm just telling you
You sending screenshots with 60% of your token visible for no reason says enough
you basically re-leaked it
Ouch
Noones gonna be able to see from that
No one will care enough
But it just shows your awareness of security
Ah first no one will see it, now it's the old token 👍
its both
well
What was the point of the screenshot anyway?
hi, struggling on something
on a reboot, the ticket configuration dosent save in the settings.db, any help would be great.
why you reconnect after creating all the transactions
also there isn't something called REPLACE INTO
can you explain a little bit better ?
Guys i need help.
i made a bot and they somehow hacked it and did this
the code is not changed
how did this happen?
@smoky sinew
What do you need help with tho 
how?
are you using a VPS?
what is a vps
what are you using to host your bot
replit keep_alive with uptime robot

makes sense ngl
someone viewed your repl and got your token?
but how did they see my repl
if you put it in the wrong place yes 💀
because replit makes all your code public by default i guess lmao
If you hard-coded it in your code, yes
,
But they support environment variables, so you should use that instead
This @slate swan ^
yes
or just don't be dumb with where you share your bot token
that's all it takes
i dont share my bot token
my token is only on replit
But my code using raw token is public 
Pretty much the same as giving it to anyone
Also replit is not made for Discord bots
i use it just for the hosting
And as I said, it's not made for that
What else could you use replit for?
he uses it for development and then clones it to his VPS 
I oversaw that basic logic
I haven't hosted on a vps yet but I got confused for all the product names on those cloud platforms
hosting discord bots*
it's good for making them at least 
salve rapaziada
tudo baum com vcs?
I like ubuntu
squarecloud
what square cloud
How about locally?
hosting
I wasn't talking about hosting
Yeah but why not develop it locally
nao entendi
you just need compute
everybody does not have a pc
or even a potato pc
replit is a good choice imo
which cloud service are you using @north kiln
I wonder what % that applies to
online editors*
i'll tell you what they call it
concordo
not more than a couple but we dont talk about that 💀
My pc is dog but can easily develop bots locally
So I can't imagine it being a general advice you should give
pichau é a melhor loja de pc
it's basically just a code editor just run vim or even sublime text lol
Please speak English
pycharm é melhor
@warm vigil
salve
hi?
yes
why does everybody come to use replit in the first place
and that too just for discord bots
interactions is best lib for discord bot

lunar client user detected

does anyone have any discord bot projects available on github?
yes!
Can you send me the repository link?
Lol
leaf is dead from today
leaves die in autumn not summer
it’s autumn in the southern hemisphere
i think
Hi I did a command to remove the role from a user but I added a condition if user does not have the role print failed to remove the role but even if I have the role I can’t remove it from myself.
See the screenshot for the code
Thanks for help ^^
role is a discord.Role object, but name= kwarg is a str
So it'll always be None
You just need to do
if role in member.roles:
# user has role
else:
# user doesn't have role
In your else statement you also don't need to use utils.get, you already have role
And you don't need to repeat the .remove_roles twice
await member.remove_roles(role, reason=reason)
how to make like when a user interacts with a button, the bot changes their roles?
await member.add_role("role")```?
await interaction.member.add_role(role)``` i might be wrong
u are wrong
im just asking, i wont add it in a code
oh
only add_roles exists iirc
Hey so i currently have discord bot written in python and its hosted on a server via VSC. I execute the code and it runs perfectly fine but sometimes my server restarts or something changed and the bot isnt running anymore
Is there a way to see that your code is running fine 24/7 and otherwise u get some sort of notification? or do i need to build that into my code itself
make another script to see if your bot file is running(?) idk maybe i misunderstood you
The classic approach to running a Python script 24/7 is to run it through supervisor.
It will autostart your process when it hangs, start it after a server restart etc.
There also is a plugin to allow monitoring via HTTP
http://supervisord.org/index.html
https://superlance.readthedocs.io/en/latest/httpok.html
Supervisor should be available on most Linux distros
And when you want to get notifications on your mobile or emails you can use this service to monitor it:
https://uptimerobot.com/
Alternatively you can build and add your own HTTP service. For that I can recommend aiohttp, which has a simple to setup http server that can run in the same event loop as your bot.
Hello guys
is there a way i can create like a bot that loads messages from my whatsapp and then sends it too my discord
note: Whatsapp wont have to be on my phone or laptop
No because you can't access someone's whatsapp messages from an external device
You the goat
ty so much
can setting allowed_mentions in send override the one passed to discord.Client?
If no object is passed at all then the defaults given by allowed_mentions are used instead.
(this is extra info in the parameters section of .send() method)
TL;DR: your kwarg in send will overwrite the "default" ones you've set in your discord.Client
yes
👍
Yes,,
Thx
Hey can we make graphs like this using python libraries , if i have weather forecasting data
you could do that effect with purely just matplotlib
You could post the question in a relevant channel too 💀
Imagine caring about that 💀
Wrong channel, take it to #python-discussion
....?
This guide shows how to host a bot with Docker and GitHub Actions on Ubuntu VPS
Bro joined yesterday 🗿
How to load ascii using json?
Whenever I try it turns ➤ from my json file into •
If that's to me, no.
It's fine. I eventually found the right answer on stackoverflow
Your question is regarding basic Python and JSON, even if you use it in a bot it's not a bot development question.
Because the general chat and the help channels tend to move too fast and my question gets ignored 😛
It's fine tho. I found my answers online.
Not a reason to use a channel that isn't related to your question 
It's only an issue if someone else was utilizing this channel for its intended use.
No. Here again, a channel being inactive doesn't change the rules for said channel and makes it useable for any random questions just because you believe so.
Please take discussions about this server to a relevant channel guys
Thank you, parrot 🦜
since it's a beginner question someone will probably answer it quicker
but your issue is probably with encoding
just use the right channel it's not that hard
Look 1 message below or 2 above the message you've replied to
They already got their answer and, hopefully, understand channels have topics - no point on getting over it again I guess
Traceback (most recent call last):
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/ui/view.py", line 427, in _scheduled_task
await item.callback(interaction)
File "main.py", line 124, in my_callback
channel = await guild.create_text_channel(f"{interaction.user.name}-support-ticket", category=category, overwrites=overwrites)
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/guild.py", line 1309, in create_text_channel
data = await self._create_channel(
File "/home/runner/Atomic/venv/lib/python3.10/site-packages/discord/guild.py", line 1175, in _create_channel
payload = {'allow': allow.value, 'deny': deny.value, 'id': target.id}
AttributeError: 'NoneType' object has no attribute 'id'
Whats this error
print("Happy Pride Month")
AttributeError: 'NoneType' object has no attribute 'id'
Means target is None
How did this happen, it was working yesterday and i didnt change the code
You tell us, you have the code
Get your category by ID, not by name
The issue is likely that role is None
Lemme double check the role
Yeap
Should get channels etc. by IDs though
nah it happened bc they nuked the server and the name of the role and the id changed
How to make like
if a user interacts with a button
the bot dms him
Add a callback to the button and send a message in that callback
await interaction.response.send_message
```?
Or
Well there you'll send in the channel, so no
Just like you'd usually send a DM
!d discord.User.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.11)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.11)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
interaction.user.send()
Though you'll need to send some interaction response
Unless you don't really care about the interaction failed error showing up for the user
main.py:132: RuntimeWarning: coroutine 'Messageable.send' was never awaited
interaction.user.send(embed=embed)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
wait
im fr so dumb i didnt await
yeah thats exactly what the first line of the error says lol
Alright i got a question
imagine i have the command !clear
how can i make it so people with a specific role can run this command
?
!d discord.ext.commands.has_role
@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.
If a string is specified, you must give the exact name of the role, including caps and spelling.
If an integer is specified, you must give the exact snowflake ID of the role.
If the message is invoked in a private message context then the check will return `False`.
This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")...





