#discord-bots
1 messages · Page 515 of 1
its impossible to have messy code with 60 files x.x
Why not
every single function in a new folder x.x
i dont want to have a code that is 4000 lines long
It would be more organized ngl
this is my progress so far
work command simular to dankmemer
yes just put the emoji in the string
Or if each job class really has that much then make the folder a package and each file has an __all__ = ('you_class_name_here',) and then an init.py file where u have from . import *
dont put :thumbsup
And name the package (folder name) jobs
Then when u wanna access any of the classes you'd just do jobs.class
i dont think that works in embeds
It does, just not in titles or footers
Also i would defo put all of those in 1 file ngl
as a guy who used unity before, i dont do that
¯\_(ツ)_/¯
i find cogs much more effective
and clean
than having my main.py have 9999 lines of code
the only way to earn money in my bot is to beg, and ive been trying to change it for 2 days
BRO
why the fuck did you split THESE into different files
I've got a notification bot for Slack that I'm gonna convert to a Discord bot, how can I just send a message to a specific channel without having to use events etc.? In slack_sdk it goes like:
WebClient(token=SLACK_TOKEN).chat_postMessage(channel=f"#{channel}", text=message)
What is the equivalent in discord?
is your code open source
theyre the same file
the earn commands are in earn.py balance commands are in balance.py and lose commands are in lose.py
and im glad i did that in the beginning
what does ur bot do tho
mine was 19 😎
what
but that number will go above 50 very soon
I said did you suclass bot
what is that mean
making a new class that inherits from Bot
i think yes
did you do class MyBot(commands.Bot)
discord.py alternatives?
you have cogs and you dont know what subclassing is?
github moment
if you’re looking for trash there is: pycord, disnake and more
i clearly didnt copy paste it fromt eh internet
??
then use another lib
i was wondering how to make an event handler like the one on discord.js
also what’s wrong with using discord.py?
and i found a script that is perfect
receiving from the gateway?
yeaa
that’s simple
discord removing GUILD_MESSAGES intent...
Is your bot verified??
ok so what
it wont affect non-verified bots
Not removing iirc
mine's 107 😔
man did you actually read what they said about that intent
People over reacting at the finest
discord.py is much more simpler than discord.js
I cant tell if blanket copied any or vice versa
only if i didnt want to make a verified bot
but discord.js has more tutorials and guides
Ok and?
copied what?
pfp
you wont need tutorials if you go thru the docs
lmao, you do realize that getting your bot verified is the hardest part
no
use discord.js if want GUILD_MESSAGES
if you dont have a legit reason to have that intent, they wont give it to you
or other intents
btw commands isnt a valid reason
receiving messages after the command
isnt there a special method for that
wdym , its not just for python
the intents is being privelaged for all bots , not library specific
for all verified bots*
now it just seems that your just playing ariound @warm flame
yep
last time i had to add intents to my discord.js project
js user detected
no
u said discord.js project
yea because that was the first language i used for discord bots
wth
Dropdowns
you do realize 2.0 has buttons and stuff right?
me?
no
iirc , discord.js 14 forces users to add Intents.FLAGS.GUILDS intents
who are you talking to?
so its a must
you
thats why i quit using it
lol
Really?
thats just a single intent
ok
yeah I know and ?
you should use it
my dumb brain was trying to figure out how to add it for like 2 hours until i read the docs
Why using a third party library when it's built-in 2.0?
lol
you probably didn’t know the language
it wouldn’t take somebody with knowledge 2 hours to do something that simple
well wht do u expect?
^
Can you provide the documentation I have seen it somewhere but I am unable to find it
the library also expects you to know your stuff before using it
who tf learns a language then starts coding? i start coding then leaarn the language
Then you might need to reconsider how to learn
i never repeat mistakes now
thx
what… everybody?
i run my bot before coding it.
I always learn the language before and make smaller projects before doing something like a bot
That's like fighting the end game boss without playing the tutorial first
so ur telling me people read the documentation without downloading the software and trying to figure out how to print('hello world')?
actually you can learn things while coding a bot , but must be aware about the basics of the language itself
People who don't learn the language before are the ones who come here and complain their code is not working but after looking at it it's the most basic error ever seen
"oh ill just make a bot with assembly and learn it in the process, yeah that seems logical"
ofc i do that
i watch a 10 minute yt tutorial
but the rest, on my own
what are you even talking about
"who tf learns a language then starts coding? i start coding then leaarn the language" , your words , sir.
i meant like mastering the language
mhm
those are two different meanings
english is my 2nd language dont judge me
Your profile picture basically expresses my current reaction
same for me.
i studied russian and im used to its grammar so dont be surprised if i make some grammatical errors
ok
Grammar errors have nothing to do with words choice but ok
studying and mastering are pretty much identical in russian
bro why are we talking abt my english rn?
no sir

