#discord-bots
1 messages · Page 1043 of 1
It was successful tho
just change the code to what it was before
Java is probably not the best language for that but it works
ctrl + z works
Hello, I know this is simple but I'm new to coding.
Yea
You need to install node first
but this is also why its a good idea to set up a development git branch and commit before you make major changes to things that work
This is also a Python server
i normally do versions on notepad
For future questions you can ask in discord.gg/djs
As we talk about Java
Average day in #discord-bots
learning to use a repo will make your life 1000x easier
Yeah
Not to mention if you’re planning on going into any sort of software development knowing git is a must for working with coworkers
ig this works
i hope
im just trying to help man ¯_(ツ)_/¯
there are so many good reasons to use git down to seeing the specific changes on each commit, rollback options, branching, forking, and so much more
I've tried this, but i get the error
TypeError: 'bool' object is not callable
message = await bot.wait_for("message", check = user == discord.Member, timeout=30.0)```
ik and i appreciate it
I dont say it to be elitist but it will help you
Also CI/CD to production servers
ill check out ur idea as mine is bad
we've all been there
nice got discord button to kanban ticket integration working fkn finally
thats js
you need to install node
what are you trying to install? If youre using python just use pip
any ideas?
@slate swan :x: Your eval job has completed with return code 1.
001 | <string>:1: SyntaxWarning: 'bool' object is not callable; perhaps you missed a comma?
002 | Traceback (most recent call last):
003 | File "<string>", line 1, in <module>
004 | TypeError: 'bool' object is not callable
huh
how do i make it have a callback
Check has to be a lambda or a function
oooh
did you just call true lol
Did he answer?
would i need to change "message" to something else seeing as its an ID im waiting for?
async def check(message):
return isinstance(message.author, discord.Member)
bot.wait_for(timeout=0, check=check)
like so
or just saw to pass a callable
True
literally what i just said
poggywoggy = swallo.content
no brackets
do i?
oh ;/
It's it compulsory that fetching strings from a website with discord.py bot nd aiohttp requires the link to have json in it?
still
no
But how
Almost all tutorial, the link had json in it
yeah thats for apis
So how do I?
I'm like 202111 way confused
@bot.slash_command()
async def game(ctx: commands.Context, *, type: str):
if type == “ping pong”:
“start ping pong”
elif type == “tick tack toe”:
“start tick tack toe”
bruh why do shitty errors happen like thtat
vast majority do
*most
no
thanks
yes
np
whatever you say
the link to have json??
what
I move data around for a living, the very very vast majority of apis use json for payloads
@regal pulsar
^
use "s instead of those quotes
replace “start ping pong” with ping pong code
I don't understand
you were just saying thats not true if I was understanding correctly
or tick tack toe with tick tack toe code
uh
if not then nvm
when did i say that?
I must have misinterpreted
ctx.respond("Pong")?
yeah
i think its response tho
indentation
💀
look at "ping": probably inconsistent tabs and spaces
😩 the quotes
lol
its not python quotes
didnt even notice that
what error are you getting when you run it?
what kind of mistake?
discord.ext.commands.errors.CommandNotFound: Command "rul" is not found```
“ != "
yep
can you show where you defined your command rul?
run the file though
what ?
hows my indentation :)
o.o
do you have a command rul? The error is showing that you tried to run that command but it was not found
just explaining my misunderstanding earlier
im on mobile
ok?
Yeah as the others said, your quotes are not proper quote characters
replace that with quotes
''
yeah ios uses some other kind of quote ch
Bot token not showing, thanks.
I mostly use TS so I dont notice quotes usually
reset it
it only shows once, you need to save it in a secrets managerr
im so smart guys
you need to reset it because of the upcoming changes iirc
intents?
Discord's API decisions are mind blowing to me from a business perspective
is anyone here experienced in webscraping using discord commands? dm me pls have some questions
what kind of mistake?
PS C:\Users\ToxicPenguin\Desktop\Администрация> ```
I'm turning it off
whats with that filename?
not the russian one, but the other one.
its a file reference issue likely due to encoding from that name
which decisions in particular
name in Russian. For an American, this is something beyond natural
no I understand that
what is that name
ToxicPenguin\Desktop\╨┤╨╝╨╕╨╜╨╕╤Б╤В╤А╨░╤Ж╨╕╤П\
wow
bruh
this is not russian
anything wrong with this?
well ask away
if anyone knows they’ll help
anything wrong?
name in Russian. For an American, this is something beyond natural
bro is this russian? ╨┤╨╝╨╕╨╜╨╕╤Б╤В╤А╨░╤Ж╨╕╤П
thats russian?
nvm
not helping that guy, what an ass
this is how you see russian
who
its how you see if if its not encoding
im sure thats not russian
utf8 supports tho
hi, why does guild.members() return an empty list, even though there are members?
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
okay cool thank you
intents.members = True
right but its clearly not encoding correctly to utf-8 standards
hmm yeah
how to my bot keep be alive
!hosting
Hiya. I am creating a discord bot to showcase who I am. I am new to developing so I'm currently wondering how it can say text when it joins the discord?
I want the message to be
"I have successfully been turned on." or something. I'll change it later on.
I'm using Node JS
try this
for hosting?
this is a python server ;)
ye
oh u right
I use heroku for hosting, used to just keep a webserver online by pinging it but it was jank, and replit shared IP/rate limiting is trash
heroku is not a too good option either, but yeah it works.
hmm but heroku isnt ideal for bot hosting
use railway
its worked for me as a lightweight solution, whys that though?
- it runs only for 20 days in a month for free
- ephemeral file system just like replit
- as emotional support said its not meant for dc bots

I dont mind paying for convenience and its cheap, I dont get the "not meant for dc bots" thing though, theres nothing too unique about a discord bot imo as far as cloud compute instances go
railway.app is free too
:/
I used to use ec2 and it was also fine, but then I quit amazon and lost my discount
resource usage in a discord bot is higher, especially when you use a language like python
you worked at amazon?
yeah I was a data engineer on alexa for 3 years
resource usage for something like a discord bot should never be an issue for any compute service thats worth its salt and properly configured
sounds like an amazing job
enough of my stocks vested and I was burnt out tbh
ah
it was a lot of work
hi, sorry again, why does the method user.remove_roles() throw this error:
File "main.py", line 256, in on_raw_reaction_remove
await user.remove_roles(role) #give the role to the user
AttributeError: 'User' object has no attribute 'remove_roles'
as I've seen it used in the documentations and stuff?
I've also tried
client.remove_roles(user, role)
but that just throws the error
File "main.py", line 256, in on_raw_reaction_remove
await client.remove_roles(user, role) #give the role to the user
AttributeError: 'Bot' object has no attribute 'remove_roles'
only a member object has remove_roles
that's damn old tutorial code
what action are you trying to get to remove roles? (message, command, etc)
Anyone know how to give option buttons for an arg in a slash cmd?
@client.event
async def on_raw_reaction_remove(reaction):
data = await get_server_data("reactionroles") #gets data
info = data[str(reaction.guild_id)]["reactions"] #gets the reaction roles list
guild = await client.fetch_guild(reaction.guild_id) #gets guild
user = guild.get_member(reaction.user_id)
for group in info: #for all the created reaction roles in the server
if str(group[0]) == str(reaction.message_id): #if the messages reacted to has a reaction role
if group[2] == reaction.emoji.name: #if it's the correct emoji
guild = client.get_guild(int(reaction.guild_id)) #gets the guild
role = discord.utils.get(guild.roles, id=int(group[1])) #gets the role
await user.remove_roles(role) #remove the role from the user
lol
lots going on there
i think its reaction.user.id
reaction.user_id
!d discord.Reaction
class discord.Reaction```
Represents a reaction to a message.
Depending on the way this object was created, some of the attributes can
have a value of `None`...
reaction here being a payload since its a raw event
hmm
!d discord.RawReactionActionEvent.user_id
The user ID who added the reaction or whose reaction was removed.
how to make ping pong for discord bot
bot.latency
like when u type /game bot pop out ping pong UI
you can define the role through discord.utils.get then apply to the action. heres something for messages:
role = discord.utils.get(guild.roles,name="rolename."
await message.author.add_roles(role)
help
what do yoy even mean by ping pong
like
when u type /game
it just sends ping pong?
no
like when u say /game PingPong he will pop out pong UI
how do i make it
??
how to give option buttons for an arg in a slash cmd?
and when ctx.send("<some message>) bot react on message and when u react he delete that messages
what do u wanna to make with it?
what with?
u want to make canculator right?
okay
like
<screen>
<1><2><3>
<4><5><6>
<7><8><9>
<#><0><*>
<> are like buttons
send it
yeah but there is no error in that line
lol
a calculator?
It's relatively easy if you know how using stacks, queues, and prefix notation
hardest part is going from infix to prefix notation
bro I didn't understand a single word
We did a simple calculator that way in Java for a course
its been a pain tbh, thats why im building so many automations lately
if youre interested in decentralized collateralized lending protocols maybe lol
async def add(ctx,a:int,b:int):
await ctx.send(f"{a} + {b} = {a+b}") #Adds A and B
@client.command()
async def sub(ctx,a:int,b:int):
await ctx.send(f"{a} - {b} = {a-b}") #Subtracts A and B
@client.command()
async def multiply(ctx,a:int,b:int):
await ctx.send(f"{a} * {b} = {a*b}") #Multplies A and B
@client.command()
async def divide(ctx,a:int,b:int):
await ctx.send(f"{a} / {b} = {a/b}") #Divides A and B
Pong UI?
smth like this?
yes!
I don't believe discord has that?
Oh with buttons
yeah
The discord.py github page has an example tic tac toe with buttons
Don't know how well pong would work with buttons however
or tic toe
Tic tac toe is relatively easy
just smth of that
okay then i need tic toe game
thx
I'd suggest you actually try to understand it though
just copy pasting it isn't going to be all that helpful
uh
i see the code
that can't help me
but thanks for trying to help me
do u know when bot send message bot add reaction and when ctx.author react on that reaction message delete
That's what you wanted isn't it?
That's also pretty easy, use wait_for
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji")...
It tells you the type
It can be one of discord.Emoji, discord.Reaction, discord.PartialEmoji, and just a plain ol' str
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way...
uh uh
They also have an example:
@client.event
async def on_message(message):
if message.content.startswith('$thumb'):
channel = message.channel
await channel.send('Send me that 👍 reaction, mate')
def check(reaction, user):
return user == message.author and str(reaction.emoji) == '👍'
try:
reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
except asyncio.TimeoutError:
await channel.send('👎')
else:
await channel.send('👍')
im using discord.py 2.0a and i have for example ctx.author.avatar.url
but this is the error:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'url'
same for banner.url
the user has no avatar/banner
probably use display_avatar instead
Hey, is there any good overall tutorial for a discord bot you all could recommend to me? im trying to understand from the Developer Portal, but it doesnt help me at all
The documentation and examples may be of use to you
yeah right thanks, but banner doesnt work too, and i have a banner
int object has no attribute delete
Looks we do do have an interpreter in chat
Hmm you mean discordpy? If so thats what i meant, i don't know where to start 😄
interpreter wants to jump in a lake and stay there for eternity
doesn't open open a file but not close it without a with or a close
they asked me to use a db instead of txt so i named my txt files as db
@heady sluice
how would i give someone a specific role
How do you want to give the role
from the bot, after
Events, commands
after its done checking if the key is correct
Can anyone help? Why does this keep showing error
command?
Alright
so you could put the key in as a variable and see if it matches
if not, then don't give the role
member.add_roles(id)?
role object
Like
ight.
member = ctx.author.id?
Decorators need to decorate a function
Python is telling you that it was expecting something after that line, but it didn't find anything
this is what i'm doing for the key
Hence the "unexpected end of file"
I would just use a variable
Oh
XD
I would probably just do this:

key = [11234242]
@bot.command()
async def CheckKey(ctx, Key):
member = ctx.member.id
if (!key):
await ctx.send("Incorrect key!")
else:
await member.add_roles(67545674637745)
@slate swan
I think something like this
🤔
huh
key_given = [11234242]
@bot.command()
async def check(ctx, key: int):
if key != key_given:
await ctx.channel.send("Incorrect key!")
else:
await ctx.author.add_roles(67545674637745)
@slate swan
you mean role ID right
!d discord.Role
class discord.Role```
Represents a Discord role in a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild")...
so
key_given = [11234242]
@bot.command()
async def check(ctx, key: int):
if key != key_given:
await ctx.channel.send("Incorrect key!")
else:
role = await ctx.guild.get_role(67545674637745)
await ctx.author.add_roles(role)
@slate swan
ctx.guild.get_role(67545674637745)
inside the parenthesis you put the role ID right?
Ok so I almost had it
Yes
Okay
Hmm
Well I ran it
and the key will always be wrong no matter what
how
An integer is not a list
oh yeah a list
mb
key_given = [11234242]
@bot.command()
async def check(ctx, key: int):
if key in key_given:
await ctx.channel.send("Incorrect key!")
else:
role = ctx.guild.get_role(67545674637745)
await ctx.author.add_roles(role)
@slate swan
this correct no?
ctx.guild.get_role is a sync function
oh yeah
keep getting mixed up with fetch_role
else: pass lol
lmao
It’s useless so should remove
what should i do to this
role = ctx.guild.get_role(67545674637745)
but your id is 14 digits
should be 18
sus
I am trying to create a discord bot that returns stock info, if anyone can help me, send me a dm
I am trying to create commands like “!stock MSFT” but I dont want to create commands for every stock so should I create a stock class with the properties self and ticker?
@slate swan
Code
Error
How to fix?
@commands.slash_command(description="Wysyła sociale", guilds=test_guilds)
i think, i dont remember with disnake
how do i code a bot or webhook that takes a picture of this and sends it in a channel?
Global slash commands take some time to update. They might show up at some point in the next few hours. If you want them to show up and update instantly, you can specify a list of guild ids to the guild_ids parameter of slash_command, and it will add the command to only those guilds.
i suggest deleting the message
lol it blows my mind how many public repos I just saw using sql libraries and passing raw unsanitized strings
well only 2 to be exact but it was only in the course of 10 mins
intents = discord.Intents.all()
webhooks = Tree("webhooks")
client = discord.Client(intents=intents)
bot = Clients(webhooks=webhooks,command_prefix = "!",intents=intents) # commands.Bot
bot.run("token")
whats wrong with my code?
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
RuntimeError: Event loop is closed
authentication issue for HTTP endpoint youre trying to connect to
you arent using approved credentials to connect
maybe the problem with my token
probably
i used my old bot code and its working fine. why i am getting this
i made a new bot app and still get the same error
were you also using webhooks to connect before?
are you passing it as an environment variable?
i don't know what that mean but i am passing it as init arg to Clients : ```py
def init(self, webhooks:Tree,**kw):
super(commands.Bot,self).init(**kw)
is it the intents?
no its your auth, it looks like youre mixing up webhooks and normal authentication
okay let me try a basic bot
good idea, if you do that and run into more issues try printing your token to console to verify that youre not passing anything youre not meaning to. Sorry I actually had to leave right after the first comment I made so I cant help much
import discord
from discord.ext import commands
intents = discord.Intents.all()
bot = commands.Bot(command_prefix="!", description="The description",intents=intents)
@bot.event
async def on_ready():
print("Ready !")
bot.run("token")
i getting the same error? why this is happing to me...
i stealed the code lol
hm good idea
i think it's the settings
2 Questions
- I setup a private server/guild for testing. I'm the only user (plus a bot I'm working on). Is there an easy way to test the
on_member_join()event? - I was looking at the discord bot tutorial on RealPython (https://realpython.com/how-to-make-a-discord-bot-python/) and noticed they use:
client = discord.Client()
But many other tutorials and much of the code I see here uses:
from discord.ext import commands
client = commands.Bot(...)
Just wonder if anyone can speak to the differences? Pros/Cons? Etc.
did you check the discord v?
"v" as in version? No. Maybe RealPython is using an older version?
yes. i think so cuz old version use client as bot
gotcha. Thanks!! I'll look more closely at that, but you're probably right. Much appreciated 👍
np
class BookMark(commands.Cog):
data = Data()
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
pass
@commands.command()
async def bm(self, ctx: disnake.CommandInteraction, name):
await ctx.send(name)
def setup(bot):
bot.add_cog(BookMark(bot))
this text command doesnt work at all, nothing happens when i run ..bm test
commands.Bot is a subclass of discord.Client with the commands extension. (You should use this 99% of the time). It has all features of discord.Client but it’s easier to make messages based commands like !ping
Also if u use commands.Bot name it bot not client
Thanks for that! Good info!
Is there an easy way to test the on_member_join() event? I have a test server, I'm already member (since I'm the owner) and I don't want to bug a friend to join/leave over and over again while I test
maybe make an alt
I can do that, I just wasn't sure if there was some "built-in" way that discord has (specifically for testing)
Do you still want to know a way to test the event without making an alt?
You still are requred at least a Member obect though
i see what u mean. i didnt think of that
Bot.dispatch("member_join", Member)
``` will call your on_member_join callback0
Maybe making an alt account is the easiest 🙂 no need to overcomplicate things. Oh! I'll try that out though!
You just need to make sure you have an actual discord.Member object to dispatch
Everything after should be fine
Gotcha. Thanks! @wary crystal
is that an internal method?
ive actually never seen it😅
Yes
- Which library is this?
- Did you load the cog?
send src
Disnake, and yes, there another on message listener there which works fine
thx
So i keep running into a situation where the bot.channel(id) is erroring out. Is it possible to do a try/except on async functions?
u can fetch
Yes
error means its returning None right?
when calling one. yeah. but show ur code so we can see where the issue might be.
I'm getting an error on the await command.bot.channel() function that says it had an unhandles exceptionin the background task
Said "Gateway timed out"
Technically you can wrap everything into a function and call it on a specific command 🤔
This is the snippet. The fetch channel times out and kills the loop from functioning in the future until I reset the server
(Was saying bot.channel(), I actually was using fetch_channel)
A gateway time out error, (504) is not something you can fix code wise. This is an issue on discord's end sadly
The best thing to do would be to wait for discord to fix their server(s)
that may also happen because of slow internet from your side.
hmm. not soo sure but have u looked at this?
https://gist.github.com/Rapptz/6706e1c8f23ac27c98cee4dd985c8120#interactions-with-exttasks
assuming ur using 2.0 because there was a change
Usually, if this is the case, aiohttp would've given you an error before even receiving 504.
But, I wouldn't rule out the possibility, yea.
I'm just going off discords' documentation, stating 5xx error codes is server sided
https://downdetector.com/status/discord/ But, also seems like there are people reporting 5xx issues currently.
https://discordstatus.com/ discord status says otherwise
Welcome to Discord's home for real-time and historical data on system performance.
is it possible to run a command which is having 3 args but the user sent 2?
make one of them have a default value
i wanna make a slash command with disnake
and i want it to be
/verify username:
how do i take what the author says for username to turn it into a variable
Just going off of what that other website says ¯_(ツ)_/¯
Its an intermittent time out, usually a couple of days. Used to have no problems at all, seems to happen more often lately.
How can I get a channel by it's id and send a message on it with discord.py 2.0?
channel = client.get_channel(channel_id)
await channel.send_message("message")
I used to do this but it doesn't work on the new version
try await channel.send("message")
oh my bad, I used to have channel.send("message") but changed it while testing
Just in case, this is the error:
AttributeError: 'NoneType' object has no attribute 'send'
then
channel = client.get_channel(id) or await client.fetch_channel(id)
@zealous jay
:D
hmm, okay, I may have to refactor according to this. Not sure if it'll fix my problem
no
btw the code is probably horrible but im just testing
and what value do I give to that var
is cog_unload() of Rapptz's module called when bot gracefully exits? (for example on Ctrl+C)
like
send = await channel.send("hi")
await send.edit()
np
edit is a coro
👍
asyncio.sleep is also a coro, i.e. you have to await it
why should we avoid time.sleep ?
and you dont have to use seperate sends for mentioning
you can just
await channel.send("@compact totem", embed=embed)```
oh
It's blocking and will ultimately stop your entire bot from running for the duration of the sleep
in my defense it's old code and im just testing things 
okay
💀 dedly
nvm, i found another issue but fine
you're creating the same embed again
if you wanna change any of the fields, you can just reset them
embed = discord.Embed(title="sparky uwu")
await ctx.send(embed=embed)
await asyncio.sleep(0.88888777777769)
embed.title = "sparky not uwu"
await ctx.send(embed=embed)```
ease
oh true
class events(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_guild_join(self, guild):
auth = await self.bot.db.fetch('SELECT authorized FROM guilds WHERE "guild_id" = $1', guild.id)
if auth == True:
print("Authorized")
pass
else:
print(f"Not authorized, leaving {guild.name}")
await guild.leave()
```
```py
@commands.command(hidden=True)
@commands.is_owner()
async def authorize(self, ctx, *, ID: int):
await self.bot.db.execute('UPDATE guilds SET authorized = $1 WHERE "guild_id" = $2', True, ID)
await ctx.send(f"Authorized {ID}")```
I'm trying to make a authorization-based bot, and have a Postgres Database to store a Guild ID, Prefix, and if the guild ID is authorized (using boolean) and I am having trouble actually doing it
My commands here, authorize is supposed to set the authorization to True and then set it with the guild ID, which authorization works (I think, I don't know how to check if it actually updates it), but when I make the bot join a authorized server, it still leaves, same if it wasn't authorized, I don't know what to do.
thanks again Ashley
!d discord.ext.commands.Context
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.
This class contains a lot of meta data to help you understand more about
the invocation context. This class is not created manually and is instead
passed around to commands as the first parameter.
This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
huh
!d discord.ext.commands.Context
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.
This class contains a lot of meta data to help you understand more about
the invocation context. This class is not created manually and is instead
passed around to commands as the first parameter.
This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
late
pleasure is mine
ayo
should i put this into #databases
how will people authorize it....when the bot already leaves the guild on join....
no i authorize it myself
oh and is it possible to edit a field like the ones added with add_field?
try
if not auth:
print("unauthorized")
return await guild.leave()
print("authorized")
ease
yes, you can get the fields using the property fields on the Embed object, pop the necessary field and insert another one
!d discord.Embed.fields
property fields```
Returns a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of `EmbedProxy` denoting the field contents.
See [`add_field()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.add_field "discord.Embed.add_field") for possible values you can access.
If the attribute has no value then `None` is returned.
oh my god ty
im stupid lol
arent we all?
did it work though?
yeah
IS THERE A WAY TO GET RID OF THIS BRO
wdym by that lol
is it in console?
type quit
i just ctrl c but its annoying
it does the same thing
just on a side note, its a good practice to:
example = True
if example:
print("print, example is set to True")
if not example:
print("example is se to False")
''' Its recommended not to use arithmetical ops like `==` to compare bools '''
''' or as an alternative (use the above method than this, preferred) '''
if example is True:
print("example is set to True")
if example is False:
print("example is set to False")
sparky, thats an example
yeah i am just super tired and didn't realize it
ye ik jk
🫂 get some rest, dont strain yourself
its only 9pm tho
wale up early and go out for a walk, easeee
4 and a half for us
i am not waking up early i have a staar test monday-thursday and want the rest
- or - ?
uhh goodluck, anyways ot, so i wont continue
@slate swan :white_check_mark: Your eval job has completed with return code 0.
4
💀 sleep
i will trry and see
wait i can use guild.fetch_guild or whatever without my bot being the server right @slate swan
no
i thought i could
whats id
guild id
no
huh
you can use it but it returns None as a result because all the guilds that the bot is in are cached on startup, and it cannot access a guild's data that the bot is not in
oh rip is there a way to get a guild name from id
or will it still return none
is this a dm cmd
nop
which id u want
because i'm using ID to put it into my database
the bot can only get the guild that the bot is in
you can get them by the following methods:
.
!d discord.ext.commands.Bot.fetch_guild
await fetch_guild(guild_id, /, *, with_counts=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") from an ID...
guild_id @slate swan
!d discord.ext.commands.Bot.get_guild
get_guild(id, /)```
Returns a guild with the given ID.
Changed in version 2.0: `id` parameter is now positional-only.
which guild id the guild in which the command is happening or another?
get_guild looks in the cache of the app for the Guild object and fetch_guild makes an api call to get a Guild object
I recommend making a getch
@slate swan have u tried party mode
a getch
whats that?
yo
goto settings and enable
How many getches does disnake have
fast its very cool
2, user and member getches
ssssssssssssssssssssssssssssssss
its cool
it isnt in the change log, nor is there an update for phone
How about discord.py
ofc it wouldnt be on phone ever
does @unkempt canyon have pypi
!pip
package
!pypi <package>
Can also use: pack, package, pip
Provide information about a specific package from PyPI.
!pypi discord-ext-getch
!pypi DuckDuck
An async API wrapper for the Random-d.uk API
Yes
I KNOW
I remember doing that here until I realized that i shit on a lib i created
Kek
self.promotion 
showing pypi

async def on_guild_join(self, guild):
for guild in self.guilds:```
is this right to loop thru all guilds
= True
Is that in a cog
yes
👀
That is not right
fuck i am so bad
um Ok Sparky
!pip DscPyDB==0.1.2 ❤️ the worst code ive ever written
Lol
okay thats illegal now?
Apparently
!pip Sparky

RIP
Rip bozo
Rip
totally fucked up
ok
Ok
ok
OK
OK
Sir we get it
I swear this is bad shit :)
alr
I made a neural network on JS
whats that
I was bored ngl
self.bot.guilds
if that is what you are naming your commands.Bot instance
Where github repository
Hard asf JavaScript 
😐 💀
Where mods
see the bottom of the wepage, its got the link to the repo
oh my god
ashley why does Everybody, indeed, hates you?
wat
😭
..
What
It's 404
i mean, I'm bad 😔 so they do
Where is it
But it makes something automated by communicating with censors on the screen, and then neural network determines what to do then send it back to the screen to go through it
sheesh, idk if I deleted it lmao, will send ya later then
lmaoooo fair
um interesting
It all happens within 0.25 seconds
Dark light
@slate swan wsp?
cool
Try it 
lmao jit tripping
im fine doing online classes wbu
💀 hell no
Yes
imma go and create a dashboard :) for my bot
its not even in 2 servers
I think ill rewrite this one to un-shit this 😔
with no js
Aight i'll check it out later when i remember
short forms
dont its worse than I remember what I wrote
ill just rewrite that lib
rly logs?
at least no one will use it for a database 😔
It's simple
staph, i told you not to
what the
It is driving itself using the neural network
neural network sounds like a brain network
ashley dms
its like ai?
Yes but very advanced
for a second i thought that was among us
In JS with no libs
Nope
💀
hello world on html
2 pings?
no
i pinged once
how to check dpy version
__version__
now i’m django
help
my lockdown command does not work
code:
@client.command()
@has_permissions(manage_channels=True)
async def Lockdown(ctx):
mbed = discord.Embed(
title="Channel on Lockdown",
description=f"{ctx.channel.mention} is now in lockdown"
)
await ctx.channel.set_permissions(ctx.guild.default_role, send_message=False)
await ctx.channel.send(embed=mbed)
@client.command()
@has_permissions(manage_channels=True)
async def Unlock(ctx):
mbed = discord.Embed(
title="Channel Unlocked",
description=f"{ctx.channel.mention} has now been unlocked"
)
await ctx.channel.set_permissions(ctx.guild.default_role, send_message=True)
await ctx.channel.send(embed=mbed)
load_dotenv()
client.run(os.getenv('TOKEN'))
my error is: raise CommandInvokeError(exc) from exc nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: Invalid permissions given to keyword arguments.
commands.has_permissions()
and the reroll cmd?
Im using pycord to develop discord bots, If I have Views in diff files, should I load it in as a Cog?? Or should I just import it as a normal file, and then load em on on_load?
on_ready*
await self.bot.process_commands(message)
why i am getting this?
if origin.author.id == self.user.id: # type: ignore
AttributeError: 'NoneType' object has no attribute 'id'
i made sure to make members = True
your reusing the same code what about creating a func does everything
okay your trying to make a whitelist for members who can use ban/kick/etc command?
you can check if they have a specific role
i don't think you need to do that, but if you want to. i can tell you the steps
you need to fetch_member everytime you want the banner to work, sorry for late reply
!d discord.User.banner
1.first create json file
2.create a command to add a new id or add the ids in the json file by yourself
3.use if stm (if the user in the white list then user ban: user.ban else if the user not in the whitelist or the user in the blacklist then ban: author.ban)
explain
@client.command()
async def ban(ctx, user:discord.Member):
whitelist = load("whitelist.json") # a func to load json : not a build-in func you must create a func by yourself
blacklist = load("blacklist.json") # a func to load json file "blacklist"
if ctx.auther.id in whitelist:
...
else:
...
whitelist json file will have some ids same with blacklist file
json
[
09347,
90237530,
0238257
]
no problem
can someone help me with this error pls
from discord.utils import get
ModuleNotFoundError: No module named 'discord.utils'; 'discord' is not a package
dont use get ong
oh okay thanks and for avatar i used discord.Member.display_avatar.url does that affect anything?
did you had any errors or problems?
@strong vector
what package should i put or something?
what are you trying to do?
hm what are trying to do
making discord bot
this is public command so i am making owner only command
show me all code
@strong vector
you could use any one of the following (recommended)
- Discord.py
- Disnake (fork of discord.py)
- Nextcord(fork of discord.py)
- Hikari
im using sublime
someone help me in #help-dumpling please
it help
it doesn't give a shit now
i mean
it doesn't give a error now
thx :>
is_bot_owner this is a list or id or func
i dont hink is even a thing
@commands.check(is_bot_owner)
@client.command(name="eval", aliases=["exec", "execute", "codexe"])
like this
Member.display_avatar works in this order
- if member has guild specific pfp, it will show that
- if member has a normal custom pfp, it will show that
- if both of them fail, it shows the default one
yeah... but that doesn't answer my ques

