#discord-bots
1 messages · Page 647 of 1
I kind of like writing simple documentation
Mind designing a GUI for me 🥺
Lmao I prefer writing my own bots to suit my need ngl
If you're okay with something that looks like your bios then sure
I prefer making really random commands that are useless and works 50% of time
thank you
wao
it worked?
Yay, so when I am getting the layout?
yes
welcome, dear
saw that
Lmao idrc tbh
wait lemme copy paste tkinker example real quick
I just want design not code
Ya I'll take a screenshot
Anyways I think I'mma just go to #python-discussion
how do I get the bot to disable the button after clicking?
code:
@bot.command()
async def test(ctx):
embed = discord.Embed(title = 'ticked blyat')
await ctx.send(embed=embed, components = [
Button(style = ButtonStyle.green, label = 'Create Ticket')])
responce = await bot.wait_for('button_click')
if responce.component.label == 'Create Ticket':
await responce.respond(content = 'gay')
probably that shitty library called "discord_components" bet
Ok
Oh yeah
nope
Disnake has views
😭 they gave me that
😭
I tried it like this but it gives an error await responce.respond(content = 'gay',disabled = True)
Do you like ducks?
yes they're cute
Ye
They're tasty
you could try asking in their support server
Wait
idk if anybody online rn has ever bothered with that bad lib
Hold up
that too 😋
Why is your pfp so
yes
Weird
whose
Yours
oh
I can’t really say much tbh mines weirder
because :kek:
I mean that’s a pretty normal thing nowadays
:kek:
:kek: 😌
True
:kek:
Indeed
:kek:
Not having nitro :sadge:
ikr :kek:
A random person :kek:
Yep just a random person
Me lmao
!ot
Off-topic channels
There are three off-topic channels:
• #ot2-never-nester’s-nightmare
• #ot1-perplexing-regexing
• #ot0-psvm’s-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
Interesting
This is in on_command_error py if owner: return await ctx.reinvoke() This is in on_command
if ctx.author.id == owner.id:
ctx.command.reset_cooldown(ctx)
```which one is better way to use?
i've always used the 2nd one
ok but why
pretty sure there's an is_owner() function
it’s a cool down reset
nah i have my own function
bc that resets the cooldown
Not command check
ik
i know, i could swear there was a regular function like it
does re-invoke bypass cooldowns?
I mean then what’s the problem then. Just use any of them 
yeah
how do I sort through a dictionaries keys exclusively
maybe #python-discussion
Sup, how to put commands into a specific category (for help command)?
Like there is no category
But I also want other categories
How do you send embeds to a user's dms
!d discord.User.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=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/master/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.9)") of [`File`](https://discordpy.readthedocs.io/en/master/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/master/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.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
there is a embed parameter
Hey @shut axle!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
!code-blocks
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 to make a bot copy the author's message and send it?
In a command or every message?
in command
Easy, just add a paramter, and use ctx.send on it
@bot.event
async def on_member_remove(member):
channel = await bot.fetch_channel(915953386631864340)
if channel:
invite = await channel.create_invite()
await channel.send(f"・ Nombre del Server **{member.guild.name}** \n・ Server ID **{member.guild.id}** \n・ Usuario **{member.mention}** \n・ ID del usuario **{member.id}** \n・ Invitacion **{invite} **.")
the invitation that is generated is not where the user came from :(
help me
What I want with this is: Make a "log" that shows from which server the user left.
Just use member.guild
@bot.event 🔽
async def on_member_remove(member):
channel = await bot.fetch_channel(915953386631864340)
if channel:
invite = await channel.create_invite()
await channel.send(f"・ Nombre del Server **{member.guild.name}** \n・ Server ID **{member.guild.id}** \n・ Usuario **{member.mention}** \n・ ID del usuario **{member.id}** \n・ Invitacion **{invite} **.")
?
What does this send?
an invitation from where the user left to a specific channel
@bot.event
async def on_member_remove(member):
channel = bot.get_channel(915953386631864340)
if channel:
invite = await channel.create_invite()
await channel.send(f"・ Nombre del Server **{member.guild.name}** \n・ Server ID **{member.guild.id}** \n・ Usuario **{member.mention}** \n・ ID del usuario **{member.id}** \n・ Invitacion **{invite} **.")
try
Huhh
right now send another server and that is where the messages are arriving
help? ```py
@bot.command(aliases = [])
@commands.cooldown(1, 4, commands.BucketType.user)
async def emb(ctx):
channel = bot.get_channel(916008167698210849)
def check(m): return m.author == ctx.author and m.channel == ctx.channel
msg = await bot.wait_for('message', check=check, timeout=None)
embed=discord.Embed(color=0x2e2f33)
embed.add_field(name=f"Заказ {ctx.author}", value=f"{msg}", inline=False)
await channel.send(embed=embed)
?
im getting this too idk how can i solve it
Thats Message.__repr__()
maybe you want the content of the message?
yes
then message.content
msg.content
In embed field
thank you, dear :))
well, what are you TRYING to send?
oh nvm it was fixed
Welcomeeeeee
#help-apple ignore
@bot.event
async def on_member_remove(member):
channel = await bot.fetch_channel(915953386631864340)
if channel:
invite = await channel.create_invite()
await channel.send(f"・ Nombre del Server **{member.guild.name}** \n・ Server ID **{member.guild.id}** \n・ Usuario **{member.mention}** \n・ ID del usuario **{member.id}** \n・ Invitacion **{invite} **.")
the invitation that is generated is not where the user came from :(
help me
What I want with this is: Make a "log" that shows from which server the user left.
ctx.content is not a thing
huh?
Hello, how can we add a role to a member? (via the role identifier) plzz
ctx.message.content
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
do you have an example?
await add_roles(get_role(role_id), reason=None, atomic=True)```
?
lol
;-;
if you want to send how many messages deleted is {amount}
Here they do not explain, they just put a command and guess how it gets ;-;
bruh ;-;
we explain when they atleast try to do something by themself
ok sorry ;-;
!d discord.Role || py await member.add_roles(role) where member is an instance of discord.Member and role is an instance of discord.Role
class discord.Role```
Represents a Discord role in a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild")...
the cool thing with discord.py is when you “crack the code” per se, you can start to figure everything out for yourself
we’re here to push you in the right direction, and guide you on how to learn byyourself
await add_roles(get_role(806322592738574357))
that is really nice, I'm even correct sometimes on what I'm doing 😅
the ability to learn by yourself is exponentially more important than any knowledge you have
Smh you need to get the role using something
someone help? ```py
@bot.command(aliases = [])
@commands.cooldown(1, 4, commands.BucketType.user)
async def emb(ctx):
channel = bot.get_channel(916043553946341406)
def check(m): return m.author == ctx.author and m.channel == ctx.channel
msg = await bot.wait_for('message', check=check, timeout=None)
emoji = [":thumbsup:"]
embed=discord.Embed(color=0x2e2f33)
embed.add_field(name=f"Заказ {ctx.author}", value=f"{msg.content}", inline=False)
await channel.send(embed=embed)
await embed.add_reaction(emoji)
await member.add_roles(bot.get_role(id))
where do you think its magically going to assign the role to
You can't do embed.add_reaction as it does not exist
but you have a point, the past two messages people have just sent arent helpful in the slightest
Then how do I do it?
👍 shouldnt work like that, copy paste the emoji
how do I get the bot to add a reaction to my message
get the original target message and add reaction to that
!d discord.Message || msg = await channel.send(…) await message.add_reactions(..)
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.
;-;
oh.. to yours?
you also need to search up thumbsup on a unicode website and copy the unicode code for the emoji
It says that ctx.message.author has no attribute message
when i wanted to just verify if the author is allowed to purge
but it says that Message object has no attr message
even when i didn't call it
i only called ctx.message.author
so what should i do?
!d discord.on_ready || no, the error is on line 84. on_message takes a message argument. This means it does not take ctx
discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.
Warning
This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
ignore what this person is saying
so what should i do?
I honestly didn’t read the full. thing
I just looked at what he circled 
But what I said is still valid. In regards to his purge command.
The root of the error no.
@quaint epoch
clear command?
go to line 84; on_message takes an instance of discord.Message. So it would just be message.content not message.message.content
so how do I get the bot to put a reaction?
yes
read the error.
ok
please read the error. I have told you precisely what to do.
Your on_message gives out an error
example:
@client.command(aliases= ['purge','delete'])
@commands.has_permissions(manage_messages=True)
async def clear(ctx, amount : int):
if amount == None:
await ctx.channel.purge(limit=1000000)
else:
await ctx.channel.purge(limit=amount)
spoonfeeding does absolutely nothing.
you have explained nothing, and you havent even read the error yourself
Spoonfeeding != learning
;-;
You didnt even set the amount to be equal to None as the default value even if you spoondeeded the code renders wrong
AE
wrong
oop
spoonfeeding != learning
not spoonfeeding != not learning, that would not make sense
My bad
hi
A perfect example of 100 percent brain usage
anyways, I will got to sleep so enjoy your time here 👋
oh goddammit I realized what you meant
so how do I get the bot to put a reaction?
;)
Unicode chars, or the copied emote
I lost 10 braincells there
once again. i sent the answer.
As always, I like confusing people
;-; not as much as pancake
i would love this channel so much if people werent so dependant and ignorant
sometimes the good answers get ignored until someone spoonfeeds
||and sometimes toxic people||
||I shall not mention their names||
Exactly, everybody wants the code not the explanation
yes, they prefer spoonfeeding. Back in the old days I used to prefer being spoonfed, and being dependent on this channel. However, I have learned to be independent
and now I hate spoonfeeding
Receiving spoonfeed when I don't even want it is the worst
i spoonfeed to people who dont know python because they dont care about learning, they just want the answers
its not work
Same
and i cant be assed to teach some idiot how to learn the entirety of python
may you explain how it does not + what did you try
I try not to look at it nowadays
I find breaking stuff down into logic helps everything a lot
whenever someone spoonfeeds me I just try to ignore that comment
*maybe they haven't even learned python yet
if you havent learn python, you shouldnt be in this channel
sometimes.. anyways now I will go to sleep 😫
end of story.

code: ```py
@bot.command(aliases = [])
@commands.cooldown(1, 4, commands.BucketType.user)
async def emb(ctx):
channel = bot.get_channel(916043553946341406)
def check(m): return m.author == ctx.author and m.channel == ctx.channel
msg = await bot.wait_for('message', check=check, timeout=None)
emoji = ["👍"]
embed=discord.Embed(color=0x2e2f33)
embed.add_field(name=f"Заказ {ctx.author}", value=f"{msg.content}", inline=False)
await channel.send(embed=embed)
await message.add_reactions(emoji)
error:
```py
Bot successfully connected
Ignoring exception in command emb:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "D:\прочее\Роботы Программирование\python\папка для заказа бота\main.py", line 44, in emb
await message.add_reactions(emoji)
NameError: name 'message' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'message' is not defined
bye 👋
message = await channel.send(...)
i mentioned that.
The error is in front of you
but well done on adding the actual emoji
I want the explanation, where do i find all of this info on the docs?
jesus fuck
Wtf
i just mean where do i find the docs
and what info do i need to find on the docs for discord.py
thanks
what are the usages of tuples again?
I do not comprehend
in real word situations
you dont even need the docs for that
Just search up discord.py docs on the browser
okay
Tell me too...
tuples are basically lists you cant mutate; they're used when passing args, returning args, anything you dont want to change, you put in a tuple
but yeah, they are in no way essential for python
they're used a lot, however
.bm
@velvet tinsel, please enable your DMs to receive the bookmark.
.bm
thanks
ill go to a random file in discord.py source code
and tell you the usage of the first tuple i find
i've gone to https://github.com/Rapptz/discord.py/blob/master/discord/member.py. Already, there is py __all__ = ( 'VoiceState', 'Member', ) __all__ is not going to be changed during the running of the code, so it is a tuple
OK
again, py __slots__ = ( '_roles', 'joined_at', 'premium_since', 'activities', 'guild', 'pending', 'nick', '_client_status', '_user', '_state', '_avatar', ) these slots will not be changed nor edited through the code, so they are tuples
anything official thats not being changed goes in a tuple
Ok
@quaint epoch
oh no ping ;-;
How do I view Unicode emoji?
yeah i know
"*http://www.fileformat.info/info/emoji/list.htm
in the pages that the fields in the "Unicode" column link to, there's even literals you can copy to your scripts.*"
someone help?```py
@bot.command(aliases = [])
@commands.cooldown(1, 4, commands.BucketType.user)
async def emb(ctx):
channel = bot.get_channel(916043553946341406)
def check(m): return m.author == ctx.author and m.channel == ctx.channel
msg = await bot.wait_for('message', check=check, timeout=None)
emoji = [":white_check_mark:"]
embed=discord.Embed(color=0x2e2f33)
embed.add_field(name=f"Заказ {ctx.author}", value=f"{msg.content}", inline=False)
message = await channel.send(embed=embed)
await message.add_reactions(emoji)
error: ```py
Bot successfully connected
Ignoring exception in command emb:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "D:\прочее\Роботы Программирование\python\папка для заказа бота\main.py", line 44, in emb
await message.add_reactions(emoji)
AttributeError: 'ComponentMessage' object has no attribute 'add_reactions'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'ComponentMessage' object has no attribute 'add_reactions'
Bye 👋
Do you have discord_components installed by any chance
If yes then I bet that shitty lib is the problem
In an embed field how can I make the value empty
They're basically the same 😡
Anyone got a role info command ?
or idea on what it should contain
like a command that checks what roles a user has?
I wanna have a /roleinfo @role command that will tell me things like permissions, how many users have the role etc
ok
i know how to code it, but i don't know what other info it shall have
im not sure then
yo anyone know a quick fix?
@bot.command()
async def rep(ctx):
global repNumber
if len(repNumber) == 0:
await ctx.send(f"{ctx.message.author.mention} Your reputation will now be **automatically** counted")
repNumber[ctx.message.author.id] = 1
print(repNumber)
print (len(repNumber))
else:
if ctx.message.author.id in repNumber.keys():
repNumber[ctx.message.author.id] = repNumber[ctx.message.author.id] + 1
await ctx.send(f"You have received **1** reputation!")
print("This user has already registered")
print(repNumber)
if repNumber[ctx.message.author.id] == 10:
roleID = 916065992214450177
roleObj = ctx.guild.get_role(roleID)
await ctx.send(f"{ctx.message.author.mention} has reached **10** reputative points and has had the **10+ reputation** role applied!")
await ctx.add_roles(roleObj)
else:
await ctx.send(f"{ctx.message.author.mention} Your reputation will now be **automatically** counted")
repNumber[ctx.message.author.id] = 1
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'add_roles
!d discord.Member ||
-> never use global
-> syntax highlighting pls
-> do you mean await ctx.author.add_roles(...)
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").
x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
hash(x) Returns the member’s hash.
str(x) Returns the member’s name with the discriminator.
whats wrong with global
everything.
why my code not work?
@bot.event
async def on_reaction_add(reaction, user):
if reaction.message.author.bot:
if reaction.emoji == '✅':
return
if reaction.message.author.user:
if reaction.emoji == '✅':
channel = bot.get_channel(916043553946341406)
await channel.send("hello")
there should never be a reason you might need it. if there is a variable you want, add it to bot. bot.repNumber = 0
D:
but I use global
that doesn't make it good
oh
it works sometimes
you should never ever use global in a discord bot.
why?
23 votes and 43 comments so far on Reddit
global is literally satan
when you start to use global too much, you fuck up all your code
there shouldn't even be a reason why you need global - if you want a global variable, assign it to bot
maybe you help?
alrighty
import discord
from discord.ext import commands
bot = commands.Bot(...)
bot.special_number = 1
@bot.command()
async def count(ctx:discord.Context):
bot.special_number += 1
not just discord bots, in general you should stay away from globals unless they're absolutely completely have no choice
.bm no global variables, use this
damn I have millions of bookmarks
How can i see how many users have a specific role ?
I want to see how many people with the Member role are in a server
yes, global should be highly highly discouraged in non-discord bot code, however it is just an absolute sin to use global in a discord bot
!d discord.Role.members
property members: List[Member]```
Returns all the members with this role.
especially in discord bots since you always have access to the bot instance
ok
I will stop using the satanic language
precisely, you've literally got your bot which holds all your globals
I was about to put a dungeons and dragons reference but then I realized Hunter may be watching 👀
screw it I'm gonna put it in: You don't remember something, and you're a tiefling you'll have to speak infernal
is it cheating if I make a code to solve my maths problem?
when i try to set the value of a field in an embed to a response to a previous question and then send the embed again i get this:
<Message id=916067270571204658 channel=<DMChannel id=916035082958012497 recipient=<User id=485442448244342786 name='Lord Cringey' discriminator='2468' bot=False>> type=<MessageType.default: 0> author=<User id=485442448244342786 name='Lord Cringey' discriminator='2468' bot=False> flags=<MessageFlags value=0>>
and not what my respone was
heres the code:
channel = await ctx.author.create_dm()
if arole == 'hoster':
emb = discord.Embed(title=f'Hoster Application: {user}', description='Please answer the question(s) below.', inline=True)
emb.add_field(name=qlisthoster[0], value="(Enter your answer below.)")
await channel.send(embed=emb)
try:
r1 = await client.wait_for('message', check=check, timeout=600)
except asyncio.TimeoutError: #captures the error
await ctx.send('Oh no! You did not respond in time')
raise ValueError("Cancelled command")
emb2 = discord.Embed(title=f'Hoster Application: {user}', description='Please answer the question(s) below.', inline=True)
emb2.add_field(name=qlisthoster[0], value=f'{r1}')
emb2.add_field(name=qlisthoster[1], value="(Enter your answer below.)")
await channel.send(embed=emb2)
I did this ```py
embed.add_field(name="Members:", value=role.members)
and i got this ```
[<Member id=912426923911684157 name='Νέο' discriminator='0908' bot=True nick=None guild=<Guild id=912429025086021663 name='Νέο Test Server' shard_id=0 chunked=True member_count=2>>, <Member id=545346711690936321 name='Mihai06' discriminator='9957' bot=False nick=None guild=<Guild id=912429025086021663 name='Νέο Test Server' shard_id=0 chunked=True member_count=2>>]
how can i ping the members instead ?
make a for loop to go through every member in the guild, then find a specific one and ping them
I think
;-; am I right caeden
value=[k.mention for k in role.members]
;-; I may be wrong
!e py _list = [1, 'a', 'b', 2, 3] print([k for k in _list if isinstance(k, int)])
@manic wing :white_check_mark: Your eval job has completed with return code 0.
[1, 2, 3]
Was 'boutta say
you're on the right path
ok
what did I do wrong
thanks
you can just make a list comprehension to automatically make a list of mentions
!d discord.Message || do you mean r1.content
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.
wait_for('message', ...) returns an instance of discord.Message
How do you technically "hack" discord bots to make them spew out nonsense code to have an idea of their code?
what
like
<member=..., ..., ...>
what
just wondering
In servers they say "don't hack discord bots"
you cant see a discord bots code from discord
I have no idea what they're on about
no like just make the bot do something it shouldn't, because I have no idea what server owners are on about
the only time a bot would do something it shouldnt, is if the thing it shouldnt do was programmed inside of it
i dont know what you mean
!pypi selenium
you can use selenium to macro discord bots
ok
cough obviously I prefer not to say whether I have partaken in these frivolous acts
oh
no
you cant hack a bot
What would that even do
end of story
I'll notify him
How can i get the bot owner id ?
blyat, help some0ne
oh yeah thx
like 2 years ago i made a script to give myself infinite dank memer coins
How do you not know your own ID, bot.owner.id btw
How does that even work
Didn't u say that a discord bot can't be hacked
you have dank memer? Sweet
i want it to be an open source bot, so i can't just do owner = 545346711690936321
!d discord.ext.commands.Bot.owner_id || assuming you passed owner_id
The user ID that owns the bot. If this is not set and is then queried via is_owner() then it is fetched automatically using application_info().
there is a difference between macro and hack
Why not 
differnet ;-;
no, i just made a script to give myself infinite coins like 2 years ago
Hmm true
Ok
Lmao
wait, does that mean that he'll macro my bot? Oh...damn
no, its a thing of the past
also you guys are distracting me from my quantative chemistry
'Bot' object has no attribute 'owner'
doesn't really work
you are distracting me from my sequential mathematics
Weird
I'm pretty sure that's a thing
Hmm
could this be bc i'm on py-cord ? i don't think so but just saying
depress
Right, it's only a disnake thing
@slate swan
It's only implemented in disnake
Use what caeden suggested
thanks
owner_id is set by default as well you won't need to pass it
And owner just doesn't exist
hi andy
👋
Ik, as i said, it's only part of disnake, it was mb
why do you have a dating server Kraots?
Didn't see
Uhh 🚶♂️
🏃♂️
I;m gonna go ahead and join
😳
f
bot.owner_id returns None
Do you have intents
yea
Although i don't really see how that would really be an intents problem tbh
im in
intents.members = True
should i do .all() ?
I don't think it makes much of a difference
blyat, help some0ne
And now banned you 🥰
and banned me
See you in 8 months in there ig
I'll come back in 8 months
😂
you're a mod?
Owner
My bio clearly says "my dating server" 🥰
Ik
why is that?
I like appearing as a normal member
ok
That way trolls won't just stop because there's somebody with obvious perms there, just in case 😉
@bot.event
async def on_member_remove(member):
channel = await bot.fetch_channel(915953386631864340)
if channel:
invite = await channel.create_invite()
await channel.send(f"・ Nombre del Server **{member.guild.name}** \n・ Server ID **{member.guild.id}** \n・ Usuario **{member.mention}** \n・ ID del usuario **{member.id}** \n・ Invitacion **{invite} **.")
the invitation that is generated is not where the user came from :(
help me
What I want with this is: Make a "log" that shows from which server the user left.
You're fetching a specific channel so it'll only ever create an invite to that one channel
~~I do ~~
The server he left? Wouldn't that be member.guild?
I'd just use random.choice from the member.guild.channels
how do i add the buttons to an embed?
I do not want that :/
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
Then??
thx
I mean you can just use disnake
I need to join the server
I just need you not to send me an invitation from the channel where I want it to arrive
: ()
And your still single :kek:
😔
I am as well
L

???
Already did
or maybe I can just use wait I'm not gay

Imma go make an AI from scratch and have it be my little kinky gf 🚶♂️
ok
Can i contribute?

No because I'm not gonna do that
😔
I haven't reached such a sorry state of myself yet
are you sure
Yes
could you show me how?
Yeah me too
I don't even know what you want
:kek:
but
gf: i hate you
me: :kek:
I don't like girlfriends
:kek: ftw
they're annoying af
No you just had the wrong ones
I never had one
Nah their just ints and your a str
How can you judge?
Hehe :kek:
More like floats and ints, similar but different
because when I interact I'm like "oh god stop"
Yeah thats a better example
no
I'm a list, they're an int
I had a gf
the command is for a "log" where the ID, name of the server, etc ... I need you to tell me an invitation that is from the server that the user has just left
why
on_member_remove provides you with a discord.Member instance, from which you can get a discord.Guild instance, which is the guild that a user left
You need to create the invite
Stuff
ok
@bot.event
async def on_member_remove(member):
channel = await bot.fetch_channel(915953386631864340)
if channel:
invite = await channel.create_invite()
await channel.send(f"・ Nombre del Server **{member.guild.name}** \n・ Server ID **{member.guild.id}** \n・ Usuario **{member.mention}** \n・ ID del usuario **{member.id}** \n・ Invitacion **{invite} **.")
😔 :kek:
member.guild would be the guild which the member left.
Yeah ik
🙄 ✋
@bot.event
async def on_member_remove(member.guild):
channel = await bot.fetch_channel(915953386631864340)
if channel:
invite = await channel.create_invite()
await channel.send(f"・ Nombre del Server **{member.guild.name}** \n・ Server ID **{member.guild.id}** \n・ Usuario **{member.mention}** \n・ ID del usuario **{member.id}** \n・ Invitacion **{invite} **.")
?
Bruh 💀
I don't really understand what you're trying to send to the channel haha
I'm not gonna bother this time, don't wanna get banned again 😌
I said to the owner "you cant hack bots"
now he's asking me to make one
Then make one
🙃
Why did you banned me in your server for: "being too lonely"?
What are you trying to find?
...
he's asking me to join a vc even though it's like 9:30
the command is for a "log" where the ID, name of the server, etc ... I need you to tell me an invitation that is from the server that the user has just left
I didn't
;-; he banned me
Was a jk😔 😭
Thing is, you can only make an invitation to a channel, not a guild
Imagine 
😂
Is it normal for hyperlinks in embeds to disappear if prefixed with !?
oooh
ok :(
Imagine owning a dating server and being single
:kek:
what you can do is that you can get all the text channels of a guild, and get the first one
and generate an invite using that
that will give you the invitation to the guild a member just left
😠
That's what the dating server is for 
I have a question
Does this server log msgs😳
are you a girl Kraots?
No but my memory does
No
😳
Ok
So only with the server ID you can't make an invitation?
😦
14
I'm coming as well
Jk 😔
:kek:
I talk to alexa
correct
she never understands me
Siri is better
invites are tied to channels, not guilds
workaround, like i mentioned before, would be to get the first text channel and make an invite out of that
🧢
ok
I have no friends
Nah my imagination better :kek:
Alexa cheated on me with my wifi so i put her in the garbage
@slate swan create a friend server
!ot
Off-topic channels
There are three off-topic channels:
• #ot2-never-nester’s-nightmare
• #ot1-perplexing-regexing
• #ot0-psvm’s-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
😔
Why me
why my code not work?
@bot.event
async def on_reaction_add(reaction, user):
if reaction.message.author.bot:
if reaction.emoji == '✅':
return
if reaction.message.author.user:
if reaction.emoji == '✅':
channel = bot.get_channel(916043553946341406)
await channel.send("hello")
because
Why not you?
Or else :kek:
I need friends real bad
Explain "doesn't work"
"why doesn't it work" isn't helpful, we aren't in your head. We need to know what doesn't work, and how it should work
what? clown?
he forgot a wait_for I think
"clown"? wtf?
No
does not write hello
you forgot a wait_for() I think
off top top of my head you're trying to get the user from a member which i'm not sure is possible
russian slang
then I'm creating one @slate swan
Since even does a Member object have a .user attribute
Yeah you can't get .user from .author @slate swan
ah, Bumpkin
👍
If you add hunter all hes gonna do is:
!ot
also your code could be cleaned up a lot
No offense btw
Is there any way that when my bot starts instantly it sends a message to a specific channel?
In your on_ready event, get the channel object and send a message to it
instead of doing this, you can do like so:
on reaction add:
if reaction is checkmark:
if author is bot:
return
else:
send message
he didn't forget a wait_for, its literally a reaction_add event
on_ready can get triggered multiple times for seemingly no reason
maybe he meant a wait_for instead of the event
Have an async main() function which you call asyncio.run() on, and use bot.start() rather than bot.run()
Then make a tasks.loop which only happens once
bot.start() is a lower-level implementation of bot.run()
it's also non-blocking
async def main():
bot = commands.Bot(...)
await bot.start("TOKEN")
await bot.get_channel(123456789).send("Bot is up!")
asyncio.run(main())
yes ;-;
bro, it work but, Bot not write "hello"
code: ```py
@bot.event
async def on_reaction_add(reaction, user):
emoji = ('✅')
if reaction is emoji:
if author is bot:
return
if author is user:
channel = bot.get_channel(916008353505890434)
await channel.send("hello")
why?
Probably because you're using is to compare rather than ==
is and == work in different ways.
also what i gave you wasn't even python, it's just english. don't copy and paste and expect it to work
. . .
but what i gave you will almost definitely work better than what you have right now
Thank you, but the bot does not write "hello"
I know
That's why I'm telling you to compare the values using ==, not checking the types using is
What if i make a sub class in a sub class would my pc explode?
Im impress
Nitpick but why is command lower cased and Category is capitalised
that and that == shit
yes
what do you use to host it
not a clue
i made it like 6 months ago
my pi
where do you buy it
how do i check if someone reacted to a message
wait_for()
thanks
ok
i personally dont recommend it
what country do you live in
how would i differentiate if there are 2 different reactions?
UK
if reaction == :eyes: for example
supposing you did reaction = await bot.wait_for(...)
yeah if you self host it you'll get 100 ping +
oh
that's bad
what do I host on then
;-;
Rent a VPS
Can i got invite of bot?
Its way cheaper compared to buying a Pi
ive got insane internet but the api is in fucking america
aight
yeah and you can choose where the servers are
which do you recommend?
Yea, in the long run those electricity bills, wifi bills, and other stuff will add up
idk
ok
i'll try AWS
this
I like Linode, used it for a bit
Also can recommend digital ocean which I used before lineode
GCP and AWS I don't really like due to how they bill, other then that its alright
.bm
Display information and a GitHub link to the source code of a command, tag, or cog.
Using the source command to source the source of the source command that fetches the sources of other commands
indeed
Anyone know how to implement slash commands for a python bot
@bot.event
async def on_reaction_add(reaction, user):
emoji = "✅"
if user == bot.user:
return
if str(reaction.emoji) == emoji:
channel = bot.get_channel(916008353505890434)
await channel.send("hello")
Use == not is by the way.
Use disnake
Best fork wirh slash commands
Is it specifically for / commands?
No
replit 😎
No but has great slash commands
Can it be used with discord.py
How do I get the name of a channel and its ID?
Its a dpy fork its the same syntax
Ah
All you have to do is change discord to disnake
So import discord becomes import disnake
channel.name and channel.id. The attributes are all contained within the discord.TextChannel or discord.VoiceChannel
!d discord.TextChannel.name use ctx.channel if you have ctx, then use the name attribute since ctx.channel is an instance of discord.TextChannel
The channel name.
no
discord.Channel does not exist
Basically everything that says discord change it to disnake
Oh
I changed it, you happy?
very
Is there like a library that shows what disnake has
The github
Ah okay
!d discord.abc.GuildChannel <= this is exactly like discord.Channel though
class discord.abc.GuildChannel```
An ABC that details the common operations on a Discord guild channel.
The following implement this ABC...
Sick bro tysm
Now the only thing I have to do is create a search filter for input which I have no clue how to
Is inter like ctx?
Yw
inter is for interaction
So like if u type / it will pop up with the interaction?
The docs of disnakes slash commands
Tysm u goat I’ve been tryna find this for like 3 days
Yw goodluck
Tyty, I keep on giving up cuz I can’t create a good search filter for the items
You can do it never give up
It’s like 320 items ik it’s possible to filter Bc other bots use the same items and filter, but I can’t find a good way
I see 
if (message.channel.id == 'ID'):
await message.reply("TEXT")```
the bot just does nothing
What is it replying to
any message sent in that channel
So I created a system for logging messages
But it logged this-
it didn't give me the date time
and yes i did py from datetime import datetime
nvm I got it just can't directly reply to messages
kinda sad but will work
its a method
call it using ()
but it's using async?
doesnt change anything
!e
import datetime
print(datetime.datetime.now())
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
2021-12-02 23:01:04.094437
👌
datetime*
!efrom datetime import datetime print(datetime.now())
So i made a logging system
but whenever i send a command now it doesn't work?
when i send a message now it logs it, but if it is a command id doesn't run it
When the async event runs does it stop the rest of them?
!e
from datetime import datetime
print(datetime.now())
@slate swan :white_check_mark: Your eval job has completed with return code 0.
2021-12-02 23:14:01.820098
will this work
if send == 'send':
submit = client.get_channel(763787880815919104)
sentmsg = await submit.send(embed=final)
await sentmsg.add_reaction('✅')
await sentmsg.add_reaction('❎')
try:
reaction = await client.wait_for("reaction")
if reaction == ':white_check_mark:':
await channel.send('Congrats you were accepted!')
elif reaction == ':negative_squared_cross_mark:':
await submit.send('Give a reason.')
wait = await client.wait_for("message")
await channel.send(f'Unforturnately you were declined. This is the reason: {wait}')
except:
await submit.send('Smth went wrong')
raise ValueError('Try did not work!')
elif send == 'cancel':
await channel.send("Ok did not send!")
raise ValueError("Cancelled command")
Try putting await bot.process_commands(message) in the on_message function at the end
okay
client.process* not bot
Try it
Nice profile banner
I literally put that up there when banners first came out
I had no idea it saved from when I lost nitro
Ik i just felt like saying it to you
i did, did not work but idk why cause i got no error
Add prints
And dont user bare excepts
can i completely get rid of the except?
Idk its your code correct?
its the try part and after that makes it not work
?
could somone help my bot is picking up mgs from other places and not just from dms: https://pastebin.com/YPJDZfpF
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pls @ me
change your @client.event to @client.listen
your bot is not processing commands as on_message blocks command processing
Okay, someone explain how this is an EOL while scanning string literal?
Or do you mean as on join?
Okay, how would I fix?
also on_member_join doesnt have a ctx parameter
Yeah, I know I realized 5 minutes ago...
Guys you should try discord js bots it's easier in my opinion
get the role role = discord.utils.get(member.guild.roles, id = theroleid)
then add the role await member.add_roles(role)
I knw python not javascript.
alr
ig it could be fun to learn js
That's completely fine, you should try exploring JavaScript when you get bored tho
How to get the bot to take the message variable From the emb command to on_reaction_add?
Now it's an error called undefined name roletenv.
@slate swan
could you show the full error?
Truthfully: No
Lying: Yeah.
I answered your question.
;-:
Things like their frameworks are really fun to learn (I especially enjoy learning react)
doubtful
at the end of the day it's only preference and what matters is what you learn and if you're having fun
How to get the bot to take the message variable From the emb command to on_reaction_add?
keywords = ['hi',"sup","hello"]
if keywords in message.content:
await message.channel.send("hello")
when I run this code i get an error that tells me that I need a string instead of a list in if keywords in message.content:. How can I fix this?
!d any
any(iterable)```
Return `True` if any element of the *iterable* is true. If the iterable is empty, return `False`. Equivalent to:
```py
def any(iterable):
for element in iterable:
if element:
return True
return False
How to get the bot to take the message variable From the emb command to on_reaction_add?
can you give me specific example of how to use that in my code?
Database
>>> words = ['foo', 'bar']
>>> any([word in 'abcfoo' for word in words])
True```
thanks!
Hey @slate swan! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
How to make file handler in discord.py guys
just random question, i want to delete all messages in a channel, but when i try to get all messages in the channel, i get this error:
for message in ticket_channel.history():
TypeError: 'HistoryIterator' object is not iterable
for message in ticket_channel.history().flatten():
TypeError: 'coroutine' object is not iterable
```edited it to try fix
i dont get it
,banner
How do I make a member on leave message in a specific channel?
async for meessage in ticket_channel.history():
how do I make my bot detect if a message contain xaxbxd keyword, where x is any number
so like, 1a5b9d?
hmmmm, you might want to loop through a list with numbers 0-9, and replace all numbers in str(message.content) with x, then if it is = xaxbxd
how can i change the nickname of my discord bot whilst its running after x minutes
so, set a timer and after it hits a value you change the nickname?
but idk how i can change the nickname
ye then like this
how to use for loop to check words instead of letters
for loop
wait, what words?
thx
You can split a string by spaces, that would get you all words
you can iterate over that
lol i created a function that does that for my bot-py def spliceOutWords(string): try: str(string) except ValueError: return ',' cache = '' cacheList = [] for index, value in enumerate(string): if value == ' ': cacheList.append(cache) cache = '' else: cache = f'{cache}{value}' cacheList.append(cache) return cacheList
Also I asked a question on stackoverflow but I didn't get an answer which could satisfy me. Can anyone give answer: https://stackoverflow.com/questions/70195718/how-to-parse-flags-and-value-in-a-string-to-a-dictionary-python
\👍
I also told you I am discord.py 1.7 user 
Ah u did? Didn't know that, sorry
\👍
@bot.command()
async def banner(ctx, user: discord.User=None):
await ctx.message.delete()
if user == None:
r = requests.get(f"https://discord.com/api/v9/users/{bot.user.id}", headers={"Authorization": "Bot " + TOKEN}).json()
if r["banner"] == None:
embed = discord.Embed(description=f"You don't have a banner.", color=0x2f3136)
embed.set_author(name=f"{ctx.author} ({ctx.author.id})")
await ctx.send(embed=embed)
else:
embed=discord.Embed(description=f"Here is, **your**'s banner.\n\n[png](https://cdn.discordapp.com/banners/{ctx.author.id}/{r['banner']}.png)\n[jpg](https://cdn.discordapp.com/banners/{ctx.author.id}/{r['banner']}.jpg)\n[gif](https://cdn.discordapp.com/banners/{ctx.author.id}/{r['banner']}.gif)\n",color=0x2f3136)
embed.set_author(name=f"{ctx.author} ({ctx.author.id})", icon_url=str(ctx.author.avatar_url))
embed.set_image(url=f"https://cdn.discordapp.com/banners/{ctx.author.id}/{r['banner']}.gif?size=4096")
await ctx.send(embed=embed)```
says i have no banner even though i do
nvm.
User.banner exists btw if you're using dpy 2.0
Wdym
How do i make the bot mention on whos joined the server in the terminal?
yeah, done by not selecting any permissions when running the oauth flow
And how do i make autoroles to ppl when they join the server?
like have the bot give roles when members join
Hello
anyone
The bots integrations role
yeah?
print(member.name)
He wants it to get removed which idk if its possible
only member* if discriminator is required
it cant be done ,-,
Yeah i figured
You can only change the perms of default role ig
Just learned buttons pretty noice
ye, sem
Pretty easy
maybe
🤷♂️
async def on_member_join(member):
guild = client.get_guild(730651046459998218)
channel = await client.fetch_channel(885464532959526913)
description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"),
role = guild.get_role(832120561848156180)
await member.add_roles(role)
await channel.send(f'Welcome to server **{member.mention}**.')```
Your not sending anything
the last member send me this 2 codes
channel = await client.fetch_channel(885464532959526913)
await channel.send(f'Welcome to server **{member.mention}**.')
No need for the extra stuff your getting a textchannel object which you can use the attr .send
await channel.send(f'Welcome to server **{member.mention}**.') This?
You can just do:
channel = await client.fetch_channel(885464532959526913).send(f'Welcome to server **{member.mention}**.')
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\thoma\Desktop\discord.py\python\bot.py", line 39, in on_member_join
channel = await client.fetch_channel(885464532959526913).send(f'Welcome to server **{member.mention}**.')
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line -1, in fetch_channel
TypeError: can't send non-None value to a just-started coroutine```
^
Weird give me a sec
k
it's more than 80 characters in length, which isn't something pep8 style guide suggests
I dont count characters ok😔
😭
and it only awaits send, fetch_channel was never awaited
read the error
channel = await (await client.fetch_channel(885464532959526913)).send(f'Welcome to server **{member.mention}**.') ```
at this point, you should just use the way you did
or get the channel
its cleaner
^^
Well it didnt work before but let me try that one
!pep8
PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.
More information:
• PEP 8 document
• Our PEP 8 song! :notes:
Funny looking
indeed
Cool tho
Show
nvm but when i do print(member.name) its only showing the members name. i want to be member.name has joined your server?
bruh
use member.name then??
🤨
print(f"{member.name} has joined the server")
Bruh
Hmm?
Can someone help me out
My bots code just started having issues on its VPS and I havent added anything. It runs for a couple seconds then stops but returns this in logs.
/root/.pm2/logs/main-error.log last 15 lines:
0|main | File "/usr/local/lib/python3.8/dist-packages/pymongo/collection.py", line 29, in <module>
0|main | from pymongo import (common,
0|main | File "/usr/local/lib/python3.8/dist-packages/pymongo/common.py", line 27, in <module>
0|main | from pymongo.compression_support import (validate_compressors,
0|main | File "/usr/local/lib/python3.8/dist-packages/pymongo/compression_support.py", line 37, in <module>
0|main | from pymongo.monitoring import _SENSITIVE_COMMANDS
0|main | File "/usr/local/lib/python3.8/dist-packages/pymongo/monitoring.py", line 186, in <module>
0|main | from pymongo.helpers import _handle_exception
0|main | File "<frozen importlib._bootstrap>", line 991, in _find_and_load
0|main | File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
0|main | File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
0|main | File "<frozen importlib._bootstrap_external>", line 844, in exec_module
0|main | File "<frozen importlib._bootstrap_external>", line 939, in get_code
0|main | File "<frozen importlib._bootstrap_external>", line 1038, in get_data
0|main | KeyboardInterrupt
You close it? Or pymongo does smth weird ig
looks like the vps aint good
Could be
yea its only a VPS issue
digital ocean to be exact
it just started happening 2 hrs ago
it could be also some timeout thing or smth, be sure to check the settings and stuff
how can i upgrade pip from 21.2.1 to 21.3.1 on my discord bot hosting?
I am getting these errors -
ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly
Failed building wheel for yarl
WARNING: You are using pip version 21.2.1; however, version 21.3.1 is available.
I have no idea what yarl or multiduct are
I have bought bot hosting from plox.host (pterodactyl python 3.9 server)
show the entite traceback
yea ill look at it
kinda desperate rn. Alot of servers that use the bot are at risk rn since this issue is preventing the bot from running
contact support maybe
pip install --upgrade pip
ig
yeah ik but i cant run it
every time i start the server the errors appear first and then the server just crashes
i will open a ticket at their support
use epikhost
its also pterodactyl
and it's free