i've been searching for this emoji all time long
if you read the conversation, you would understand
oh no 
aight imma be honest here, no questions. I watch a 10 - 15 minute tutorial on a language before writing my first project, but thats as far as i go in terms of watching yt tutorials for the first 3 weeks
lets stop it here , before it goes off topic.
10 minutes of learning a language before starting a project
That's some big brain move
are you some kind of any% speedrunner
sounds like hell to me
if you do that will lower level languages, you’ll regret living
i was trying to figure out how random.shuffle worked for like 20 minutes the other day
oh man
You won't go far using that technique keep doing it and one day you'll realize it would've been worth to learn it a lot more than 15 minutes
you definitely should not try something like C or C++
Purposely making yourself illiterate
why
bro thats how i learned scratch and i never managed to get that habit off so its just stuck
my expression rn is exactly like his pfp
¯_(ツ)_/¯
what else u expect 4th grade my to do? learn c++?
no
i meant like using learning techniques that you used for scratch isnt going to help at all
ik, but it became a habit now
a bad habit
you’ll try a lower level language and you’ll just give up instantly because you only watched a 10 minute vid
personally i dont learn much languages
because i like to master one and be pro at it
and what is that?
oh boy not html
you cant master something just by looking at a 10 minute vid about it
well i did that with c# and unity
but i still need improvements with some areas
how was it
if it comes to videos , its not important that all they teach you is correct
brackeys.
i am making a ticket system, and have the opening all down, but now i want to be able to close a ticket when the role is removed. here is my code.
@bot.event
async def on_raw_reaction_add(payload):
if payload.channel_id == 892175931664367616:
if payload.emoji.name == "🆘":
guild_id = payload.guild_id
guild = discord.utils.get(bot.guilds, id=739869820136194079)
role = discord.utils.get(guild.roles, id=892178985587458049)
member = discord.utils.get(guild.members, id=payload.user_id)
if member is not None:
if role is not None:
await member.add_roles(role)
@bot.event
async def on_member_update(before, after):
after_roles = after.roles
before_roles = before.roles
for role in after_roles:
if role.id == 892178985587458049:
guild = discord.utils.get(bot.guilds, id=739869820136194079)
ticket_name = discord.utils.get(guild.channels, name=f"{after.name}—ticket")
if ticket_name is None:
channel = await guild.create_text_channel(name=f"{after.name}—ticket", category=bot.get_channel(870126606407041034))
else:
pass
joining game jams, testing out my skills, trying to make a multiplayer without knowing a thing abt it was very fun
but ofc i did have to watch some yt tutorials after, but not in the start where i just test out some stuff
aight imma leave before this gets to personal
do you get any errors?
no, i did try to get it to delete when i removed role but there was no errors, and it didnt work
well , you code does not seem to have any part which deletes a channel
welp where did i go wrong? coz wen i give "None"...it just continues and gives an error saying thumburl can have only "http: or https:"
Your checking the lowercase of thumburl.content to a string which has an uppercase
what he means is do == 'none'
How would I go about installing pip for macOS?
Fuck I love Python
probably #python-discussion
Oop. Forgot I was in this channel.
well, how do i make a prefix command which will set the default bot prefix to arg provided after prefix
redefine the client
then what?
use something called get_prefix and a database
its like
thanks
def get_prefix(ctx, message):
return ['!']
bot = commands.Bot(command_prefix = get_prefix```
tho i dont have any idea what database is
I want to debug a statement py await ctx.channel.send(embed=report,components=Select(placeholder = 'SelectMenu',options = [SelectOption(label="Bugs", value="value1"),SelectOption(label="Commands", value="value2"),SelectOption(label="Suggestions", value="value3"),SelectOption(label = "Other", value = "value4")])[[Button(style=ButtonStyle.red, label="Discard", custom_id="n"), Button(style=ButtonStyle.green, label="Send", custom_id="y")]]) it gives me the error: Exception has occurred: TypeError 'Select' object is not subscriptable
is it like mysql?
yes
- you can do
ctx.send2) you didSelect()[]
why not just comman_prefix=['!']
also get_prefix takes bot as first argument and message as second
it takes no ctx
I was giving an example of how one would link it to a function
and then they can elaborate on it
ok
elaborate
your code is so uh
@manic wing hi bro can you help me
I mean as blanket said, the code is dodgy, but somewhere and somehow you did Select(...)[], hence the error
errors?
mport discord
import asyncio
from gtts import gTTS
from discord import FFmpegPCMAudio
from discord.ext import commands
bot = commands.Bot(command_prefix="+")
@bot.event
async def on_ready():
print(bot.user)
@bot.command()
async def tts(ctx,*, text:str):
global gTTS
language = "es-us"
user = ctx.author
speech = gTTS(text=text,lang=language,slow=False)
speech.save("audio.mp3")
channel = user.voice.channel
print(channel)
vc = await channel.connect()
print(vc)
sc = FFmpegPCMAudio("audio.mp3")
voi = vc.play(sc)
voi.start()``` this is full code
Im not great with voiceclients
I didn't thats why I am confused
can't you just do await channel.send('hi', tts=True) or whatever the kwarg is?
thats not the same thing
!d discord.abc.Messageable.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**.
@manic wing wait i send error
the tts for send is just annoying
but you did, and the error says you did
and it doesnt play on vc
General
<discord.voice_client.VoiceClient object at 0xb0299c88>
Ignoring exception in command tts:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "<string>", line 23, in tts
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.8/site-packages/discord/player.py", line 225, in __init__
super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.8/site-packages/discord/player.py", line 138, in __init__
self._process = self._spawn_process(args, **kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.8/site-packages/discord/player.py", line 147, in _spawn_process
raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.8/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: ClientException: ffmpeg was not found.```
errors?
oh install ffmpeg
(not via pip)
I installed but
you didnt
Add it to path
how did you install it
it says line 54 which is this piece of code: py await ctx.channel.send(embed=report,components=Select(placeholder = 'SelectMenu',options = [SelectOption(label="Bugs", value="value1"),SelectOption(label="Commands", value="value2"),SelectOption(label="Suggestions", value="value3"),SelectOption(label = "Other", value = "value4")])[[Button(style=ButtonStyle.red, label="Discard", custom_id="n"), Button(style=ButtonStyle.green, label="Send", custom_id="y")]])
man can you clean up your code
we cant see anything
@hasty iron ?
what
ok
I installed from termux but not work
I can clearly see you did )]) before the [[Button(style=ButtonStyle.red, label="Discard" lol

Man 3rd party components impl are so bad lmao
Look how bulky that is
Just use v2.0
No one can help me 😫 😩
we told you to install ffmpeg ....
I installed
I mean its pretty easy to make it look nice, you just press enter
How
are you using a phone
Yes
guessed so
with what
which is the best database recommended by most devs for discord bots?
postgesql
okay and?
bro just ask here
database -> sqlite/mongodb | module -> aiosqlite/mongodb (its possible to make mongodb asynchronous but its harder)
#❓|how-to-get-help #python-discussion not dpy related
my man
sqlite will be slow and inefficient for larger bots
sorry
it only allows a single operation per time
oh..
mongodb has an async driver but its shit
ok but like is it a module?
asyncpg is a module
Do keep in mind you actually need to setup the postgres database
i m using replit for that
I doubt replit can setup a postgres database lmao
oof
You also need knowledge in SQL in order to make queries to the database
then stop using replit
what is the ide used by devs?
use anything you like
I personally use neovim a lot
cant use offline ides like vscode
Your mixing two things up here
why
IDEs are NOT vps's
ill use it when i learn how to type
Code on IDE -> send to VPS -> VPS hosts the code
because i want my bot to run 24 hrs and vscode cant help in that
then get a vps
whats vps
You really only need to know how to insert, visual and ig shortcuts such as A dd etc
then adding your own stuff
i have no idea what you guys are talking about... i m a complete noobie
Cap A goes to the end of a line and goes into insert mode, and lowercase a goes into insert mode where your cursor is
too complicated, ill just stick to vsc
how in the world you keep ur bot alive 24 hrs using vsc?
A VPS is a server, and IDE is a code editor you can’t use an IDE to run your bot 24/7 without keeping your pc on 24/7
and how do i create a vps
You buy
You buy one
Not create
oh...

:(
AWS and GCS have free trials you can try it there
aww thanks
but it requires a credit card
well, i do have a credit card
Then it won’t charge you till your trials up
but imma stick to replit since i m not developing aprofessional bot
iirc GCS has a 3 month trial
just wanted to know how python works. making a discord bot can help ya get better at python
if thats so, you dont even need hosting
exactly
there are already like thousands of bots in discord which perform different functions.
that's like so not true
it's exactly the opposite
it is indeed
discord bots have a VERY specific style of writing, and require quite a lot of knowledge to get in to
it will literally kick you until you are down and keep kicking you if you don't already have most knowledge
it is FAR from a learning project
^
well
learning projects are smth like making a GUI interface, tic-tac-toe, rock-paper-scissors, story-like game where depending on what u choose u have a different outcome, etc
UPTIME ROBO
Can somebody tell me what's wrong with this
and only when u have a certain amount of knowledge of python discord bots can finally become a learning project
also due to the fact that the writing style is so specific it will not learn you anything valuable outside of discord bots really
no ctx
I would disagree. I learnt the basics of Python back in around 2017 and started coding bots in 2018, knowing nothing but the basics (functions, variables, syntax, etc). I'd say it has taught me a lot, and if I could do it again I definitely would
(member, ctx): should be (member):
oh...
everything looks fine 😕
Thanks
❌
so where should i start from?
Kindling Projects
The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
lemme get my spectacles
message is undefined
okay thanks

that too

you're trying to send a message to a channel of a message that doesn't exist because you never told it what message
also ctx.author.colour won't work because you don't just magically have a role colour when u join
where is the memes channel tho
and as i said earlier, no ctx in on_member_join events
so what do I do to fix it
well if you want to send a message to a channel you have to define a channel, which you did by doing message.channel, but message isn't defined. You never told it what message to use
your code does as instructed. It doesn't have telekinesis powers and knows exactly what you want it to do by reading your mind
so you have to give it VERY exact instructions
Thanks for the help I think I understand now
how can i add someone in a discord server without invite with my bot
What?
hmm
You can't, they need to accept the invite
u can do it with bots right
You can't
only with bots
hmm

but how
Let me tell you something. A Discord bot is not a magician. It cannot do something that a Discord user cannot do. E.g. You cannot ban someone without ban members permissions, same with bots. You cannot send messages without permissions, same with bots. You cannot DM a user who has their DMs off or you don't share a server with them, same with bots.
no u can
i fell for one once
Do it, then.
somthing called mee6 verification bot
Do you mean the "join a server for you" thing?
umm "make me join a server"
it was one of the authorization permissions
You mean scopes?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
That?
guilds.join scope
yes
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
no idea why this doesn't work ```py
@bot.event
async def on_user_update(before,after):
print("Start")
print("Before =" + str(before.display_avatar.url))
print("After =" + str(after.display_avatar.url))
if after.id == 247478934684303360 and after.display_avatar.url != before.display_avatar.url and after.display_avatar.url != None:
print("if")
mbed = nextcord.Embed(
title = f"👀 {after.name} Has Changed His Pfp Again 👀",
description = "",
color = 0x9900FF
)
print("mbed")
mbed.set_image(url = after.avatar.url)
mbed.set_footer(text = f"[Old Pfp]({before.avatar.url})")
print("mbed stff")
channel = await bot.fetch_channel(853613968534929441)
print("channel")
await channel.send(embed=mbed)
error?
with that i can make some one join in my server if he authorizes it right?
nope
yes
the print at the start doesn't even print
you sure the event is being triggered?
Is it only discord.py here
Not sure if nextcord is same as discord.py but try on_member_update.
it only gets triggered if a user updates their profile
Not anymore.
:(
yeah i did it on myself
and still nothing
Try on_member_update instead of on_user_update.
^
yes? ofc?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
and what is activities.read /activities.write
it says it in the description
i dont understand what i did wrong( the token is a old token i put to hide my actual bot)
value = f(*args, **kwargs)
File "main.py", line 30, in get_prefix
prefixes[str(message.guild.id)]
KeyError: '881564058602582047'
def get_prefix(client, message):
with open("prefixes.json", "r") as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]
Key '881564058602582047' is not in the JSON file.
And I don't really recommend using JSON as a database.
nope
Use an actual database, I suggest mongo.
Check nextcord's docs, maybe you will find it.
Install PyNaCL.
wym
just wanna say something why am I getting these two errors what did I do wrong ? py @client.group(invoke_without_command=True) async def feedback(ctx, *, text = None): try: text = text.split("|") report=discord.Embed(color=0xfff868) report.add_field(name='Pending Confirmation', value=f"{text[1]} #Tittle \r {text[2]} #Description") await ctx.channel.send(embed=report,components=Select(placeholder="Posting where?", options=[SelectOption(label="Bugs", value="A"), SelectOption(label="Commands", value="B"), SelectOption(label="Suggestion", value="C"), SelectOption(label="Other", value="D")][[Button(style=ButtonStyle.red, label="Discard", custom_id="n"), Button(style=ButtonStyle.green, label="Send", custom_id="y")]]) except: await ctx.reply("Please enter `/feedback format` to check how to format.") finally: print("done")Errors: Expected ")" & try statement must have at least one except or finally clause pls tag to reply
like import PyNaCL or wha
im following a tutorial so im a bit confused
The Select didn't get closed , I believe.
Add a ")" after that.
Do you have members intents enabled?
yup
bot = commands.Bot(command_prefix="T!", help_command=None,intents=nextcord.Intents.default())
Default intents don't include member intents.
what?
!intents try this but change discord to nextcord.
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 the Members and Presences intents, which are needed for events such as on_member 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.
really?
thanks now I have to debug it
intents = nextcord.Intents.default()
intents.members = True
bot = commands.Bot(..., intents=intents)
embed.add_field(name='Banned', value=f'{discord.Guild.fetch_ban()}', inline=False)
TypeError: fetch_ban() missing 2 required positional arguments: 'self' and 'user'
idk what i should write in ()
i installed pynacl in the shell but it still shows this
anyway your issue is that you need to call fetch_ban() on an object, not a type, like discord.Guild
so what should i use for a object?
A guild like message.guild or ctx.guild
I'd also suggest watching this video about OOP https://www.youtube.com/watch?v=ZDa-Z5JzLYM to gain a better understanding
thank you... but yeah "missing 1 required positional argument: 'user'" thats the only error message xd
someone has a discord python bot? s
me, what do you need?
my best guess is that it's just replit doesn't support it, and that's one of the many reasons you should never use replit
I m developing it
also refresh your token NOW, you literally just leaked your token for the entire world to see
😭
a discord generator bot
Hey @valid niche! 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!
like key
there i invalidated that token
s
Discord generator bot? Lol
@somber musk
the bot doesnt invalidate the token
it posts it on a github list of tokens that discord uses to invalidate no?
We only invalidate webhooks, there's no API endpoint to invalidate bot tokens
no
like a bot when you .generate key and so the bot give you a key
dayum
what do i do when i see this
i guess only way is to add it to your own repo then no?

Your python code can t generate the bot token or id
yeah, or push to a gist, either way its a hacky solution which wont be implemented in the bot
I think this is not the correct channel to ask in.
where can iask
ah then it probably was the r.danny bot from the dpy server that did it
ty
doesn't uploading them to github end up on the tokens getting invalidated?
i did it twice by accident and it got instantly invalidated and got a dm from discord system bot thingy
yeah i vaguely remember having that here too
or it might have been the dpy server
it's in dpy
not sure
uploading bot tokens to github does revoke them yes, but we're not going to do that with our bot
alr
change your token.
already put it in a public gist for 2 seconds to invalidate it
so the user should have a system message now
👍
Hi all, I’ve implemented my bot onto discord. What would I have to do to edit the code?
you open the code edit it and hit save
tho it smells like you have absolutely 0 experience with programming in general
Where would I find that?
and keep in mind a discord bot is an VERY complex project
and it's not made for any beginner
i recommend you learn the basics of python, OOP, and asynchronous programming before you begin to fiddle with discord.py.
Hmmm. I'll keep that in mind.
wherever you saved them on your pc
I have successfully debugged This codepy @client.group(invoke_without_command=True) async def feedback(ctx, *, text = None): try: text = text.split("|") report=discord.Embed(color=0xfff868) report.add_field(name='Pending Confirmation', value=f"{text[1]} #Tittle \r {text[2]} #Description") await ctx.channel.send(embed=report,components=Select(placeholder="Posting where?", options=[SelectOption(label="Bugs", value="A"), SelectOption(label="Commands", value="B"), SelectOption(label="Suggestion", value="C"), SelectOption(label="Other", value="D")][[Button(style=ButtonStyle.red, label="Discard", custom_id="n"), Button(style=ButtonStyle.green, label="Send", custom_id="y")]]) except: await ctx.reply("Please enter `/feedback format` to check how to format.") finally: print("done")Errors: Expected ")" & try statement must have at least one except or finally clause but now it gives me the following error: Exception has occurred: TypeError 'Select' object is not subscriptable actually its a logical exceptions but through debugging I have found that it dues to these errors. pls reply or tag
Ok! This might sound dumb, but I was thinking about a bot that scrambles a word, and the first person to guess it would get a point. Would that even be possible? I know it's probably very complicated to do.
that's very easy, but if you have 0 knowledge it's impossible
thats very possible, and pretty simple. but you really should take the advice i have given you or else you will struggle.
please send the full traceback
!traceback
Please provide a full traceback to your exception in order for us to identify your issue.
A full traceback could look like:
Traceback (most recent call last):
File "tiny", line 3, in
do_something()
File "tiny", line 2, in do_something
a = 6 / 0
ZeroDivisionError: integer division or modulo by zero
The best way to read your traceback is bottom to top.
• Identify the exception raised (e.g. ZeroDivisionError)
• Make note of the line number, and navigate there in your program.
• Try to understand why the error occurred.
To read more about exceptions and errors, please refer to the PyDis Wiki or the official Python tutorial.
Yeah, I was planning on editing it as I learn ya'know?
Just something to help retain knowledge.
ok
yeah no that's not gonna happen. A discord bot is a VERY complex thing and requires extensive knowledge of the basics. And it's a VERY specific way of writing that isn't seen outside of this much and thus it won't learn you much
you're jumping into discord.py too quickly.
How long would it take to master the basics roughly?
learn the basics of python, like syntax, how to read and understand tracebacks. learn basics of OOP (Object Oriented Programming), and asynchronous programming.
learning doesn't work like that
Just a general time scale, I know everyone's different.
tbh I think you can just learn asynchronous programming as you go along
it depends on how you learn, if you watch youtube tutorials for 4 hours then you'll never get where you need to be. but if you experiment and research, try for yourself, you'll learn.
but function knowledge is needed
Asynchronous programming is definitely not something you can learn only via discord.py
^
I can confidently say that
Ok cool! I'll take your guys's advice to heart.
hello
Hey @hollow mortar!
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:
can any one look at my code idk why its not making the ticket config work
any help
listen decorator takes an argument
what does that mean its a command
which line
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").
Example...
line 65
error?
it was working before like 2 days i dont remmber what i changed and it fucked it up idk any help
no errors it doesnt give me anything
i think you may be wrong.
it give me nothing like the code not reading it idk why
yeah , i realised later that it was not their issue , it can be None
with the bot.listen() decorator, you do not have to pass the function name you want to listen to.
yeah
anyone know whats my problem ?
your command isnt returning anything? do you have an on_message event maybe? and are not processing commands.
i do this !configure_ticket 894287528306282537 887131186810454099 in the chat and it should create a ticket for me and setup the system idk why its not making
yep, thats your issue
what is it ?
ah yes
thats your problem.
we know, your command isnt working because your on_message event isnt processing commands
on_message is blocking the commands
oh got it
add this
do what snow just said
where ?
top or bottom of the event
below your on_message evnts
@bot.event
async def on_message(message):
await bot.process_commands(message)
#code ```
@bot.event
async def on_message(message):
await bot.process_commands(message)
f = open("badwords.txt", "r")
liness = f.read()
down = liness.split("\n")
if any(words in message.content.lower() for words in down):
await message.channel.purge(limit=1)
await message.channel.send(f"{message.author.mention}, You can't say that!!")```
like this ?
mhm sure
yup
👍
can anyone help me with this: #discord-bots message
ayo
anther problem here
?
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Mohamed_Zeton\Desktop\JOB 1> & C:/Users/Mohamed_Zeton/AppData/Local/Microsoft/WindowsApps/python3.9.exe "c:/Users/Mohamed_Zeton/Desktop/JOB 1/job.py"
CursedMC is ready.
Ignoring exception in on_raw_reaction_add
Traceback (most recent call last):
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\Mohamed_Zeton\Desktop\JOB 1\job.py", line 49, in on_raw_reaction_add
await ticket_channel.set_permissions(role, read_messages=False, send_messages=False)
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\abc.py", line 648, in set_permissions
raise InvalidArgument('target parameter must be either Member or Role')
discord.errors.InvalidArgument: target parameter must be either Member or Role
Ignoring exception in on_raw_reaction_add
Traceback (most recent call last):
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\Mohamed_Zeton\Desktop\JOB 1\job.py", line 49, in on_raw_reaction_add
await ticket_channel.set_permissions(role, read_messages=False, send_messages=False)
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\abc.py", line 648, in set_permissions
raise InvalidArgument('target parameter must be either Member or Role')
discord.errors.InvalidArgument: target parameter must be either Member or Role```
after the config it make a channel and mention the use that you have a ticket open it create the channel but dont mention the user
the role your try to give the member doesnt exist (i think)
yup i think the same
actually
i didnt read the full traceback and made the wrong assumption
yeah it cannot find the role to set permissions for
its working now yup
@bot.event
async def on_member_join(member):
guild = bot.get_guild(891031599708266626 what should i put here ? )
channel = guild.get_channel(886784755083907082)
await channel.send(f"Welcome {member.mention} to the CursedMC Discord! 🥳")```
i forgot which id i should put there and im trying to remmber it any one can help ?
the second one is the channel id
the first one the role ? or the category ?
the server id, but that is also not needed for what you're trying to do
in the bot.get_guild you're grabbing a guild, which takes an int.
yup
which you dont even need to do
@bot.event
async def on_member_join(member):
channel = bot.get_channel(ID)
await channel.send(f"Welcome {member.mention}")
this would be just fine if the bot is in one server.
yup thats what im planing to do thanks alot man
👍
Hi,
I have a little question, discord.py or piscord ?
Thx
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Mohamed_Zeton\Desktop\JOB 1> & C:/Users/Mohamed_Zeton/AppData/Local/Microsoft/WindowsApps/python3.9.exe "c:/Users/Mohamed_Zeton/Desktop/JOB 1/job.py"
CursedMC is ready.
Ignoring exception in on_raw_reaction_add
Traceback (most recent call last):
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\Mohamed_Zeton\Desktop\JOB 1\job.py", line 213, in on_raw_reaction_add
if role is not None:
UnboundLocalError: local variable 'role' referenced before assignment```
########### verify ##########
@bot.listen()
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 894295748869488650: ## add id msg of the msg you want ppl to react to to get role
guild_id = payload.guild_id
guild = discord.utils.find(lambda g: g.id ==guild_id, bot.guilds)
if payload.emoji.name == 'Verified':
role = discord.utils.get(guild.roles, name='Verified')
if role is not None:
member = payload.member
if member is not None:
await member.add_roles(role)
print("done")
else:
print("memeber not found")
else:
print("role not found ")
any help wht this error im sure 100% the role name same as here and the emoji as well
and the role of the bot is the top of the role i want the bot to give
role is only defined if the if statement returns True
you only pass to the if role is not None if the if statement returns False.
well
i'm not thinking clearly lol, give me a second.
thats not the issue
whats the issue if you know it
the way you defined role.
role only has an assignment if your if statement returns True, otherwise it doesnt
idk why it doesnt returns true thats the problem its weird cuz the same emoji same name and the role
your program doesnt know what role is (according to your error)
right, but what is role in this case?
role is not defined as your if statement above did not return true
role = discord.utils.get(guild.roles, name='Verified')```
Define role as None before getting it, and if the code got the role, it will overwrite it, otherwise, the role will stay as None.
^
ok so i make role = None
i was gonna get to that but i wanted to make you understand why it was happening first
do you see why your program is doing this?
yup i understand it now
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Mohamed_Zeton\Desktop\JOB 1> & C:/Users/Mohamed_Zeton/AppData/Local/Microsoft/WindowsApps/python3.9.exe "c:/Users/Mohamed_Zeton/Desktop/JOB 1/job.py"
CursedMC is ready.
Ignoring exception in on_raw_reaction_add
Traceback (most recent call last):
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\Mohamed_Zeton\Desktop\JOB 1\job.py", line 213, in on_raw_reaction_add
if role is not None:
UnboundLocalError: local variable 'role' referenced before assignment```
this error when role = None
Discord automatically does it for me calm down
discord does not
i invalidated the token by uploading it to github
yeah that's because i uploaded it to github
Oh rly tysm
because i know that discord will invalidate it then
Ty ☺️☺️
sorry fort he bother tho 'snow'
@bot.command()
async def test(ctx, ok):
if ok == "Hi":
word = ok <- Word is only defined under this if condition assuming it returns True, as your role var in your case
else:
word = "Nothing" <- This means word wouldnt be defined here, to encounter that, we can set role as a local variable to be used throughout the function by setting its default value to None, this means if we checked if the word is None, it would be defined.```@hollow mortar
no bother, just trying to make you understand
oh got it so what i should do is defined the role on the top of the command right ?
that no need for it to be none or true it will always be true
mhm, role = None, and the value of role can change throughout the program
is it illegal to make a music bot for just u and ur friends
if you use youtube_dl we will not be able to provide help, as it is against ToS.
use spotify dl or something like this
what other methods are there
pretty much every method goes against some ToS, actually.
bc my friends server is asking me to make one but i dont know how to
idk we cant answear about thing against tos in the server i guess
sad
i mean you wont get in a bunch of trouble from using youtube_dl, we just wont be able to provide help here if you do. and no im not encouraging you to break ToS, do anything at your own will :P
i mean, its just me and my friends its not gonna be publicbut ty for the info
when i did this i got this
@bot.listen()
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 894295748869488650: ## add id msg of the msg you want ppl to react to to get role
guild_id = payload.guild_id
guild = discord.utils.find(lambda g: g.id ==guild_id, bot.guilds)
role = discord.utils.get(guild.roles, name='Verified')
if payload.emoji.name == 'Verified':
print("hi")
if role is not None:
member = payload.member
if member is not None:
await member.add_roles(role)
print("done")
else:
print("memeber not found")
else:
print("role not found ")```
i got this error
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Mohamed_Zeton\Desktop\JOB 1> & C:/Users/Mohamed_Zeton/AppData/Local/Microsoft/WindowsApps/python3.9.exe "c:/Users/Mohamed_Zeton/Desktop/JOB 1/job.py"
CursedMC is ready.
Ignoring exception in on_raw_reaction_add
Traceback (most recent call last):
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\Mohamed_Zeton\Desktop\JOB 1\job.py", line 217, in on_raw_reaction_add
await member.add_roles(role)
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\member.py", line 777, in add_roles
await req(guild_id, user_id, role.id, reason=reason)
File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\http.py", line 248, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
bot is missing permissions to do add roles to a user
maybe the role your bot is trying to add is above the bots role
the bot have admin perm i dont think let me check again
It doesn t metter, if the role you want to be added come before the role of your bot he can't add it
none of my command outputs are sending :(
its lower than the bot role
you likely have an on_message event and are not processing commands
but they do have it
let me see your on_message event
hmm..
the bot does not have permissions to add the role to a user. i do not know why.
its weird problem this command were working before good and idk i just changed the server and it doesnt work
you should make sure the permissions are correct
i will check them but im sure it have perm cuz when i make the ticket command in the same bot it give perms too ppl
Does the on_message event work though?
The on_message event doesn t process the command
Process the command or change the @bot.event() into @bot.listen()
hmm
it should?
it does.
What?
Try sending a message, in your case, "deez nuts", and see if it replies.
Check bettere, there are more on_message event
there are 2.
Does the on_message event work?
3 lol
Your bot instance is defined in a weird way.
intents = Intents().all()
intents.members = True
from discord.ext.commands.errors import ArgumentParsingError, MissingRequiredArgument
bot = commands.Bot(command_prefix='g.', intents = Intents())
First of all, it's Intents.all().
Second, since you have Intents.all() you don't need to set intents.members to True.
Yeah i was looking at it too
Second, why did you call Intents in the commands.Bot()?
yep
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 the Members and Presences intents, which are needed for events such as on_member 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.
intents = intents
k is it actually good now
i mean it was always doing that when i turned it on, even before fixxing it
none of the commands was working which was weird
but they work now
You were calling Intents() which made the variable intents very useless.
How can I "acknowledge" messages so that they only get processed once when checking the message history for messages that came in while the bot was offline? I.e. doing something like
async for message in channel.history(oldest_first=True):
... # Processing the message for the same as I use for `on_message`
Could you please elaborate?
Me?
I put in a message like !help, then run the bot, it should process that message as it came in while the bot was offline
@bot.listen()
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 894303238533304390: ## add id msg of the msg you want ppl to react to to get role
guild_id = payload.guild_id
guild = discord.utils.find(lambda g: g.id ==guild_id, bot.guilds)
if payload.emoji.name == 'AU':
role = discord.utils.get(guild.roles, name='AU')
elif payload.emoji.name == 'NA':
role = discord.utils.get(guild.roles, name='NA')
else:
role = discord.utils.get(guild.roles, name=payload.emoji.name)
if role is not None:
member = payload.member
if member is not None:
await member.add_roles(role)
print("done")
else:
print("memeber not found")
else:
print("role not found ")```
i have problem in this code everytime i react with the emoji called NA and i have role called NA in the server it says role not found any help
But I don't want it to be processed again if I restart the bot
I'm looking for how you'd ack in message queues
try finding with ID.
You can save the ID of messages that got processed.
i dont know how to do it 😢
And then check if the ID of the message is in the database you are saving the IDs in, and if it is, then return.
role = discord.utils.get(payload.guild.roles, id = ID here)```
Error?
hey do you mind helping, i am gonna go for a bit.
Sure, and remember, you aren't obligated to help! So don't pressure yourself.
👍 :)
Is there roles in the main server with the names you are using?
!d discord.on_raw_reaction_add I gotta take a look at the docs.
discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
th
this the roles i have on the main server and you can see the bots role is in the top
thanks
Ah, wait.
payload doesn't have a guild attribute.
Since you've already got the guild, then use guild.roles instead of payload.guild.roles.
Oh, hold on. I looked at snow's message.
That's my bad.
oh, i am sorry, i gave this as an example. i thought it had a guild attr
You can get the guild in a better way though. Use bot.get_guild(guildID). I'm not very sure if the way you get the guild is good.
i tried to add the bot to that perm and still same problem
its sooo confusing cuz i have everything sit on and the bot still have the same problem in the main server but the test server no
weird
if i change it with the id it will be better i think do you know how i can make it like it give the roles by the role id ?
you could pass guild.roles with discord.utils.get
Get the role using role = guild.get_role(role id).
same problem role not found werirddddd
Is the role with the ID given in the main server?
guild = bot.get_guild(guild_id_here)
role = guild.get_role(role_id_here)``` this should return the role
Bots cannot use premium stickers?
Hi
I think they should. Also hello hunter!
When is disnake going to be fully done?
yes
guild id of what ?
Can I see how you defined bot?
@bot.event
async def on_raw_reaction_remove(payload):
message_id = payload.message_id
if message_id == 891791302004465665: ## add id msg of the msg you want ppl to react to to get role
guild_id = payload.guild_id
guild = discord.utils.find(lambda g: g.id ==guild_id, bot.guilds)
if payload.emoji.name == 'AU':
role = guild.get_role(894303031619887120)
elif payload.emoji.name == 'NA':
role = guild.get_role(894303115187216414)
else:
role = discord.utils.get(guild.roles, name=payload.emoji.name)
if role is not None:
member = guild.get_member(payload.user_id)
if member is not None:
await member.remove_roles(role)
print("done")
else:
print("memeber not found")
else:
print("role not found ")```
hi
it is done
Says Cannot use this sticker
Oh, really?
!pypi disnake
Great, I'll give it a try very soon.
Cool
hahahahahha
Next bot order I get, I'll try out disnake.
LETSS GOOOO I KNOW THE PROBLEM FROM WHERE
GJ
I know that feeling, haha.
BEST ONE EVER
and in that code i dont have guild thing
Yes, lmao!
so i kicked him from the test and left him in only 1 server and it worked
lets goo thanks thanks thanks thanks alot @patent lark and @dapper cobalt thank you guys and sorry for the bother
haha its alright, no bother! i like helping.
Is there no built in solution for this, such as marking a message as seen by the bot or something, you must insert all of the messages to a DB?
Nope. Even botvars won't work as I believe they get redefined everytime you restart the bot.
!botvars
Sooo yea. Everything will be redefined everytime your bot restarts as long as u don't hardcode it
No need of that ;-;
I like spamming tags
we know
I know, but acking a message would just make sense
I've seen there's an ack() function and I assumed it would be used for this
:stare: Do I ask those type of questions which no one knows?
shit anther problem bruhhhh
@bot.listen()
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 894295748869488650: ## add id msg of the msg you want ppl to react to to get role
guild_id = payload.guild_id
guild = discord.utils.find(lambda g: g.id ==guild_id, bot.guilds)
if payload.emoji.name == 'Verified':
role = discord.utils.get(guild.roles, name='Verified')
if role is not None:
member = payload.member
if member is not None:
await member.add_roles(role)
print("done")
else:
print("memeber not found")
else:
print("role not found ")```
this code doesnt work i tough the first problem will make him get fixed
Memeber
UnboundLocalError: local variable 'role' referenced before assignment
thats deprecated iirc
Hey blanket, do u know about my question?
Set a default value for role.
which is?
role = None
if payload.emoji.name == "Verified":
role = discord.utils.get(guild.roles, name="Verified")
Can bots not use the premium stickers given by discord?
didnt we already go through this lol
Raises a discord.Forbidden error
With someone else.
idk i haven’t used then
hehe i dont remmber
:c
Try that:
role = None
if payload.emoji.name == "Verified":
role = discord.utils.get(guild.roles, name="Verified")
i stopped coding bots like 4 months ago
ohhh okay
i know you should me how the problem from where but
Sad
i tough it will get fixed wit that error but not
People who stopped but still have knowledge are the best, lmao.
:(
E.g. @thick sigil
like this
@bot.listen()
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 894295748869488650: ## add id msg of the msg you want ppl to react to to get role
guild_id = payload.guild_id
guild = discord.utils.find(lambda g: g.id ==guild_id, bot.guilds)
role = None
if payload.emoji.name == "Verified":
role = discord.utils.get(guild.roles, name="Verified")
if role is not None:
member = payload.member
if member is not None:
await member.add_roles(role)
print("done")
else:
print("memeber not found")
else:
print("role not found ")```
Ngl, he helped me go through many obstacles that came in my way while learning Python and discord.py.
Yes.
I call him "senpai" since he's like my teacher, haha.
yeah, i think im slowly drifting away from discord.py. i use to code bots all the time, but for the past few weeks. i just dont really touch on it anymore. ive been creating games/sites, but i still enjoy being here to help others with questions regarding the library.
role not found
ctx.author.send()
Then role is None.
!d discord.ext.commands.Context.author
Union[User, Member]: Returns the author associated with this context’s command. Shorthand for Message.author
that means same problem as the last one right ? weird
but maybe i'll get back into it.
me as well.
time to make my own discord api
lol
with my own web framework
The time I got back into discord.py is when the person I work on a bot with actually did some effort until he got the bot verified (side-note: I've coded about 80% of that bot and he kept updating it.) then I focused more on that bot, and we are now earning many donations and getting so much love from the community!
when i changed it to this still same problem
@bot.listen()
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 894295748869488650: ## add id msg of the msg you want ppl to react to to get role
guild_id = payload.guild_id
guild = discord.utils.find(lambda g: g.id ==guild_id, bot.guilds)
role = None
if payload.emoji.name == "Verified":
guild = bot.get_guild(886784007960944680)
role = guild.get_role(887356513809735772)
if role is not None:
member = payload.member
if member is not None:
await member.add_roles(role)
print("done")
else:
print("memeber not found")
else:
print("role not found ")```
weird i tried using the id
thats amazing! i was making a public bot as a multipurpose bot, i planned many complex and great things, but i eventually just lost my motivation to work on it. and i stopped working on that bot about 2 months ago.
If feel that. I also lost motivation to work on my bot since it wasn't getting much attention, and also after seeing all my friends' bots getting so many reach faster than my bot.
yeah, i know what you mean.
File "main.py", line 152, in <module>
@Bot.command()
AttributeError: 'Command' object has no attribute 'command'
{im getting this error, but if i take the error out, it moves to the next command & so on.} help needed, pls.
tried that, same error
how did you define bot?
Bot = commands.Bot
and the brackets
Send the actual code
intents = discord.Intents().all()
Bot = commands.Bot(command_prefix=get_prefix, intents=intents,help_command=None) {it was working, great yesterday}
I'm not sure about the capital letter
send the code thats giving you the actual error
its the same error, if a lowercase bot
oh wait
Did you import commands?
Why do you call discord.Intents?
Isn't it discord.Intents.all()?
@Bot.command()
async def GN(ctx):
await ctx.send(f"Good Night, {ctx.message.author.mention} 😪") {if it remove it, move to the next command}
yes
!code
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.
nah, that would show the error in the next line....
And also ctx.author.mention, no need to use the message attr.
!d discord.ext.commands.Context.author
Union[User, Member]: Returns the author associated with this context’s command. Shorthand for Message.author
intents = discord.Intents().all()
^
there's no way Bot turned to a command object
without you messing with it
do you have a command called Bot?
hmmm
Can you send the line above the command decorator?
tried that, same error. it was great, last night. i went to run it & it errored.
@crystal cliff
yes
...
I feel like a genius
wtf
where did you copy this from
well I suggest getting a help channel for that
I don't even know what that is
when you solve, my prob you will 👍
@crystal cliff You have a command called "Bot".
Which means, you've got a Bot function.
Which means, you're overwriting your Bot variable.
And why are you using a capital B?
i tried the code with lowercase, same error
Can I see your Bot command?

