#discord-bots
1 messages · Page 57 of 1
Is it the same with sql and regular Python
It’s probably very similar
Ok
I know how to fork but how to like get it to work etc
pip install git+your_fork_repo_link
I know that yes
Just replace discord.Embed.Empty with None and install with pip install git+https://GitHub.com/link
I don't have an discord.Embed.empty
The module u are using does
....
So u gotta either ditch the module ore fix it urself
...
Fork it on GitHub make the changes then install it
Needs to be a fork for it tho
You are gonna fork it
yes thats what I meant
I have no clue what I’m doing
With the fork button
how would i go about making a cmd that gets the users id, channel, and guild then proceed to dump to json
WHERE id == 6
I will just make a new help command ig
Take it a bit slow
Oh I was kinda close
Nah u can click the fork button and make the changes urself
=*
I mean the github
Both work I think
im not sure if == works
for pag
Oh yeah then either the open site packages thing or make it all urself
Just making a full new command imo
?? This is hard for me, damn
== didn’t work either
It’s probs just me doing everything wrong
please learn more, you completely dont get it
None work
Well they must have told u the method to do it above
is there a way to do message.content.startswith() but checks what it ends with?
message.content.endswith()
lol
🤣
bye
just installed discord on xubuntu and it already says its installation is corrupted kek
how would i go about making a cmd that gets the users id, channel, and guild then proceed to dump to json
of course 
anyone know how to return what the last word in a message is? So like assign it to a variable. Thanks
content.split()[-1]
e = message.content.endswith()
no
alright
thanks so much!
take his
This is the method but I don’t understand it
try asking #databases, because for this channel most likely no one is going to explained something that is already explained
well im not sure if it will be explained in databases either but at least more chances
Ok
Can a bot press a button Ager a certain time ?
color= not Color=
nah it never was
still errors, discord has no attribute 'color'
Like
MSG = CTX.send(embed = embed , view= view)
Await Asyncoi.sleep(290)
If msg.view !=none
#press button in view class
Something like this ?
no i meant the color kwarg
oh mb lol
wdym
So there is a game with 2 buttons , is join , second start(only the person how started game can click) now i want if the person started don't click on button for next 3 min it automatically pressed and results comes
I build it till 2 buttons without autostart
well the best way is to create a method in the view to start the game instead of putting the code for it in the button. you can call the method in the button and if they dont click then call that method
class MyView(discord.ui.View):
def my_method(self):
...
@discord.ui.button(...)
async def button(self, ...):
self.my_method()
async def cmd():
view = MyView()
await send(view=view)
#later
view.my_method()
This is how this game working, but now tha join count should be more then 4 or owner should start !
so you want the game to autostart after a certain amount of time?
2nd last like line i put
await asyncio(120)
If message != None
view.my_method()
Right ?
can someone help me pls
Yesss
If no one start
If it start view will be none
yeah so define a method to start the game within ur view and call it in the start button. if not one starts it then you can call that method
Like if i do
msg = await ctx.send("ok" , view = view)
Then
If msg.view != None
Will work ? Will it give t/f values , or nothing exists like msg.view ?
no i would set an attribute in the view class and set it to True in the start button. then u can check that attribute
Off got it , it will be true if no one press start , else if some press it becomes false and view.my_method never runs ? Am I right ?
well let me send an example
Ohk k 😳
class GameView(discord.ui.View):
def __init__(self):
self.started = False
super().__init__()
def start_game(self):
self.started = True
print('game is starting')
@discord.ui.button(label='start')
async def button(self, inter, button):
self.start_game()
async def cmd(ctx):
view = GameView()
await ctx.send(view=view)
await asyncio.sleep(60)
if not view.started:
view.start_game()
is there a way to see if a user pings someone in a channel? Not specifically the bot, just any other user
check message.mentions
!d discord.Member.mentioned_in paired with on_message
mentioned_in(message)```
Checks if the member is mentioned in the specified message.
tyty
or what robin said
o
oh you said any user, my bad
depends on how u wanna do it
ye like if i pinged Robin, the bot would see that and say, save robins userid in a variable for example
i see
yeah message.mentions is better no doubt
Oki ill look into it a bit more when i get home ^^ 
Any clue?
Hey @limber bison!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
https://paste.pythondiscord.com/oposaseniq
i did it ? thankssss bossss 💙
yo nice job but i dont think ur awaiting view.start() at the bottom of ur code
hmm lol sory 😂
nah happens to everyone
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
who know tutorials how to do music bot with spotify?
Can’t
At least not AFAIK
u know bot hydra?
No
this bot steaming music from spotify, and i wanna to do similar bot... how to get music from spotify?
Think you need premium
why ?
I’m sure it’s against their TOS
They probably take the name and stuff out of the Spotify link and then search on yt which breaks the tos
I will use it to make afk command 😳
.-.
i have a host but i'm just coding now !
i don't want to waste it for just coding
If you’re just coding it use VSC
i have problems on it
Which are?
wait
python files don't run
You need to await it
Make sure you have the python extension
U can host things on you pc mean Running a program 24*7 called hosting
i have it
And python itself 😳
already installed
Hmm try
how to see if a member is in a voice channel?
if member in voice_channel.members
@slate swan do you know about sql and discord.py
Ok I’m trying to get users input so I can use it to get what the user wants the permissions to be, I’m learning sql tho
Do you need only the basics of sql for this?
To use commands
So only the basics?
What would that do
And what’s cursor.expedite
Execute*
Did you get it from Google?
The code
How don’t you know what it does tho
What does it do?
Oh ye that was autocorrect
Ok
Can I show h my code and you can tell me what to do?
@bot.command()
async def permissionpurge(ctx, perm):
await (f"You have chosen to use {perm} as the permission to use the purge command")
@has_permissions(administrator=True)
async def purge(ctx, amount = 1):
await ctx.channel.purge(limit=amount+1)
await ctx.send(f"{amount} messages have been purged!")
That’s what I have
That’s never gonna work in a 100000 years
Rn I have it set to admin so I don’t get errors
What I tried to do was get the users argument and use it as the permission they want for people to use that command
@client.command()
@commands.guild_only()```
is there an @ command to only allow admins to use the command
Oh I though I meant that code was for admin only lol
You can do it, yes
Sorry I misunderstood you
You don’t have to have the .core after.commands
Oh wow that's awesome
@ has_role(rolename=True)
Without the space
No
I don’t think it’s like that
Does it work?
@slate swan can you help me?
I mean the command works but Idk if it checks if I have the role or not
oh yeah it does work
Ok
Thank you both so much for all of your help
has_permissions and has_role have different syntax then
^^
AttributeError: 'NoneType' object has no attribute 'connect'```
It means the member is not in a voice channel
Or your intents are not configured properly
and in discord developers portal all turned on
Is the user in a voice channel?
yeah
Does the bot have access to view the voice channel?
Is it possible to make a database table through replit
Can you create files? If yes, then you can create a database
doesn't replit have their own shitty database or something
Idk tbh
I’d probably use sqlite instead
I’m only using replit for 24/7 🤣
Get a cheap VPS
well the file name and extension doesn't really mean anything
it's what's inside of it
Nextcord ☹️☹️☹️☹️
hi, is there a way to make role menus like this still work even after rebooting the bot?
You want persistent views, they take use of custom IDs instead of allowing the lib to generate their own
Yes there is??
Bro 💀
https://github.com/Rapptz/discord.py/blob/master/examples/views/persistent.py take a look at this
You did the intents and everything on another file @slate swan ?
I'll check that, thank you!
No worries :) Lmk if you have questions
I don’t use it?
Did you import it
So how could I help you
So…
No it’s not, it’s not fully typehinted, the code standard is awful, there’s no library consistent formatting, they ignored the predicates set by d.py
why doesn't it work when i get message.author.id with this event
What doesn't work?
Whether message content, attachments, embeds and components will be available in messages which do not meet the following criteria:
• The message was sent by the client
• The message was sent in direct messages
• The message mentions the client
This applies to the following events...
if you have them activated then the condition isnt true
intents are true
can you show them?
Can you show your code? You should change your variable naming as well
my entire code?
ahh data type error
yeah 😅
so what should i use instead
remove the quotes in the condition so youre comparing the same data type lol
in order to run pip install discord do you have to have the discord app or can it be the browser version
I hath returned!
Making a section of code that splits a message sent into individual words and then tries to add an emoji to that message based on the words used.
e.g. If I said "I love cookies and cats" it would add both the 🍪 and 🐱 emoji as a reaction to that message
I've got this so far --
scan_reactions = lowered_message.split(' ')
print(scan_reactions)
for x in scan_reactions:
print(f':{x}:') # Debug
await message.add_reaction(x)```
**Questions**
How do I make the code continue running even if it runs into the "Emoji not found" Error?
What am I supposed to put in 'x' within `await message.add_reaction(x)` cause it doesn't like strings like 'cookie' or '\:cookie\:'
And lastly, what's the best way of doing things like synonyms?
E.g. having 'love' in the message would add the ❤️ (\:heart\:) reaction
I think I've got a way, but it would be extremely inefficient
you'd loop through every word and find the key value structure in a json format or DB which stores the emoji
example
{
"love": ":love:",
"like": ":thumbsup:"
}```
```python
some_message = "I love you"
new_message_words = []
for word in some_message.split(" "):
replaced_emoji = data.get(word.lower()) or word
new_message_words.append(replaced_emoji)
new_message = " ".join(new_message_words) # "I :love: you"
you could replace the value with a unicode of the emoji or whatever
import discord
from discord.ext import commands
TOKEN = ''
bot = commands.Bot(command_prefix='?')
@bot.event
async def on_ready():
print('I am running!')
@bot.command()
async def hello(ctx):
await ctx.reply('Hello There! 👋')
bot.run(TOKEN)```
I keep getting this error (yes i am ware that the token variable is blank, thats because I dont want others to get my bot's token lol): ```Traceback (most recent call last):
File "main.py", line 6, in <module>
bot = commands.Bot(command_prefix='?')
TypeError: __init__() missing 1 required keyword-only argument: 'intents'```
this has to do with breaking changes since v2, check the migration guide
the intents kwarg is now required
I used the intents kwarg prior but now my commands arent working? plus the same code works in a different bot that I made?
you need to add message_content intents
that's most likely because that other bot runs on discord py 1.7.3; while your new bot runs on dpy v2
Ah that makes more sense
if you know why would you use it as bot.connectodb
error says it all, you're calling a method connecttodb() which isn't a method of the bot class
subclass Bot class and add that method to your bot
you most likely want to extend your bot class and add the method there
hi! how can I allow only one person to interact with the bot drop down role menu?
only works on interactions
it's not like I haven't tried
yeah
I wanted it to be ephemeral but it's not possible so I want to restrict it to the person who triggers it
make an interaction check....
!d discord.ui.View 1 minute
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.
oh, that's right, thank you
!d discord.ui.View.interaction_check overrided this Visw method and return True if interaction author is same as the command author
await interaction_check(interaction, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.
This is useful to override if, for example, you want to ensure that the interaction author is a given user.
The default implementation of this returns `True`.
Note
If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View.on_error "discord.ui.View.on_error") is called.
Why does my command appear twice and how do i fix it
show code
your first made the command guild binded and then global, kick the bot and add it again to fix this
nice database
oh you removed the password good
@client.command()
async def search(self, ctx, query: Option(str)):
msg = await ctx.respond(f"Searching...🔍")
embed = discord.Embed(title=f"Search results", description=f"Query: {query}")
for j in search(query, num=5, stop=5, pause=2):
embed.add_field(name="Search result:", value=j)
await msg.edit(embed=embed)
```
what's the error here
I tried what you said but my commands are still not working
What error are you getting?
ok
show your intents code and bot var
OOPs concept 💀
discord.ext.commands.errors.BadArgument: Converting to "Option" failed for parameter "query".
Oh-
learn oop and how to subclass objects. I'm not spoonfeeding
import discord
from discord.ext import commands
TOKEN = ''
intents = discord.Intents.default()
intents.members = True
client = commands.bot(command_prefix=';', intents=intents)
@client.event
async def on_ready():
print('I am running!')
@client.command()
async def test(ctx):
await ctx.reply('Hello There! 👋')
client.run(TOKEN)```
enable message_content intents
i don't see them enabled here
add intents.message_content = True before client = ...
you invoked the command without providing a query
It worked! Thank you somuch
What are some good and cheap bot hosting services? I used to use uptime bot when I used to use replit but I shifted over to vsc so yeah 💀
self host ~
What do you need help with
Do you really think you are ready for it?
I'll get banned
Banned from what?
you need to learn python first
https://learnpython.org is a great starting resource, however there's tons of ways to learn
Plz
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Nono
No one will make a bot for you here
Someone do it plz
What u want
It isn't allowed
Why
just make it yourself
Read the rules
Ok?
I don't know what your situation is but no ones gonna make you a bot here
look man, python discord bots are really easy to do nowadays. Take the python tutorial and make a bot. Worst case scenario you don't finish in 24hrs
Ok if I don't finish 24 hrs
Strings are surrounded by either single quotation marks or double quotation marks
Nonon
Literally nobody will make you a bot
print("Hello") # string
print('Hello') # string
Yes thanks for bot
you made the whole bot that quick?
Author bot
this isn't a discord bot?
you are confusing
why do you need our help with python if you already know Java?
Sorry it's hard
take your time typing
you're so confusing
any Java dev should pick up python easy
Is there a discord library in Java? I found https://github.com/DV8FromTheWorld/JDA
Java wrapper for the popular chat & VOIP service: Discord https://discord.com - GitHub - DV8FromTheWorld/JDA: Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Thanks
Yeah, it's actually very popular
If you already know Java then just make your discord bot in Java..
I would disagree, thats like doing a surgery from a tutorial it doesnt mean youre a surgeon nor does it mean you can do any operation given to you
I love ujava
Thank you
how do i mention a user with a discord bot?
Is it not .mention?
!d discord.User.mention
property mention```
Returns a string that allows you to mention the given user.
python
@slate swan nvm
oh ok i'll try it out
Um
Nvm
Well since Noone helps
Plz least time idk python
I need people
Not viedo
We can't help you with non existent code and non existent knowledge
@slate swan
I think you misunderstood what I was trying to say. Any Java developer probably (if not knows) the fundamentals of programming in itself, and unlike others who are just starting can pick up python faster.
the animation when receiving a message on the new mobile client is so unfluent
Vc 1
fr
Thank you
@mystic lotus vc1
I did that but it just returns property and then a bunch of random numbers
no
Learn some basic python, you won't be able to make a discord bot without knowing at the very least the basics @woven imp
nobody is making you a bot - do it yourself or find one that works for you
Plz I need people
I younot help I'll find someone else
Even if you have the knowledge of OOP and other specs in a language it doesnt mean its easy, you would still need to learn syntax language abstractions and library abstractions
You have to learn
That's what I should do
we'd be more than glad to help you if you actually make a bot and you actually made some code
I'll find someone that knows python.
why are you thanking me? i was giving an opinion lol
Ik
A lot of people here know python..
not including me
No they dont
They do.
Only noid
what
@slate swan show me
Show you what?
Bro thinks he's cool
What?
This whole chat is confusing me more than a level i can comprehend
@slate swan bro sraced
kick the dude or something
right, (sorry it's really painful to type on mobile so I always miss stuff) all I'm trying to say is it's probably going to be a little faster to pick up another language when you already know a different language
Can't do anything my guy
<@&831776746206265384> I think he may be trolling, not to sure..
I would agree but you shouldve worded it better, it would be easier to pickup but it doesnt mean the whole topic is easy to learn with no base knowledge
I'm playing with u
you do have to be trolling there's no way none of this makes sense
supposed to return strin but it just returns property
definitely should of worked that better, but I 100% agree with you
because you never used an instance of the class
worded*
Look man, if you are somehow serious, you need to know at the very least the basics or you're gonna be coming back here every 5 minutes for help @woven imp
Ok
if you dont use an instance on the property it would return the object and not its value
what code did you use?
^
Please speak english man
Sigh
await channel.send(discord.User.mention)```
Help me bless their little dirt hearts
i'm correct.
the only excuse for this is using an iphone 4 keyboard
no no
he has to be trolling
How
there's no way
What are you gaining by trolling? Happiness? because to me its sad that youre wasting your time here trolling
you need to have a user object
instance*
yeah for real
so I have to put the ID of the user?
im hella confused lol
I barely know oop
What are u weeb what a nerd
Leave pal
shut up Mr Minecraft pfp
Code battle
me after NotInferno_ calls me a nerd: 🤓😔😕😞
I think this has gone on for long enough. Please read the #rules and the #code-of-conduct and be respectful to other memebrs
Ok
Thank you 😄
But
Now, shall we get back on topic?
Listen out
If you've got an actual question, we'd be more than happy to help
Is it discord.py?
I need more explanation
Make robin a moderator so then hes more vulnerable to being ban due to his behaviors and actions at such a high level in the role higherarchy
Some kid sent tutorial that is useless

Ask the question
did you actually read the whole tutorial?
oh wait i think now i get what you mean
Can we talk
You cant blame a tutorial if you never read it.....
We are, are we not?
In depth about general of python
wrong channel
I code java
that would take many hours to discuss
Not python
If you have the user id you don't need .mention
some_id = "id"
await channel.send(f"<@{some_id}>")
and years to understand
see ya
IIRC you can get the user id from the user object, am I wrong?
correct iirc
You can, and also the other way around
discord.user.id or something like that
btw have you guys seen the new feature about slash commans mentioning? looks cool
If you're just mentioning someone an ID will suffice
Got any docs on it?
oh yeah
Haven't really used it yet though
some people still prefer old prefixes rather than slash commands
discord.gg/discord-developers | the format is </command_name:command_id>
you can get the commands id when invoking it
let me try in a test server
oh that is so cool!
HTML closing tag type shit
lol
Robin swearing? instant ban
no but it actually looks like html tags kek
fr
when you invoke the command and get the response/reply hover over the blue text and left click it if youre on desktop and it will say to copy the id
aw it's not on mobile yet
settings > integrations > right click command > copy id
if youre on mobile its probably holding your finger on the blue text btw
@primal token Is your pfp Hiro ?
that's hiro's code iirc
yes
I didn't even finish that anime
I watched 6 episodes
Yeah doesn't look like it's here on mobile yet
no no invoke it
I did
when you invoke the command it will send a response message
when you tap on the blue text that menu comes up
i did though
how did you invoke it
just checked it and nvm its not
reason why mobile client is trash
meh, oh well
I hate the mobile client
I'll look at it tomorrow
slash commands don't even work half the time
native > react native
I use the one you download from the discord website
off topic but surprised discord doesn't allow 3rd party mobile clients
they dont due to exploiting the api with plungins and automation
its not really exploiting but some plugins can see a users current device
people say its not a problem using modded clients until they catch your token uppon making a request and some also just take your logging info kek
if user == None:
user = ctx.author
these are equal right?
user = user or ctx.author
not exactly
or checks if the first values boolean value is Falsy while the first check if the value is None
!e
print(False or True)
@primal token :white_check_mark: Your 3.11 eval job has completed with return code 0.
True
both would still work though right
yeah, but it would depend if youre checking specific types no matter there boolean value
can't you oneline check if it's None too?
the only reason why the second check would work is because None's boolean value is False and it doesnt check identities
like a different way though
ctx.author is user is None else user
user = ctx.author if user is None else user
How does all those 'is' work?
!d is
@primal token :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
002 | True False
is just checks if the object on the left and right are exactly the same, or are pointing to the same thing. None is singleton i.e only one instance of it is created so we is here instead of ==
How can I like make a command which is available in both slash commands and prefix?
hybrid commands
Any example?
in this case its better to compare identities since None is already an instance of NoneType over checking boolean values making every None reference point to the same instance of NoneType
i have a problem where a slash command appears twice, I kicked and added it back and it was a single command now but when i ran it, it created an error
then when i restarted the bot there are repeated commands again
seems like a syncing problem
don't autosync I'd say
any help?
reinstall dpy I'd say
or better yet, update
since you're most likely on v1.7.3, and discord ui is for dpy v2
why do you have self in function which is not a method?
check your packages, if there's a discord package, remove it and add discord.py instead
I was thinking of making message collectors that can be used with decorators and can take arguments like, per message, per channel and per guild collectors, and the function when decorated gets called and passes one argument being, a list with tuples, which each tuple has the time when the message was sent and the message, i was also thinking of having a content checker to only collect messages with a certain content and i was also thinking of being able to provide regex patterns anyone want to work on it with me?
how
i know how to do it but i lack a bit of skill on the regex part
these gists should have their own command here
you can always make a pr lol
Collectors were very neat
I remember making my own collectors for my own discord API wrapper
https://github.com/an-dyy/Rin/blob/70066f04157a20a08cfe65ce9235ce65d35f8be3/examples/collector.py#L1-L27 looks pretty good too
making a wrapper is easy its just models are a pain
and making good abstractions and having a good codebase
Models easy, good codebase is somewhat harder
It's quite a task to keep everything in order
that is so
looks nice, props to you for having good original abstractions
To bad the wrapper is dead
i only made base models and my message model then i stop developing the wrapper because of so much endpoints and especially how much rewrites i needed to do, i always wanted a good codebase and modular abstractions
modular as in not bounded to any bad abstraction
Undead it !!!
Instead of hard coding the endpoints just make it procedural
Don't do a discord.py and have like a 1k+ line file just for HTTP
kek, my HTTP client was only like 72 ish lines
and was modular so you couldve used it for any other request handling over dpys that passes your token on to each header per request
🗿my rest/client.py is like 700 lines atm ( including docs )
Lets hope we get some sane code
mine just used locks kek
haven't touched my code since 10 days
haven't touched coding since 3 months
won't be coding for another year
I've been touching grass 💅
i havent touched mine in maybe 4 months or more
uni?
Ain't yr JEE over now?
Why tf won't u code now 😐
im not in university but its a pain lol
He is giving jee again !!
need like 98%+ to get in iit
Niceee
I forgot he's our Einstein
preparation for college :p
kek
it is, but i got like only 70% so yeah, drop
msg = await ctx.send(“hi”)
How can I delete this message ?
await msg.delete()
sounds like a type of jungle animal
And for bot.msg = await ctx.send. . .
It would be await bot.msg.delete()?
hi
hello there
General kenobi
can you help me with slash commands? I am doing a test on a bot i contribute to and testing a command i get this error ```py
Traceback (most recent call last):
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 851, in _do_call
return await self._callback(interaction, **params) # type: ignore
File "/home/maskuhpq/status/bot.py", line 114, in add
if interaction.guild.me.server_permissions.manage_channels == False and lock == False:
AttributeError: 'Member' object has no attribute 'server_permissions'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1240, in _call
await command._invoke_with_namespace(interaction, namespace)
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 876, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 869, in _do_call
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'add' raised an exception: AttributeError: 'Member' object has no attribute 'server_permissions'```
darth vader

code: py if interaction.guild.me.server_permissions.manage_channels == False and lock == False: await interaction.response.send_message("In order to lock the server I need to have manage channels permissions") return
guild_permissions*
for slash commands?
for anything....
they dont change everything
only a couple of things
ok so what should that read? py if interaction.guild.me.guild_permissions.manage_channles == False and lock == False: await interaction response.send_message("") return
^
wdym?
what is wrong with that
oh yeah
is that how it should be written?
you removed a lot for some reason
explain?
it's guild_permissions instead of server_permissions
and you removed guild.me for some reason
there i revised
working on it
Traceback (most recent call last):
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 851, in _do_call
return await self._callback(interaction, **params) # type: ignore
File "/home/maskuhpq/status/bot.py", line 114, in add
if interaction.guild.me.guild_permissions.manage_channles == False and lock == False:
AttributeError: 'Permissions' object has no attribute 'manage_channles'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1240, in _call
await command._invoke_with_namespace(interaction, namespace)
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 876, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 869, in _do_call
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'add' raised an exception: AttributeError: 'Permissions' object has no attribute 'manage_channles'``` instead
typo
channles
good to know
should be channels
where is the typo
wait nvm
it went
this error is on me i think it is a mongodb error lol
application did not respond no error in console
show code
entirely?
wait it was slow to give error here is a paste bin to the error
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
you there
yes, the error is big, you know, i'm reading
ok double checking
looks very weird, send the code of the command
wait i might of found the issue my isp has decided to change the ip every now and them for the public ip and it may not be whitelisted
no idea what that means but ok
pymongo
and by the way, use async db to not block the asyncio event loop
that might a problem too
You mean an async driver?
im not huge fan of blockingio, i dont remember what it certainly blocks
ik just haven't changed to motor
What
what
that fixed it lol
how did you switch to async db that fast 
I think you need sleep, your sentence gave me a stroke
It's normal here
lol no allowing my ip into the database lol
me literally just woke up
go to sleep again
Yr brain is still sleeping
why?
oooo Master Oogway in Training is online already
but not here
You need a restart or else your brain processes will crash due to memory corruption
idc
kek
Error. Error. Error. System Restarting......
ReBoOt SucCeSsFulL, yuo chan eb fre
maybe ill go play minecraft
Phew, at least u ain't Windows, that can't fix a single thing if it crashes
Unfortunately, brain has stopped
:LMAO: :KEKW:
Sorry, an error has occurred in the noid system, and a false warning has been issued.
i never get errors, because i am the error kek
aight, gonna play minecraft, ping me when @cerulean shale comes here
(right now cus i pinged him)
@app_commands.command(description="Get the down message for your bot")
@app_commands.describe(member="The user to get the down message for")
async def config(self, interaction: discord.Interaction, member: discord.Member):
user = bot.get_user(member.id)``` it says bot is not defined
I think this is a cog, so self.bot?
tried that
what do you have in __init__ of the cog
property client```
The client that is handling this interaction.
Note that [`AutoShardedClient`](https://discordpy.readthedocs.io/en/latest/api.html#discord.AutoShardedClient "discord.AutoShardedClient"), [`Bot`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot"), and [`AutoShardedBot`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.AutoShardedBot "discord.ext.commands.AutoShardedBot") are all subclasses of client.
Traceback (most recent call last):
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 850, in _do_call
return await self._callback(self.binding, interaction, **params) # type: ignore
File "/home/maskuhpq/status/cogs/misc.py", line 52, in config
user = self.bot.get_user(member.id)
AttributeError: 'Misc' object has no attribute 'bot'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1240, in _call
await command._invoke_with_namespace(interaction, namespace)
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 876, in _invoke_with_namespace
return await self._do_call(interaction, transformed_values)
File "/home/maskuhpq/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 869, in _do_call
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'config' raised an exception: AttributeError: 'Misc' object has no attribute 'bot'
🤢 Danny him self named it client
Everyone hates that but Danny ¯_(ツ)_/¯
what's in your __init__
of the cog'
He has nothing
makes sense
what else would you call it
At least no self.bot
.bot too, but eh, ig too much work for Danny to make a proxy 🤷♂️
What the fuck
import discord
from discord import app_commands
from pymongo import MongoClient
import os
# database connection
cluster = MongoClient(os.environ.get("mongo"))
db = cluster["discord"]
collection = db["status"]
class Misc(app_commands.Group):
"""Misc commands"""
``` not there
that it then to commands
.bot would imply that people using discord.Client wouldn't be able to access that attr
so colours and colors is not much
He just had to do self.bot = self.client or smth, just like disnake has done
!d disnake.Interaction.bot
property bot```
The bot handling the interaction.
Only applicable when used with [`Bot`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Bot "disnake.ext.commands.Bot"). This is an alias for [`client`](https://docs.disnake.dev/en/latest/api.html#disnake.Interaction.client "disnake.Interaction.client").
It did take time. Nice
cough cough
But eh, ig Danny doesn't really care 🤷♂️
I told u the issue
use interaction.client
interaction.client, not bot
istead of bot
cough cough
why is cooldown at app_commands.Cooldown?
burh
Or at least haven't coded since a few months
lovely a application didn't respond but no errors in console lol
Code
you know i say that and the console spits one out ```py
localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 63085f7ed07bc127e921d54c, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused')>]>
Huh
what i said
@app_commands.command(description="Get the down message for your bot")
@app_commands.describe(member="The user to get the down message for")
async def config(self, interaction: discord.Interaction, member: discord.Member):
user = interaction.client.get_user(member.id)
try:
results = collection.find()
for result in results:
if str(result["_id"]) != str(user.id):
await interaction.responce.send("Hm I can't find that bot in my database!")
pass
else:
for query in result:
if str(query) == "_id":
pass
else:
server = result[query]
channel = interaction.client.get_channel(server[0])
down_message = server[2]
auto_publish = server[3]
lock = server[5]
embed=discord.Embed(title="Config", description="Shows the config of the selected user")
embed.add_field(name="Down Message", value="{down_message}", inline=True)
embed.add_field(name="Channel set", value="<#{channel.id}>")
embed.add_field(name="Auto Publish", value="Auto Publish is set to {auto_publish}", inline=False)
embed.add_field(name="Lock", value="Locking the server is set to {lock}", inline=True)
await interaction.response.send_message(embed=embed)
except Exception as e:
print(e)
pass```
there ^
still not async db
The Aplication no respond without that last error
i haven't learned motor yet
also the console spit up this ```py
localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 63086050a98638b71e78bbb9, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused')>]>
you arent hosting your db lol
It raised that error as you arent hosting your mongodb server, thats what i can assume as mongodb's default port is 27017
Ok so how do I fix that?
It is fine with the connection string I used on other commands
⁉️
Wait do I need to define the database again in the cog let me try that
i did tell it how to connect now i'm confused
yo i have a question i defined how to connect to the database so why is it attempting local host when the connection string isn't local host?
await interaction.response.send_message("test") AttributeError: 'Button' object has no attribute 'response'
@ui.button(label="test",style=discord.ButtonStyle.green)
async def menu1(self,button:ui.Button,interaction:discord.Interaction):
await interaction.response.send_message("test")```
any idea?
your order of args is probably wrong
what's wrong?
I just told you...
what's wrong in my order of args
flip button and interaction
Can someone help me i have a discord.py pterodactyl egg but its not working
did you check line 11 in main.py?
oh yeah it works now, thanks!
like to store all messages into some database?
not really... for what purpose?
possibly mod/admins can look at later
just storing the ID is all you'd need
unless you want to "snipe" them
~ recover when deleted
what if the message gets deleted though
better to get the message content too imo
y9#8009: better to get the message content too imo
then I'd just store it when on_message_delete gets called...
so you'd have a DB of "deleted messages" that might have explicit language or whatever
well, just use channel.history() for that...
if it's well structured and ACTUALLY in a db instead of a txt, then sure ig
I wouldn't say it's bad practice
pretty sure a lot of bots do it
like ticket bots save transcripts etc
Yeah
never recommend storing stuff in json or text files
I'm not too sure probably a good choice
I usually hear about sql and mongo
I don't know much about any of them
good luck
the async wrapper ~asqlite or aiosqlite preferably
Is it possible to keep an active connection to a server using a discord bot?
hey m back
Welcome back
why not?
I was thinking of something like this https://pypi.org/project/rcon/
Hi @silk fulcrum i have quetion. I'm imported file config.py and system created this folder:
is it normal?
yes, just cache
okay, thanks
yeah, python keeps creating cache
btw, if you have a git repo add it to .gitignore
what is that
rcon, remote connection to a server lol
no i haven't
ohkay
so what's the problem?
Just want to know if it'd work with discord bots or not 🤔
why not? like db connection and aiohttp client session for example work
as i see it has async support
so everything's gud
how?
mhm
Yes and you can disable its creation if you want to by setting the env var PYTHONDONTWRITEBYTECODE to any non-empty string
Could I compare something to every variable in a list instead of individually writing everything out in a long if statement?
E.g.
If I wanted a command to not run in a few different channels, then I could do
if channel.id != channel_id_1 and channel.id != channel_id_2 and... and channel.id != channel_id_30 and...:
Do stuff
or, could I do something like:
channel_ids = [
id_1,
id_2,
id_3,
...
id_20,
]
if channel.id != channel_ids:
Do stuff
if channel.id in channel_ids?
all(id in your_list for id in ids)```
The stupid thing is that I legit just used that in a command I wrote an hour or so ago 
the heck
Wouldn't master's work though?
Ok
Thanks again, Master! 
That wasn't for him
:NotLikeThis:
I was just typing random stuff
ы is a nice letter
no doubts
In my code I name all the variables starting with ы
why the heck
Public names start with single ы, protected with two and private with three. Static ones always end with ы
And constants start with capital Ы
my gosh what the heck is all that
I do something similar, one hashtag for comments, two hashtags for commented out code, three hashtags for Command start and ends, four hashtags for extremely important stuff
that is not that weird
that has logic
ы_id = 123748294959029284747 ########## ыыыыы ыыы ыыыыыыыы```
Rxh's
My name is Exenifix
Can't you read base64 encoded strings
i will name my variables starting with ъуъ
I KNEW I RECOGNISED THE FORMAT,
but still, I don't exactly expect people going around saying their names in base64
ъуъ_guild = 56789865678876
!e import base64
print(base64.urlsafe_b64decode(b'RXhlbmlmaXg=').decode())
@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.
Exenifix
he's name is Exenfix, he has base64 only for this server
I can see that -- I usually call people by their nicknames on a server, not their username
Would you call me Nexus or copy paste my actual username?
hm....
I would call you in base64
;-;
kall me by nick @pulsar bridge
!e import base64
print(base64.urlsafe_b64encode(b"Nexus").decode())
@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.
TmV4dXM=

Hello TmV4dXM=
😭
Hey guys how can I make a discord bot only using socket builtin
this is ot3 who are you talking about? what is topic?
why everyone says ciao
use base64
Okay good idea
ciao
what it means in eng
bye
it's Italian
well if from italian then hi
@bot.command(name="test", description="jakiś")
@has_permissions(administrator = True)
async def test(ctx, member: disnake.Member):
await ctx.member.send("siema")```
how to send a message for this object member?
if in english its synonim to bye
it's just member.send
member.send("siema")
No need for ctx.member
why the hell are you using ctx.member if you get member?
coz it's cool
!e import base64
print(base64.urlsafe_b64encode(b"<Snipy object at 0x7e66f0b1f0>").decode())
@glad cradle :white_check_mark: Your 3.11 eval job has completed with return code 0.
PFNuaXB5IG9iamVjdCBhdCAweDdlNjZmMGIxZjA-
ctx.test
thanks boys
ctx.db
hey PFNuaXB5IG9iamVjdCBhdCAweDdlNjZmMGIxZjA-
Hey PFNuaXB5IG9iamVjdCBhdCAweDdlNjZmMGIxZjA-
I have another idea
!e py import base64 print(base64.urlsafe_b64encode(b"Master32").decode())
@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.
TWFzdGVyMzI=
we are pretty similar
use it as a token
imagine some social media actually uses the b64 of usernames as tokens
!e import hashlib
print(hashlib.sha256(b"Exenifix").hexdigest())
@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.
9047064c7ec960627a11743bfa49b0af3e8dd702ef771cec3e908b5cd28b477e
Let's call each other by our sha256
oof
