#discord-bots

1 messages · Page 536 of 1

slate swan
#

thank you lmfao

#

forgot a > lol

#

i wasnt trying to give him that so he would figure it out himself but jesus

#

he really put User_Id

#

fendi_laugh10 fendi_laugh10 everyone starts somewhere tho

#

lol 1st week of py

slate swan
#

atleast i didnt start out like a skid 🙏

slate swan
slate swan
slate swan
slate swan
#

should i put a set.author() on it so it doesn't look so plain

slate swan
slate swan
#

idk i personally hate working w embeds

#

i only use embeds for things that hold data thag doesn't look good in a normal message

#

yeah

#

@pliant gulch

pliant gulch
slate swan
pliant gulch
#

Thanks that's what I was really going for

#

Currently working on lefi's command extensions right now

slate swan
pliant gulch
#

Yes

slate swan
#

dope

slate swan
#

just like dpy?

pliant gulch
#

We have documentation as well, although not sure how readable they are since I wrote them https://lefi.readthedocs.io/en/latest/API-Reference/embed/?h=embed#lefi.objects.embed.embed.Embed

slate swan
#

and sending them is also just like dpy?

pliant gulch
#

Yes you need a channel object which has a send method which you then pass the embed object to the embeds kwarg

#

Keep in mind currently since the discord API has deprecated embed, the single embed field I only have embeds kwarg set

#

Meaning a slight change as in await Channel.send(embeds=[embed])

#

In the future I will change this to not require passing a list

slate swan
#

oh allright thanks

pliant gulch
#

I would also highly suggest if you plan on using the wrapper to install it via poetry

#

As I don't have a setup.py for dev dependencies, so if you use pip you will be forced to install every dev dependency I use

slate swan
#

i used pip

#

it took like a sec

pliant gulch
#

Yea, I will have to change that later

slate swan
#

ive never heard of poetry

#

how will pip react if i install the same package via poetry

pliant gulch
#

Uh well poetry is a venv

#

So its seperate from your global packages

#

You just setup your poetry venv, do poetry add <package>

#

Then everytime when you want to run stuff you need to do it from poetry, as again its a venv

slate swan
#

oh i see

pliant gulch
#

But if you do install the wrapper with poetry use the --no-dev flag to get rid of installing any dev dependencies

#

This will make it so it only installs the two packages I require for the wrapper

#

aiohttp and pynacl

slate swan
#

i see allright

covert igloo
#

How am I able to make use of a button more than once

#

Meaning it can be clicked multiple times

slate swan
#

button?

covert igloo
#

Yes

slate swan
#

lmao discord has been adding new shit every day

slate swan
covert igloo
#

Been out for a little, I just never used them

torn kettle
#

Ignoring exception in command join:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/1stDiscordBot/music.py", line 15, in join
voice_channel = ctx.author.voice.voice_channel
AttributeError: 'NoneType' object has no attribute 'voice_channel'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/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: AttributeError: 'NoneType' object has no attribute 'voice_channel'
Ignoring exception in command join:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/1stDiscordBot/music.py", line 15, in join
voice_channel = ctx.author.voice.voice_channel
AttributeError: 'VoiceState' object has no attribute 'voice_channel'

#

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/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: AttributeError: 'VoiceState' object has no attribute 'voice_channel'

pliant gulch
slate swan
#

its just title?

pliant gulch
#

Its a method, should be lefi.Embed.set_title(...)

torn kettle
#

im tryna get discord bot to join vc but it errors

slate swan
#

ahh that makes much more sense

pliant gulch
#

Err no no I'm sorry

torn kettle
#
@client.command()
    async def join(self, ctx):
        if ctx.author.voice is None:
            await ctx.send("You're not in a voice channel")
        voice_channel = ctx.author.voice.voice_channel
        if ctx.voice_client is None:
            await voice_channel.connect()
        else:
            await ctx.voice_client.move_to(voice_channel)
pliant gulch
#

I don't even know my own wrapper nah, but for titles its just the kwarg

torn kettle
#

this is code

slate swan
pliant gulch
#

There is no setter for it after looking at the docs

#

so just Embed(title=...)

slate swan
#

some of your docs like the Client one is good

#

the lower ones are not so descriptive

#

and hella confusing

pliant gulch
#

I did almost all the base stuff you see in lefi

#

my collaborator blanket did some other stuff

#

such as some http methods, embeds, flags and enums

slate swan
#

i see

#

works splendid now

pliant gulch
#

👍

slate swan
torn kettle
#

nvm i found my stupid mistake

slate swan
pliant gulch
#

Heres the flowchart I'm following for release if your interested

slate swan
pliant gulch
#

https://github.com/an-dyy/Lefi/pull/5 Heres the pull request where I'm actually doing all the command stuff, more accurately its on the ext branch although

pliant gulch
#

thanks ❤️

slate swan
#

im making a very simple register command that only adds a role, changes the nick and that if it's successful it'll add a simple checkmark to the "!register ..." message and if the nickname already exists it'll add a cross to the message and it'll send a message to the author with a certain message

#

and i can't seem to figure out how to do it

tulip oracle
#

whats the reason behind having a unique nickname

slate swan
#

it's for a certain gamemode/competitive thing

tulip oracle
#

you are going to need to compare every nickname, so store it

slate swan
#

yeah but i need it to be only possible with one name cus it's for a mc gamemode

tulip oracle
#

as i just said

slate swan
#

still storing?

tulip oracle
#

well i dont suppose you wont to loop through every members display_name

slate swan
#

so best way is via database or just a json file will do fine?

tulip oracle
#

json is not a db

slate swan
#

i know

#

but i mean sqlite3 or json

#

which one should i do

tulip oracle
#

a json is not a db.
sqlite3 is good for small bots. if you like using dicts then you can use mongo db

slate swan
#

i know json isn't a db, but would json be good enough for storing such simple things or is it better to use sqlite3 for it, to prevent data leaks

tulip oracle
#

storing data in a json is astronomically bad practise

slate swan
#

yeah alr so sqlite3 is the way then

tulip oracle
#

if you wish. sql takes 10 mins of reading to learn. mongo is very easy also and who doesnt like working with dicts

slate swan
#

yeah i already know sql so i'll be fine with that

sick birch
#

static data, sure, but dynamically changing data inside a json is a big no no

slate swan
#