idk what's wrong with my code
this is the code
it's saying line 37, at the part of the command prefix
it doesnt work at heroku, but when I run it on pycharm or replit, it works
because you have discord.py 1.7.3 on your pycharm or repliy and 2.0 on heroku
ohh
lemme change the requirements of it then
hm?
why
wait, what's wrong though
just enable it
doesnt hurt if your bot isnt verified
you will also need to add them in your code
but my code works in pycharm, but not in heroku
pycharm and heroku are 2 completely different things
heroku is for hosting and pycharm is a code editor
use 2.0 is better
how do I do this is 2.0 then 🥲
wtf is that
it's saying the error is the command prefix thingy
nvm, Ill just stick to replit for now
in 2.0 you need to pass the intents explicitly

something like this?
wdym
if you don't want someone to see the key . you can just delete it : )
and the code is wrong it must look like this if key not in key_given
yeah
ohh ok ok thank you
how do i make my bot read a block of code? handle the programming lang name
How can I give different messages for different option selected in select option?
For e.g:
If user selects “a” bot sends “b”
If user selects “1” bot sends “2”
help #help-dumpling
Any help?
await ctx.send(embed = embed)
The table is not found. How to solve this?
#Create member database
@bot.command(name = "create", help = "To input your character into our database.")
@commands.has_role("member")
async def update(ctx, input_username, input_data):
await ctx.message.delete()
try:
sqliteConnection = sqlite3.connect("data_sqlite.db")
cursor = sqliteConnection.cursor()
print("Successfully Connected to SQLite")
sqlite_insert_query = """INSERT INTO "table" (key, username, data) VALUES (message.author.id, input_username, input_data)"""
count = cursor.execute(sqlite_insert_query)
sqliteConnection.commit()
print("Record inserted successfully into database", cursor.rowcount)
cursor.close()
await ctx.send("Your data has been created in our database. Thank you.", delete_after = 5)
except sqlite3.Error as error:
print("Failed to insert data into database", error)
await ctx.send("There is an error while creating your data. Please try again.", delete_after = 5)
finally:
if sqliteConnection:
sqliteConnection.close()
print("The SQLite connection is closed")
open db outside function
message.author.id
is ctx.author.id
and for the error remove "" from table
code
The quote works tho, but yes I will remove it
before anything have you created the table?
Thank you very much
he had sent embed not embed = embed
just on a side note, that sqlite is blocking, and you have to create a table to insert data into it
no need for code Ashley V
Okay, I will tey, thank you very much!
pfff nvm
Wdym is blocking?
sqlite, use aiosqlite
import requests
import disnake
from disnake.ext import commands
from yadps.config.data import Data
class BookMark(commands.Cog):
data = Data()
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
pass
@commands.command()
async def bm(self, ctx: disnake.CommandInteraction, name):
await ctx.send(name)
def setup(bot):
bot.add_cog(BookMark(bot))
i got this command, but it doesnt work, i am using disnake, the bot doesnt respond to the command, i have all intents on
the cog is being loaded since the on_ready function works fine
does it send the message?
I see. Thank you Ashley!
doesnt work without it too
send(embed=embed)?
is the cog loaded? do you have an on_message "event"?
!pip aiosqlite all the methods and functions are same, you justt have to await them
i do have multiple on message listeners
Thank you!
listeners wont matter, is there any event?
@bot.event or on_message inside the Bot subclass without a process_commands
help?
yeah, one
you dont have to use the decorators for events within the subclassing class 😔
do you know how to fix the process_commands error?
there isnt such an error....?
um
if origin.author.id == self.user.id: # type: ignore
AttributeError: 'NoneType' object has no attribute 'id'
whats origin?
"Python39\lib\site-packages\discord\ext\commands\bot.py", line 1261, in get_context
if origin.author.id == self.user.id: # type: ignore
AttributeError: 'NoneType' object has no attribute 'id'
show code?
add await self.process_commands(interaction) in the end of that
thanks, thats really too helpful, your error may just fix itself after the embarrassment 😔
yoo that works
actually, just change @event to @listen()
async def on_message(self, message):
for webhook in self.webhooks.children:
self.webhookObject(webhook)
print('Message from {0.author}: '.format(message))
print("Message from {0.author}:{0.author.id}[\"{0.content}\"]".format(message))
print(message)
ctx = await self.bot.get_context(message)
print(ctx)
is this a new thing? i dont remember this being like half an year ago
what...
this is not the full code, is it?
it jsut doesnt make sense it must work
its been there for a long time, since commands.Bot got added
weird
i am damn sure i didnt need it before
maybe you never subclassed with on_message earlier?
probably
hii, could anyone help with how to make a modmail bot??
😄 yes sure
thank youu
shame
so what should i do first
Um?
Any response yet?
what experience do you have with python?
i don't know how to work with that
Can you show the whole error?
new to it
yes
i would suggest you to look into Object Oriented Programming concepts and asyncio before starting with it
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\brain\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 375, in _run_event
await coro(*args, **kwargs)
File "C:\Users\brain\Desktop\progrem use\Tests\python edit packs\DisWebhooker\commands\webhook.py", line 180, in on_message
ctx = await self.bot.get_context(message)
File "C:\Users\brain\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 1261, in get_context
if origin.author.id == self.user.id: # type: ignore
AttributeError: 'NoneType' object has no attribute 'id'
u mean buttons or selection drop?
oh, i just came here cause its urgent
Hmm, can u print self.bot.user?
if thats a webhook message, that wont have an author
and guessing by the file name, you are probably doing it..
huh i didn't think about that cuz i didn't get this error befor
and everyone said its easy here
well you would have to make a communication between user dms and a server's channel
on_message event or a command would be ideal for this
hm i can show the full code but i don't want to send the code here
someone said the whole code is here
so idrk
it is , @novel apex is open source irrc
oh, where is it?
which file should i open?
i am dum af it was the bot.user i was try to fix this like for 3 hours 😂 😭 🥲 i have confusing feelings right now
send the full code?
there isnt a single file for the bot, its divided into cogs
oh
nope, its commands.Context
i have referenced this code a few messages ago
Select menu
alr
oh yeah mb
oh its not my code
someone else sent it here for help
And wth happened here?
no
@client.command()
async def hello(ctx):
await ctx.send("hello", components = [
[Button(label="Hi", style="3", emoji = "🥴", custom_id="button1"), Button(label="Bye", style="4", emoji = "😔", custom_id="button2")]
])
interaction = await client.wait_for("button_click", check = lambda i: i.custom_id == "button1")
await interaction.send(content = f"{await ctx.send(embed=embed)}", ephemeral=False)
code ^
oh...
you sent the complete message object
its ctx: commands.Context
thanks 👍
np
i dont recommend using 3rd lib, pretty sure you're using discord_slash
hey
^ 3rd party libs are bad, and outdated as for now
use dpy v2 instead
yes
or disnake
Um how can I install it?
i tried discord slash once
make a timeout or the bot going to wait forever
discord.gg/dpy see #guild-news in that server
need help
*, name
!docs discord.Guild.create_role
await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., display_icon=..., mentionable=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") for the guild.
All fields are optional...
Your asynchronous things colour is weird
and create_role takes a keyword argument "name". its not positional
suggest me bot ideas :?
server clonner
How can I install it?
V2.0
can u make servers with bots?
nice idea.
yea till some extent