How do I get rid of the [<Userflags.?

scarlet fjord
#

add [12:] before .title() to remove the first 12 characters from the string

#

possibly a better way to do this but im guessing this will work just as well

#

@slate swan

tulip oracle
#

if int(details["level"]) in levelupdict.keys() and not message.author.bot:
im checking that the users level is in the dict values. if not then pass, when the users level is not in the dict is errors nonetype and since its on_message it literally clogs up my terminal. anyway to not do that? lmao

slate swan
desert temple
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

covert igloo
#

are you able to delete ephemeral messages

#

with delete_after

vapid ingot
#

Hey guys I'm hoping someone can point me in the right direction as to what I will need to accomplish this. I'm very new to coding but I need to get out of following tutorials and actually start doing something.

I want to code a bot for my discord server. The bot should allow users to upload pics to the bot via discord and via commands, the pic will show.

In our Minecraft server, players have Plots so for example

[]Plot @vapid ingot

Displays a gallery of screenshots uploaded by Abdul

tulip oracle
#

im guessing these screenshots are stored on the minecraft api?

vapid ingot
#

If someone can help me come up with some sort of structure that would be great

tulip oracle
#

you arent giving us any idea what you are trying to do

#

where are these images coming from

boreal ravine
lilac latch
#

Why??

boreal ravine
lilac latch
#

WTF is that??

boreal ravine
lilac latch
slate swan
#

^

boreal ravine
slate swan
#

Kayle, it won't give you an error in ur console or whatever

lilac latch
boreal ravine
lilac latch
#

Read

boreal ravine
#

yes

boreal ravine
slate swan
#

Where else should the error be?

#

In the sky...? Underground? Sea maybe?

boreal ravine
#

in the ephemeral message..?

boreal ravine
lilac latch
#

How to solve the problem

boreal ravine
dapper cobalt
vapid ingot
#

Would I need to upload them personally?

covert igloo
#

@dapper cobalt hey been testing out dislash. what is the attribute to be able to grab the interaction user

#

i tried interaction.user.mention but that isnt a thing

covert igloo
dapper cobalt
lilac latch
# dapper cobalt Can you show your code?
    name="truth",
    description="Sends a random truth"
    )
async def truth(
    inter: disnake.ApplicationCommandInteraction,
    rating = Param(
        description="The Rating of which you want the question to be")
    ):
    if rating == None:
      r = requests.get(f"https://api.truthordarebot.xyz/api/truth/?rating=")
      res = r.json()
      Tile = f"Here is a truth for you"
      Desc = res['question']
      embed=discord.Embed(title=Tile, description=Desc, color=bot_embed_color)
      await inter.response.send_message(embed=embed)
    else:
      try: 
        r = requests.get(f"https://api.truthordarebot.xyz/api/truth/?rating={rating}")
        res = r.json()
        Tile = f"Here is a {rating} rated question for you"
        Desc = res['question']
        embed=discord.Embed(title=Tile, description=Desc, color=bot_embed_color)
        await inter.response.send_message(embed=embed)
      except:
        await inter.response.send_message("Please send a valid rating!! Valid parameters are `pg`,`pg13`,`r`")```
#

Sorry for late reply I got a call

dapper cobalt
#

Try await inter.reply instead of await inter.response.send_message.

dapper cobalt
#

Why not?

lilac latch
#

Wrong Syntax

dapper cobalt
#

Pass inter without disnake.ApplicationCommandInteraction.

lilac latch
boreal ravine
lilac latch
dapper cobalt
#
@inter_client.slash_command(description="Test command")
async def test(inter):
    await inter.reply("Test")
#

It's an example from the documentation.

lilac latch
dapper cobalt
#

Ah, disnake not dislash.

lilac latch
#

Yup

covert igloo
#

this just prints the property

dapper cobalt
#

Which discord.Member?

gloomy quest
#

how to get a person's avatar

#

see

covert igloo
gloomy quest
#

it doesnt come

lilac latch
unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

covert igloo
#

i dont know how you get the member that interacted

gloomy quest
#

kk

dapper cobalt
#

You can't tell it to mention a member without telling it which member.

covert igloo
#

i dont know how you get the member that interacted

dapper cobalt
#

inter.author

#

Show your whole command's code.

dapper cobalt
covert igloo
gloomy quest
#
@client.command()
async def test(ctx, member:discord.Member):
 member_avatar = member.avatar_url_as(*, format=None, static_format='webp', size=1024)```
dapper cobalt
gloomy quest
#

k

#

asset is not callable

boreal ravine
#

or format=None

dapper cobalt
gloomy quest
#

no

#

3

dapper cobalt
#

3 what?

boreal ravine
#

3.0?

gloomy quest
#

ye

boreal ravine
#

what the

dapper cobalt
#

That's not even a thing..

boreal ravine
#

not even the main dpy or any other forks are 3.0 not to my knowledge

dapper cobalt
#

print(discord.__version__) and see what version are you using.

gloomy quest
#

k

boreal ravine
#

or pip freeze

slate swan
#

🤨

boreal ravine
gloomy quest
#

ye

boreal ravine
#

and there was no output..?

gloomy quest
#

yeah....

boreal ravine
#

well you must've did something wrong

gloomy quest
#

well how do I update my version

boreal ravine
gloomy quest
#

it says module discord has no attribute version

boreal ravine
#

hm

dapper cobalt
#

Anyways, try member.avatar.url and see.

gloomy quest
#

k

boreal ravine
#

k

gloomy quest
#

str object has no attribute url

slate swan
#

member.avatar.url is a thing only in 2.0+

#

if you are using the pypi version (<=1.7.3) it would be member.avatar_url

thorn heart
#

command async def name(ctx, argument)
So argument would be something going after the command right?

slate swan
#

ctx is Context object

thorn heart
#

how could i use text as mentioned user and for example return his avatar url

#

would it be

#

ctx.send(arg.avatar.url)

#

or what

slate swan
#

depending upon the argument name , its argument.avatar_url if you have installed discord.py's pypi version

lament flower
#

context.author.avatar_url

thorn heart
slate swan
#

no.

lament flower
#

not in context to a command?

#

oh i see

slate swan
#

take it as an example

thorn heart
#

yeah thanks!

#

Command raised an exception: AttributeError: 'str' object has no attribute 'avatar_url'

slate swan
#

typehint user

#

user : discord.User , in the function

thorn heart
#

Yeah it works hella yeah thanks

thorn heart
#

or the first one wouldnt work

lament flower
#

() means you're calling a function - discord.User is a class that contains functions

slate swan
thorn heart
#

thanks

#

how to get the url from attachment?

#

it says message.attachments list has no url

#

it returns this

#

<Attachment id=898427555231698964 filename='90674364_p0.jpg' url=

#

'any url'

#

how to get only url

#

[url]?

slate swan
#

attachments[index].url

#

!d discord.Attachment.url

unkempt canyonBOT
#

The attachment URL. If the message this attachment was attached to is deleted, then this will 404.

thorn heart
slate swan
thorn heart
#

what if i want to send them all in one message then?

slate swan
#

make a list and then append the urls , join the list using .join function and send it

thorn heart
#

oh

#

Is there any argument for the user who deleted message? for example admin deleted someones message can i have somehow his user id

boreal ravine
#

the admin or the author of the message

thorn heart
#

admin

#

ik you can message.author

#

but how do i have the admins id

boreal ravine
#

you can't get an id of a user who deleted the message except using the audit log action thingy

feral marsh
lament mesa
boreal ravine
#

nextcord, hikari

thorn heart
#

how to reference message that bot just have sent?

slate swan
slate swan
#
message = await ctx.send(......
``` and message would be the message reference
thorn heart
#

wow never thought about that thanks

#

i forgot it returns message

slender river
#

hey im getting the "bad token passed" error and ive tried literally everything i know to try to fix it and it even worked in a scratch python file i made.

#

srry to interrupt lol

slate swan
slender river
#

ill send a snippet

#
try:
    prefix.run(os.getenv('TOKEN'))
except discord.errors.LoginFailure as a:
    print("Meech has Tripped and Fell because a Bad Token was passed")
#

and ive tried it outside the try: as well it didnt seem to matter

slate swan
#

is your .env file something like env TOKEN = "THE TOKEN"

slender river
#

nah i was using replits "secrets" feature

slate swan
#

oh

slender river
#

ill try it rn

slate swan
#

nah , it wont be supported by replit

slender river
#

rlly?!

slate swan
#

try removing the " once from your secret

slate swan
slender river
#

could it possibly be anything with the internet?

slate swan
#

this is how you should enter the token ( dw its invalid token)

slender river
#

i was askin bc ive made another small test file using the same token and it worked fine

slender river
boreal ravine
slate swan
#

dumb question , but did you save it?

boreal ravine
#

i did this token = os.environ['KEY'] then did bot.run(token)

slate swan
#

well , os.getenv does same iirc

#

!d os.getenv

unkempt canyonBOT
#

os.getenv(key, default=None)```
Return the value of the environment variable *key* if it exists, or *default* if it doesn’t. *key*, *default* and the result are str.

On Unix, keys and values are decoded with [`sys.getfilesystemencoding()`](https://docs.python.org/3/library/sys.html#sys.getfilesystemencoding "sys.getfilesystemencoding") and `'surrogateescape'` error handler. Use [`os.getenvb()`](https://docs.python.org/3/library/os.html#os.getenvb "os.getenvb") if you would like to use a different encoding.

[Availability](https://docs.python.org/3/library/intro.html#availability): most flavors of Unix, Windows.
slate swan
#

hm

boreal ravine
#

i just used the tutorial

slate swan
#

alright @slender river you will be using os.getenvb('TOKEN')

#

since replit is based on linux systems

boreal ravine
#

are ur presence intents on?

slate swan
#

then idk, they work for my bot, and so did kayle's example for his bot, so must be some issue on your end

#

try printing the member's activity

#

see if that returns you anything

slate swan
#

i clearly says "his"

boreal ravine
#

lol

slender river
slender river
boreal ravine
#

code?

slender river
#

that sounds like itll work

#

ill try it rn

boreal ravine
#

spot.color is a tuple

#

change it to something else

#

and spot is a variable for the activity

#

i dont think activities have colors

slate swan
#

since it's a tuple you must index it

#

e.g: spot[0] | spot[1]

slender river
slate swan
#

but you should loop over its elements so that you don't do the same code again and again until you find the index which has the spotify activity

slender river
#
Traceback (most recent call last):
  File "main.py", line 109, in <module>
    prefix.run(os.getenvb('TOKEN'))
  File "/usr/lib/python3.8/os.py", line 792, in getenvb
    return environb.get(key, default)
  File "/usr/lib/python3.8/_collections_abc.py", line 660, in get
    return self[key]
  File "/usr/lib/python3.8/os.py", line 672, in __getitem__
    value = self._data[self.encodekey(key)]
  File "/usr/lib/python3.8/os.py", line 778, in _check_bytes
    raise TypeError("bytes expected, not %s" % type(value).__name__)
TypeError: bytes expected, not str
slate swan
#

also the way you defined your spot here returns a tuple of a generator object and None

#
for activity in user.activities:
  if isinstance(activity, discord.Spotify):
    ...  # Means that it found the activity so here add your code to send to the channel
    return  # Return so it doesn't also send the next line of code
await ctx.send('No spotify activity detected')
pale zenith
#

utils.find is also a great way to avoid iterating trough the activities.

spotify = discord.utils.find(lambda act: isinstance(act, discord.Spotify), member.activities)
if spotify:
    ...
else:
    ...
slate swan
#

or that ^

slate swan
pale zenith
#

yeah, but iterates lib side, which (in my opinion) looks better lol

slate swan
#

¯_(ツ)_/¯

#

activity.track iirc

pale zenith
#

activity.title

#

or .track_url if you want the link

slate swan
#

it's really not 😂

slate swan
pale zenith
#

is it? fuck

slate swan
pale zenith
#

will this be a v2.0 moment

#

yeah... damn it

slate swan
#

😂

pale zenith
slate swan
#

if you're not using 2.0 you can do this instead
f"https://open.spotify.com/track/{activity.track_id}"

pale zenith
#

?si=xrjyVAxhS1y5rNHLM_WRww

#

isnt that a tracker about you?

slate swan
#

it is?

pale zenith
#

like who shared the song?

slate swan
#

no clue what that is ngl

pale zenith
#

1 sec lemme check the spotify docs lol

slate swan
#

i made my spotify command back in january or so

#

no clue what that ?si=... is but it works 😂

pale zenith
#

nope kek_sad it isnt unique to you - its different on every song

slate swan
#

but i hard-coded that 🤔

pale zenith
slate swan
#

no clue why 😂

pale zenith
#

So recently Spotify added a "?si=" parameter to song when you copy the url. This apparently gives the url a unique stamp in where it was copied and by who. This is seemingly due to new EU regulations.
😳 😳

winter meadow
#

Can a bot with discord.py show a YouTube video for example?

pale zenith
#

bots cannot screen-share.

winter meadow
#

Ok

pale zenith
#

yeah better remove that 😳

slate swan
#

yes

lilac latch
#

Noo idea if it's a stupid question but how do filters work??

#

In music bots

thorn heart
#

can someone help me i cant host my bot on heroko

river vapor
#

what will be the output of it?

print(''.join(map(lambda x:chr(x),[115 if i==int(False) else ((((int(True*2) * 50)-5)+25)-5)+int(True>>False) if i==int(4*6-8+459-74==401) else int(''.join(chr(int(l))for l in(49,50-1,50+2)))for i in range(3)]))+''.join(chr(i+int(True*2) if pos==int(str(list(range(0, 101))[-1])[-1]) else i*int(bool(True))) for pos,i in enumerate([95+(((i+1)*10) if i==int(4*5*9/6/1*70==2101) else ((i+1)*10 - 5)) if i==list(range(0, 11))[True<<False] else int(''.join(map(lambda x:chr(x), (int((True+True)**5)+17, (int((True+True)**5)+17+2)-3, int(''.join(map(lambda x: chr(x), ((list(filter(lambda x:x%3==0,range(0, 100)))[18])-int(True),list(filter(lambda x:x%7==0,list(range(0, 100))))[(True*(True+True))**3 - 1]))))))))for i in range(int(3*(2+2!=5)))])))

KEK

slate swan
thorn heart
river vapor
boreal ravine
slate swan
river vapor
thorn heart
slate swan
#

Just put python main.py

#

They freshly install python, so you don't need to specify 3

thorn heart
#

So do u actually pay for winrar

slate swan
#

Who doesn't gopherthinking

noble moon
#

Hey just out of curiosity does discord allow bots to set their profile picture per server like the nitro perk does or is still still exclusive to nitro?

slate swan
#

Not for now

#

Maybe in the future

thorn heart
#

You cant even change background profile colour what are talking about haha

slate swan
#

Not yet

noble moon
#

Okay that’s what I thought because I’ve been poking around for a while and wasn’t sure if it just wasn’t in discord.py yet or if they just haven’t opened it to the api

slate swan
#

But that's possible

#

Some bots already have a different banner

slate swan
#

Just different color

boreal ravine
noble moon
boreal ravine
#

everyone has it

slate swan
slate swan
boreal ravine
slate swan
#

Custom colors

valid perch
#

Alternately use a different python library, hikari is nice and not exactly brand new

noble moon
#

I’m lookin into other languages now I just wasn’t sure how much was added before it stopped

slate swan
#

Haven't seen a bot with a custom picture banner

#

Just custom color

#

MEE6 had a red banner a few weeks ago, which is not the most significant color of it's profile picture

noble moon
#

I’ve seen bots do a lot of stuff so it’s always worth a ask around … never know what ya may be surprised by…anyway thanks for confirming my suspicions

slate swan
#

Yes I am

thorn heart
#

Hey i ve changed it to python main.py still fails

slate swan
#

I've seen it from my own eyes

#

And pretty sure some others did

#

So you can ask around and get a confirmation

thorn heart
#

@slate swan can you hlep mee please

slate swan
#

What are your buildpack settings

thorn heart
noble moon
slate swan
#

Go to settings

#

Of the Heroku project

thorn heart
slate swan
#

hmmm

#

Try to create a project again

#

But this time specify the buildpack before deploying

thorn heart
#

maybe requirements are bad

slate swan
#

Do you have a requirements.txt file?

thorn heart
#

haha just discord

slate swan
#

and there are 2 lines, what's the next line

thorn heart
#

i deleted it it was youtube_dl

slate swan
#

It's not a music bot right

thorn heart
#

still failed

thorn heart
slate swan
#

mmk

#

Well, create a new project and instantly set the buildpack to Python before linking your github repository

thorn heart
#

i did as you said

#

still fail

slate swan
#

Hmmm it's weird, never seen that before to be honest

boreal ravine
#

@slate swan when mee6's banner was red were u on mobile when you saw that?

thorn heart
#

should repo be public or it doesnt matter?

slate swan
#

Was that a discord bug KEKW

boreal ravine
slate swan
boreal ravine
slate swan
#

It was red on mobile, all I remember

boreal ravine
#

well they said they were on mobile too

thorn heart
#

can we go in dm krypton

slate swan
#

and still is actually

slate swan
#

ikr

#

that's why i never liked mee6

thorn heart
#

krypton hey can we go in dms

boreal ravine
slate swan
boreal ravine
slate swan
#

everything is payed 😂

slate swan
boreal ravine
#

even unb is more cheaper I think

slate swan
#

u can't even set a custom prefix without premium

boreal ravine
slate swan
#

even a good cheap vps is cheaper than their cheapest option

boreal ravine
#

lmao

slate swan
#

ovh for example

slate swan
#

So it's definitely up to date, and even more than most of the people

#

3 times cheaper

boreal ravine
slate swan
#

Nothing new

#

That's what I've said

boreal ravine
#

is the alpha thingy the beta program?

slate swan
#

its different

#

not available on play store

#

But it's the only bot though

slate swan
boreal ravine
slate swan
#

Alpha

boreal ravine
#

oh

slate swan
boreal ravine
#

nice

thorn heart
#

@slate swan

#

can you help pls i still cant deploy it on heroko

slate swan
#

As I said, I can't help any further as I've never faced this issue or seen anyone having it

thorn heart
#

is this right?

#

and this one

slate swan
#

Yes

tawdry perch
slate swan
#

89.90 💀

tawdry perch
#

There are many free ones that beat the mee6 easily

slate swan
#

exactly 😂

#

Atlas for example

tawdry perch
#

Python bot as example

slate swan
#

Pretty good replacement

tawdry perch
#

But paying for discord bot is big mistake

willow vine
#

I've got a task function in one cog and i want to start it in the main script using on_ready(), but it says that the function is not defined

slate swan
tawdry perch
#

If you happen to pay few bucks it is not that big lost but nearly 90 bucks for a single bot

slate swan
#

my bot that has more features including some unique features and even the exact same features mee6 has beats mee6 easily and i payed nothing for it 😂

tawdry perch
#

dang

slate swan
slate swan
tawdry perch
#

3 mongo dbs?

slate swan
#

yes

#

i like being cautious

boreal ravine
#

for?

slate swan
#

in case 512MB isn't enough

tawdry perch
#

Oh

boreal ravine
slate swan
#

although it should be plenty, i just like overdoing things 🤣

tawdry perch
#

I see

slate swan
#

at least that way i don't have to worry about the db space 😌

tawdry perch
#

now teach me how to use heroku for discord bot hosting

tawdry perch
#

I could get a good host for 1 year for free, but I'd like to save them for my API site (if I make one)

tawdry perch
willow vine
tawdry perch
#

Kraots typing a essay

slate swan
# tawdry perch now teach me how to use heroku for discord bot hosting
-> step 1: make a git repo with all of your bot files

-> step 2: go to your heroku account, create a new app (located in US, will get your average bot latency to under 30ms 100% of the time)

-> step 3: go to settings and add python buildpack, then click "Reveal Config Vars" and add your bot token, along with whatever you have in your .env there

-> step 4: go to deploy, select Github, connect your github account, then select your bot's repo

-> step 5: make sure your bot directory has a file named `Procfile` which has "worker: python main.py" (or whatever the file that runs your bot is) and a requirements.txt where you have your requirements listed in newlines

-> step 6: go to overview, click Configure Dynos and then click that pencil icon and toggle the button then click Confirm

-> step 7: make sure you have 2 heroku accounts and switch between them at the end of each month (when you get an email from heroku saying that you're running out of dynos, they refresh at the start of each month)

-> step 8: done
slate swan
tawdry perch
#

I mean it was half a joke

slate swan
#

😔

tawdry perch
#

Not really, thx alot. I may use that to create that

slate swan
#

well it still may be helpful to someone 😎

tawdry perch
#

Indeed

willow vine
slate swan
#

both heroku and github

willow vine
#

yu said mongo

slate swan
#

wait

#

OH

willow vine
#

lol

slate swan
#

shh no one saw it

#

step 7 😎

tawdry perch
#

so I have to keep creating new account?

slate swan
#

no, you just need 2 accounts

#

since the dynos refresh at the start of each month

tawdry perch
#

what does that mean?

slate swan
#

even if you get them to 0 during one month, at the start of the next one they'll be back to 500

tawdry perch
#

oh, so is that why you have 2 account?

slate swan
#

yeah

tawdry perch
#

but a possible data loss in dbs?

slate swan
#

well, only if you're using their postgre

#

maybe

#

idk, never used heroku's postgre

tawdry perch
#

mongodb = server based?

slate swan
#

always used mongo 😎

slate swan
#

it's not client based

maiden fable
#

Me who uses JSON 😐

tawdry perch
#

._.

#

inserts JSON is not a database

slate swan
#

😂

willow vine
#

I've got a task function in one cog and i want to start it in the main script using on_ready(), but it says that the function is not defined

#

can someone help me with this

maiden fable
#

Eh, well it's preferred when u got an AI and u gotta save it's information in a file

slate swan
#

i only use json to store my spam|word filter data 😂

tawdry perch
maiden fable
slate swan
maiden fable
tawdry perch
#

I see, I may keep pinging you the whole day because you sent the guide

maiden fable
#

I can show u my JSON file in the disnake server haha

tawdry perch
tawdry perch
maiden fable
#

???

tawdry perch
#

nothing, forget it. It never happened

slate swan
tawdry perch
#

yt = bad, pings = good

slate swan
#

cutely mutes the server 😎

maiden fable
#

😂

tawdry perch
slate swan
tawdry perch
#

ok, this is nicely off topic

slate swan
#

yes very much

maiden fable
#

phew

tawdry perch
slate swan
#

wdym

#

connecting to your mongodb?

#

you need the key which you get from going to your mongo cluster -> connect and then you complete the steps

tawdry perch
#

Ok so first I rewrite my database system on bot

#

I have sqlite db which can be a problem

slate swan
#

How do I count 5 minutes?
I want to print it out like this in ~minutes ~seconds.

#

using motor to connect in your code: ```py

Docs https://motor.readthedocs.io/en/stable/

import motor.motor_asyncio

cluster = motor.motor_asyncio.AsyncIOMotorClient(MONGO_KEY_HERE)
database = cluster['DATABASE_NAME_HERE']

Then you have 2 ways of accessing one of your collection that you have inside your database, you can either access it as you'd do with a class attribute, or as you'd do with a dict

NOTE: They are all case sensitive

Example 1, dict:

collection = database['COLLECTION_NAME']

Example 2, attribute:

collection = database.COLLECTION_NAME

To see collection methods go to https://motor.readthedocs.io/en/stable/api-asyncio/asyncio_motor_collection.html

slate swan
#

this will print until 5 minutes is reached, then stop

rapid whale
#

Is there a channel creation callback existent? I cannot find it in the docs unfortunately

slate swan
#

?

#

Why do you need a callback

rapid whale
slate swan
#

!d discord.on_guild_channel_create

unkempt canyonBOT
#

discord.on_guild_channel_delete(channel)``````py

discord.on_guild_channel_create(channel)```
Called whenever a guild channel is deleted or created.

Note that you can get the guild from [`guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.guild "discord.abc.GuildChannel.guild").

This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
slate swan
#

Well that's not called a callback but yeah

#

ik, was just saying

#

Yeah I know

rapid whale
#

Alright, thanks both of you

slate swan
#

Just confused me

#

¯_(ツ)_/¯

#

For the next time, it's an event getting fired

#

😂

slate swan
#

So you probably haven't searched at all ¯_(ツ)_/¯

rapid whale
slate swan
#

CTRL+F

#

¯_(ツ)_/¯

ashen escarp
#

can somebody help me with creating a discord bot. I am new and I need help with it

slate swan
#

Have you learned Python?

severe field
#

How to send messages in local chats of users

slate swan
#

You mean private message?

severe field
#

Yes

slate swan
#

!d discord.User.send

ashen escarp
#

i have not learned python

unkempt canyonBOT
#

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**.
ashen escarp
#

i am completely new

slate swan
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

Start by learning Python :p

ashen escarp
#

ok

severe field
#

And how to get private message that was send to bot?

slate swan
#

It fires the on_message event

thorn heart
slate swan
#

So you can get the content on the same event

thorn heart
slate swan
#

That's the most dominant color

#

Nothing to do with MEE6

thorn heart
#

i dont think so there is background color

slate swan
#

So what?

thorn heart
#

it was another one more black one like on my another device

#

it is different on every device

boreal ravine
#

it just depends on what discord you use and how buggy it is

slate swan
#

mine's appear same for all devices

reef shell
boreal ravine
slate swan
#

or not

slate swan
reef shell
unkempt canyonBOT
#

class discord.DMChannel```
Represents a Discord direct message channel.

x == y Checks if two channels are equal.

x != y Checks if two channels are not equal.

hash(x) Returns the channel’s hash.

str(x) Returns a string representation of the channel
slate swan
#

Both works

slate swan
boreal ravine
reef shell
slate swan
#

Don't use forks

#

My only recommendation

reef shell
#

I've looked into some d.js and eris codes, seemed messier than dpy

slate swan
#

messier?

#

Is that a word lmao

reef shell
#

I guess

boreal ravine
#

it is

slate swan
reef shell
#

Ok my creation if not kek

slate swan
slate swan
#

You already got given the code for the other way

#

then just reverse it, ain't hard, you should be able to do that alone

#

Just use you knowledge to reverse it

#

^

#

Okay

#

Oh I solved it thanks

slate swan
#

that one

tawdry perch
slate swan
#

where's your free dynos tab

willow vine
slate swan
#

maybe that'll fix it

tawdry perch
#

Procfile = a specific file?

willow vine
#

I've got a task function in one cog and i want to start it in the main script using on_ready(), but it says that the function is not defined
can someone help me with this

slate swan
tawdry perch
#

Oh I though it was meaning something else

tawdry perch
#

no, I don't get it

#

what is ```
"bot has a Procfile which has "worker: python main.py"

willow vine
#

create a file named Procfile

tawdry perch
#

oh

willow vine
#

inside that type `worker: Python main.py"

slate swan
#

there i changed it

willow vine
#

save

slate swan
#

made it more "explicit"

tawdry perch
#

python -m MyBot would work as well?

slate swan
slate swan
slate swan
tawdry perch
#

oh, good to know. Thx, I will keep pinging you 27 hours a day

willow vine
slate swan
# slate swan ?

The code below While True doesn't work, is there any other way?

tawdry perch
#

huh?

#

why not

slate swan
#

i even tested my own example

#

and it worked perfectly

tawdry perch
willow vine
willow vine
tawdry perch
#

mind to explain

slate swan
#

if you're using it outside the function replace return with break

#
import time

seconds = 0
while True:
    seconds += 1
    m, s = divmod(seconds, 60)
    if m == 5:
        print('5 minutes')
        break
    elif m == 0:
        print(f'{s} second(s)')
    else:
        print(f'{m} minute(s) {s} second(s)')
    time.sleep(1)
willow vine
#

yeah

tawdry perch
#

so worker: python __main__.py to use the main file?

slate swan
#

no

#

just worker: python main.py

#

The code below is activated, but the code below is activated, but the bot doesn't turn on..

willow vine
willow vine
#

^

slate swan
#

what are you trying to do

tawdry perch
willow vine
#

which one is that

tawdry perch
#

I do

slate swan
tawdry perch
willow vine
slate swan
#

if your file is named __main__.py then it'll work

#

The count keeps running and I want to output the count to the bot

tawdry perch
#

Aight, I will try pushing these changes to github

slate swan
willow vine
#

ur printing the output

willow vine
slate swan
#

and instead of time use asyncio

willow vine
#

you won't even need that

slate swan
#

Also u gotta await asyncio or else it wont work

#

time.sleep puts the whole process to sleep

slate swan
torpid hill
#

Can someone help me with slash commands using http method

slate swan
#

if you dk how to do it yourself then consider using a fork of dpy (best one so far is disnake)

visual island
#

btw @slate swan, are you still hosting on somehost?

slate swan
#

nope

visual island
#

you got a better one?

slate swan
#

couldn't get my deps to work on it

#

heroku 😎

visual island
willow vine
#

hey can someone help me with my

#

issue

#

when im running my code locally it works fine but when i deploy it, it throws a file not found error

#

even though the file is present

slate swan
#

show code

willow vine
#

just a sec

torpid hill
slate swan
#

Why do you need http method

torpid hill
slate swan
#

Use discord-py-interactions

marble pilot
#
 #Announcement Creation
            message_title = title_msg.content
            message_description = description_msg.content
            #Field Title = message_field_title
            if message_is_embed == True:
                if message_has_timestamp:
                    announcement_embed = discord.Embed(title=f"{message_title}", description=f"{message_description}", color = discord.Colour.blue(), timestamp=ctx.message.created_at)
                    await announcement_channel.send(embed=announcement_embed)
                    #If embed has field

                elif not message_has_timestamp:
                    announcement_embed = discord.Embed(title=f"{message_title}", description=f"{message_description}", color = discord.Colour.blue())
                    await announcement_channel.send(embed=announcement_embed)
                if message_has_field:
                    announcement_embed = discord.Embed(title=f"{message_title}", description=f"{message_description}", color = discord.Colour.blue(), timestamp=ctx.message.created_at)
                    announcement_embed.add_field(name=f"{message_field_title}", value=f"{message_field_description}")

                    await ctx.send(embed=announcement_embed)

Im making an announcement cmd. And when i send the embed at the last line,
"await ctx.send(embed=announcement_embed)"
I get the error:

HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.fields.0.name: Must be 256 or fewer in length.
#

Please help

#

Im not giving it a big input

#

just 1 character for title and 1 for desc

torpid hill
slate swan
#

This one is too big

#

Over 256 characters

marble pilot
#

It is:

message_field_title = await self.Bot.wait_for("message", check=lambda message: message.author == ctx.author and message.channel == announcement_creation_channel)
slate swan
#

message_field_title is a message object

marble pilot
#

i use the same wait_for for all the other things

slate swan
#

Use message_field_title.content

marble pilot
#

huh

#

i am creating my own vars

slate swan
#

Doesn't matter

echo pivot
#

Hi . I wanted to ask how can I put the results we get from a for loop into an embed and not separate each of the results in an embed.

@client.command()
async def seetc(ctx , * , url):
    if not "https://" is str(url) or not "http://" is str(url):
        url = "http://" + str(url)
    else:
        pass
    result = builtwith.parse(url)
    for name in result:
        value = ''
        for val in result[str(name)]:
            name = name.replace('-',' ')
            name = name.title()
            value += str(val) 
        embed = discord.Embed(
            title = "See Technology",
            description = f"{name}" + "  :  " + f"{value}", 
            Color  = "#6ec21d"
        )
        embed.set_author(name = "Site Url" , url = f"{url}")
        await ctx.send(embed=embed)
marble pilot
slate swan
#

wait_for("message") returns a Message object, which is over 256 charcaters

#

put only the content attrribute to your embed

#

not the entire object

willow vine
marble pilot
#

so what will i do

slate swan
#

When putting the embed field name

marble pilot
#

Okay so i put that in the lamda

slate swan
#

no

slate swan
slate swan
#

Where you did announcement_embed.add_field

willow vine
slate swan
#

Add .content

slate swan
marble pilot
#

lemme try

slate swan
#

When setting the embed field name

willow vine
# slate swan

i tried without the rawstring as well, it didn't work

slate swan
#

same for description

marble pilot
#
message_field_title.content = await self.Bot.wait_for("message", check=lambda message: message.author == ctx.author and message.channel == announcement_creation_channel)
```?
slate swan
#

Dude

#

I literally said over 5 times

#

In. the. embed. field. name.

marble pilot
#

bro

slate swan
#

Is it that hard?

#

Add .content after the variable name

echo pivot
#

I wanted to ask how can I put the results we get from a for loop into an embed and not separate each of the results in an embed.

@client.command()
async def seetc(ctx , * , url):
    if not "https://" is str(url) or not "http://" is str(url):
        url = "http://" + str(url)
    else:
        pass
    result = builtwith.parse(url)
    for name in result:
        value = ''
        for val in result[str(name)]:
            name = name.replace('-',' ')
            name = name.title()
            value += str(val) 
        embed = discord.Embed(
            title = "See Technology",
            description = f"{name}" + "  :  " + f"{value}", 
            Color  = "#6ec21d"
        )
        embed.set_author(name = "Site Url" , url = f"{url}")
        await ctx.send(embed=embed)

Please help me

slate swan
#

Create a list

#

Append to the list in your for loop

#

Then use something like ", ".join(yourList)

echo pivot
slate swan
slate swan
#

Create a list, add elements to the list, get the elements from the list

willow vine
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: FileNotFoundError: [Errno 2] No such file or directory: 'icons\\04d.png'
This the error being raised
the code is

file = discord.File(fr"icons\{image}", filename="image_url.png")```
slate swan
#

Basic Python knowledge

echo pivot
slate swan
#

And don't use \ for getting into folders, but /

slate swan
boreal ravine
still tiger
#

So, i am making an error handler that looks something like this:

    @commands.Cog.listener()
    async def on_command_error(self, ctx: commands.Context, error):
        """Handles errors"""
        if isinstance(error, commands.CommandNothe heckound):
            return

        elif isinstance(error, commands.MissingPermissions):
            await ctx.send(
                embed=create_embed(
                    title=f"❌ Missing permissions",
                    description=f"You miss permissions to run this command: {COMMAND HERE}",
                    uthor_text=error,
                    color="red",
                )
            )

How can I reference what command could not be ran due to missing permissions?

willow vine
gloomy pewter
#

What is the difference between discord.User and discord.Member?

slate swan
#

Self explaining I guess

#

discord.Member has attributes and functions for guild stuff

#

!d discord.Member

unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

hash(x) Returns the member’s hash.

str(x) Returns the member’s name with the discriminator.
slate swan
#

!d discord.User

unkempt canyonBOT
#

class discord.User```
Represents a Discord user.

x == y Checks if two users are equal.

x != y Checks if two users are not equal.

hash(x) Return the user’s hash.

str(x) Returns the user’s name with discriminator.
slate swan
#

Member of guild

#

User of discord

gloomy pewter
#

Okay thanks

still tiger
#

okay thanks

tawdry perch
#

I think I need some sort of add ons

slate swan
#

all you need is the Procfile to run your code

#

like this

tulip oracle
#

You will need to store the images

#

@vapid ingot

tawdry perch
slate swan
#

then idk

#

for me there is

tawdry perch
#

I have pushed it to github alrd

#

._. heroku broken

slate swan
#

¯_(ツ)_/¯

tawdry perch
#

So all I need to do is push the Procfile to github, right?

slate swan
#

yes

#

then it'll appear in your dynos section

loud sierra
#
most recent call last):
  File "launch.py", line 2, in <module>
    from zeenode.load import load
  File "/home/runner/Frick/zeenode/load.py", line 3, in <module>
    from discord.ext import commands as zeenode
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/__init__.py", line 25, in <module>
    from .client import Client
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 27, in <module>
    import asyncio
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/__init__.py", line 21, in <module>
    from .base_events import *
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/base_events.py", line 296
    future = tasks.async(future, loop=self)

help

#

pls

slate swan
#

yeah it's like that because you're missing the Procfile

slate swan
#

no

loud sierra
#

pls help

#

me

slate swan
#

that's not the full error

#

can't help you if you don't send the full error

loud sierra
#
most recent call last):
  File "launch.py", line 2, in <module>
    from zeenode.load import load
  File "/home/runner/Frick/zeenode/load.py", line 3, in <module>
    from discord.ext import commands as zeenode
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/__init__.py", line 25, in <module>
    from .client import Client
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 27, in <module>
    import asyncio
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/__init__.py", line 21, in <module>
    from .base_events import *
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/base_events.py", line 296
    future = tasks.async(future, loop=self)
SyntaxError: invalid syntax

@slate swan help

tawdry perch
slate swan
#

what's zeenode

loud sierra
#

my friend asked it

slate swan
loud sierra
#

idk

slate swan
loud sierra
#

my friends

slate swan
#

doesn't matter, won't help u with selfbots

loud sierra
#

np

#

im closing

#

the topic

tawdry perch
slate swan
#

when it says Build in progress

#

you have to wait

#

until it's done with everything

#

and says Deployed

#

then it should be there after a refresh or 2

tawdry perch
slate swan
#

then you did something wrong

slate swan
#

somewhere

tawdry perch
#

Where am I supposed to see it at?

slate swan
tawdry perch
#

I did everything on the list

#

And nothing :/

slate swan
#

you sure you added the github

tawdry perch
#

I'm, just checked it

slate swan
#

i literally just made another heroku account for my new music bot and i'm already done, took me less than 3 minutes to set it up

#

so you defo did something wrong

visual island
tawdry perch
#

Hmm, how do the bot get the heroku secret var?

slate swan
#

😂

slate swan
visual island
#

so I prefer somehost..

tawdry perch
#

I mean it is there

slate swan
#

go to Settings => Reveal Config Vars => set the key to whatever you want (e.g BOT_TOKEN) and the value to your bot token

slate swan
tawdry perch
#

That may be problem

#

I had different way for variable

slate swan
#

¯_(ツ)_/¯

#

:/

gloomy pewter
slate swan
#

To get a member or user object you need the ID of the user

#

Regardless of what you want

#

!d discord.ext.commands.Bot.get_user

unkempt canyonBOT
slate swan
#

!d discord.Guild.get_member

unkempt canyonBOT
harsh mirage
#

Hello! I am making reaction role bot, anf i have some isuess. I will appriciate if someone could help me. Thanks!

Code:

import discord

client = discord.Client()

@client.event
async def on_ready():
	print("Logged in.")
	
@client.event
async def on_raw_reaction_add(payload):
	message_id = payload.message_id
	if message_id == 898312112944865302:
		guild_id = payload.guild_id
		guild = discord.utails.find(lambda g : g.id == guild_id, client.guilds)
		
		
		if payload.emoji.name == 'yen':
			role = discord.utils.get(guilt.roles, name = 'Yellow Team')
		elif payload.emoji.name == "euro":
			role = discord.utils.get(guilt.roles, name = 'Blue Team')
		else:
			role = discord.utils.get(guild.roles, name = payload.emoji.name)
			
		if role is not None:
			member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
		if member is not None:
			await member.add_roles(role)
		else:
			print("Member not found.")
	else:
		print("Role not found")
		
@client.event
async def on_raw_reaction_add(payload):
	message_id = payload.message_id
	if message_id == 898312112944865302:
		guild_id = payload.guild_id
		guild = discord.utails.find(lambda g : g.id == guild_id, client.guilds)
		
		
		if payload.emoji.name == 'yen':
			role = discord.utils.get(guilt.roles, name = 'Yellow Team')
		elif payload.emoji.name == "euro":
			role = discord.utils.get(guilt.roles, name = 'Blue Team')
		else:
			role = discord.utils.get(guild.roles, name = payload.emoji.name)
			
		if role is not None:
			member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
		if member is not None:
			await member.add_rremoves(role)
		else:
			print("Member not found.")
	else:
		print("Role not found")
		
@client.event
async def on_raw_reaction_remove(payload):
	pass
	

client.run('TOKEN')```
#

Error massage. This pops up when i add a reaction.

maiden fable
#

The module is utils

#

Not utails

#

Typo

harsh mirage
#

oh yea ty

#

@maiden fable i dont get it now

slate swan
#

reset your token...

maiden fable
#

Yes that too

harsh mirage
#

why

maiden fable
#

Cz we saw it...

#

I can control your bot now

slate swan
#

cause if you wont , anyone can use it..

harsh mirage
#

ik

maiden fable
#

.....

harsh mirage
#

i deleted some letters

slate swan
#

as for your error , you used member variable before defining it

maiden fable
#

Ah cool

harsh mirage
slate swan
harsh mirage
#
import discord

client = discord.Client()

@client.event
async def on_ready():
	print("Logged in.")
	
@client.event
async def on_raw_reaction_add(payload):
	message_id = payload.message_id
	if message_id == 898312112944865302:
		guild_id = payload.guild_id
		guild = discord.utails.find(lambda g : g.id == guild_id, client.guilds)
		
		
		if payload.emoji.name == 'yen':
			role = discord.utils.get(guilt.roles, name = 'Yellow Team')
		elif payload.emoji.name == "euro":
			role = discord.utils.get(guilt.roles, name = 'Blue Team')
		else:
			role = discord.utils.get(guild.roles, name = payload.emoji.name)
			
		if role is not None:
			member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
		if member is not None:
			await member.add_roles(role)
		else:
			print("Member not found.")
	else:
		print("Role not found")
		
@client.event
async def on_raw_reaction_add(payload):
	message_id = payload.message_id
	if message_id == 898312112944865302:
		guild_id = payload.guild_id
		guild = discord.utils.find(lambda g : g.id == guild_id, client.guilds)
		
		
		if payload.emoji.name == 'yen':
			role = discord.utils.get(guilt.roles, name = 'Yellow Team')
		elif payload.emoji.name == "euro":
			role = discord.utils.get(guilt.roles, name = 'Blue Team')
		else:
			role = discord.utils.get(guild.roles, name = payload.emoji.name)
			
		if role is not None:
			member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
		if member is not None:
			await member.add_removes(role)
		else:
			print("Member not found.")
	else:
		print("Role not found")
		
@client.event
async def on_raw_reaction_remove(payload):
	pass
	

client.run('TOKEN') ```
slate swan
#

guilt

#

Might want to change that to guild

#

and you might want to create a variable member set to None by default

harsh mirage
#

so like:

member = None ```?
slate swan
#

Well, what do you think?

#

You coded lambdas but you're not sure about how declaring a variable works

harsh mirage
#

im confused man

slate swan
#

You coded lambdas but you're confused on how to declare a variable

harsh mirage
#

man i did member = None

slate swan
#

Good then

slate swan
harsh mirage
#

fixed

slate swan
#

Hello! I am making reaction role bot, anf i have some isuess. I will appriciate if someone could help me. Thanks!

Code:

import discord

client = discord.Client()

@client.event
async def on_ready():
print("Logged in.")

@client.event
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 898312112944865302:
guild_id = payload.guild_id
guild = discord.utails.find(lambda g : g.id == guild_id, client.guilds)

	if payload.emoji.name == 'yen':
		role = discord.utils.get(guilt.roles, name = 'Yellow Team')
	elif payload.emoji.name == "euro":
		role = discord.utils.get(guilt.roles, name = 'Blue Team')
	else:
		role = discord.utils.get(guild.roles, name = payload.emoji.name)
		
	if role is not None:
		member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
	if member is not None:
		await member.add_roles(role)
	else:
		print("Member not found.")
else:
	print("Role not found")

@client.event
async def on_raw_reaction_add(payload):
message_id = payload.message_id
if message_id == 898312112944865302:
guild_id = payload.guild_id
guild = discord.utails.find(lambda g : g.id == guild_id, client.guilds)

	if payload.emoji.name == 'yen':
		role = discord.utils.get(guilt.roles, name = 'Yellow Team')
	elif payload.emoji.name == "euro":
		role = discord.utils.get(guilt.roles, name = 'Blue Team')
	else:
		role = discord.utils.get(guild.roles, name = payload.emoji.name)
		
	if role is not None:
		member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
	if member is not None:
		await member.add_rremoves(role)
	else:
		print("Member not found.")
else:
	print("Role not found")

@client.event
async def on_raw_reaction_remove(payload):
pass

client.run('TOKEN')

harsh mirage
#

utails fixed

slate swan
#

And why do you have twice the same event

#

Just as side question

boreal ravine
#

!pypi discordutils

unkempt canyonBOT
slate swan
#

Still need to fix guilt

#

ok i am done

        obj = {"item" == "fish", "amount" : amount}
        users[str(user.id)]["inventory"].append(obj)
      except:
        obj = {"item" == "fish", "amount" : amount}
        users[str(user.id)]["inventory"] = [obj]    ```
harsh mirage
slate swan
#

what is wrong with thattt

slate swan
slate swan
#

it's legit exactly the same

#

you assign values to keys with ":", not "=="

#

pl

boreal ravine
#

^

slate swan
#

ok

slate swan
#

in your case "item" == "fish" would just be False

harsh mirage