#discord-bots

1 messages · Page 717 of 1

oblique adder
#

if I can't access the channel how come the bot know that someone have add an reaction ?

maiden fable
#

Well idrk...

#

!d discord.TextChannel.fetch_message

unkempt canyonBOT
#

await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
maiden fable
#

Lemme see

haughty quartz
#

@slate swan it doesnt work when im trying to use !help or !commands

#
@bot.command()
async def say(ctx, help, commands):
   await ctx.send("help list")
shadow wraith
#

change help to something else as help is a built in thing in python

haughty quartz
#

bot.remove_command('help') i have this

haughty quartz
#

im trying to have multiple inputs for the same answer

fervent shard
boreal ravine
#

give command ideass

fervent shard
haughty quartz
haughty quartz
boreal ravine
maiden fable
haughty quartz
#

in discord js it works with the or operator but that doesnt seem to work here too

fervent shard
# haughty quartz yeah
@bot.command()
async def cat(ctx):
   await ctx.send("cat")```


```py
@bot.command()
async def kitten(ctx):
   await ctx.send("cat")```
#

is this what u mean

haughty quartz
#

yes

#

but in one code

#

not twice

maiden fable
#

A command which will accept an ebook file as the argument, parse it, and find the difficult words used in it, and getting the meaning and examples and other stuff about the words @boreal ravine

boreal ravine
#

whats an ebook lol

maiden fable
oblique adder
fervent shard
haughty quartz
#

yes

haughty quartz
ebon island
#

Had an exception last night - how do I troubleshoot something like this? I tried searching the error and was unsuccessful in finding it

AttributeError: '_ProactorSocketTransport' object has no attribute '_sock'
Unclosed connection

full error:

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001E2F7D02560>
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 114, in __del__
    if self._sock is not None:
AttributeError: '_ProactorSocketTransport' object has no attribute '_sock'
Unclosed connection
client_connection: Connection<ConnectionKey(host='discord.com', port=443, is_ssl=True, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>

Any ideas?

maiden fable
fervent shard
oblique adder
haughty quartz
#

thanks @maiden fable @fervent shard @oblique adder

maiden fable
#

And what's your Python version?

oblique adder
#

idk how to fix mine brainmon

maiden fable
#

Which

oblique adder
#

if I can't access the channel how come the bot know that someone have add an reaction ?

haughty quartz
#

thank yall so much i was in such a desperate need of these aliases lol

slate swan
#

aww

ebon island
#

My inclination is to assume it was caused by my attempt at an error handler for the message_sender method, simply resending after 2*n seconds per failed attempt

#

but even that I'm not sure about, that would just send another message so it doesn't seem like it'd break anything necessarily

#

just send a duplicate at worst

maiden fable
#

Hmm

#

Weird, I never got that error

ebon island
#

The message_sender retry loop was the feature I was testing last night and this is likewise my first time seeing that error as well

fervent shard
#

hey, it works but when i use commands, it replies 2 times

maiden fable
#

Wait wait wait @ebon island

#

Why u seeing isinstance(message, discord.Embeds)?

maiden fable
slender pollen
#

Hello, I need member to enter a number e.g. "!test 100" how I can get that number in variable?

ebon island
#

What do you mean hunter?

maiden fable
maiden fable
maiden fable
#

Why u doing isinstance(message, discord.Embed)

ebon island
#

Why am I using the isinstance to check for embed? I guess it might not be necessary if it recognizes the message is an embed without being told it is an embed via kwarg, I did so assuming it needed to be a kwarg'd "embed=embed" type keyword if it were an embed

maiden fable
#

!d discord.Message.embeds

unkempt canyonBOT
maiden fable
#

This is what u need to use haha

#

A message is always an instance of discord.Message

ebon island
#

I did type(message) and determined the type was the one I included the discord.embeds.Embed

maiden fable
#

Uhhh?

slate swan
#

I am trying to import information from another python file, why does it say module not found...

from weatherinfo import *
ebon island
#

sec I will demonstrate

shadow wraith
#

what's an API which looks for a rhyming word with the word given (and changes everytime reloaded)

ebon island
#

class 'discord.embeds.Embed'

#

my help command is an embed and since it hit that print statement it is being seen as isinstance == True

haughty quartz
#

is there a way to have only one command not using the prefix

velvet tinsel
shadow wraith
#

you could use an on_message event

velvet tinsel
#

Why are you using isinstance

ebon island
#

if I don't use the isintance and separate loop it sends embed like this:

haughty quartz
shadow wraith
shadow wraith
#

this will check if the message content IS the content and can't be seperated by spaces and shit, exact or no output

ebon island
#

I think there is a string method like startswith

#

you could maybe use that here?

#
if message.content.startswith('yourcommand'):
  celebrate_party_time()

Just an idea, seems like it would do the job

maiden fable
#

For that, ull have to edit the source code of discord.py, so, uhhh

haughty quartz
#

oh

#

okay haha i wont do that

knotty gazelle
velvet tinsel
#

Because they don’t want a prefix

shadow wraith
#

im trying to think of an api which uses json and finds a random rhyming word with the word given

ebon island
#

I have one

#

sec let me just find the name

#

datamuse API

shadow wraith
#

that shit is messy asf

ebon island
#

messy how?

shadow wraith
#

all of the objs are the same "word"

#

if i could get an example of using the api with aiohttp, that would be appreciated.

ebon island
#

you'd just make a get request with the params you want

#

so in the case of just a word that rhymes you'd do

https://api.datamuse.com/words?rel_rhy={word}
shadow wraith
#

ok but the json thing

#

how will the bot choose a random "word" property from the json

ebon island
#

so look at the api response

#

it is a list of dicts

slate swan
#

How come I receive a module not found error?

from weatherinfo import parse_data,weather_message,error_message

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.weather' raised an error: ModuleNotFoundError: No module named 'weatherinfo'

ebon island
#

[0]['word'] would return the first word value

#

as an example

shadow wraith
#

that makes sense now

#

and how would i measure how much word values are there?

ebon island
#

len

#

since it is a list

shadow wraith
#

oh yeah

#

!e

test = {1: "one", 2: "two"}
print(len(test)))
unkempt canyonBOT
#

@shadow wraith :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     print(len(test)))
003 |                     ^
004 | SyntaxError: unmatched ')'
ebon island
#

and if you wanted to use a random choice you could have choice(num) where num = len(result) as an example

wanton veldt
#
    @commands.command()
    async def help(self, ctx):
        culoare = "{:06x}".format(random.randint(0, 0xFFFFFF))
        embed = discord.Embed(title="Commands for this bot!", description="**Prefixul acestui bot este ´.´ **", color=culoare)
        embed.add_field(name="kick", value="Foloseste .kick pentru a dat kick unui membru.", inline=True)
        embed.set_footer(text="La Plesneala")
        await ctx.reply(embed=embed)

how to make the embed color random thats what i did

shadow wraith
#

!e
test = {1: "one", 2: "two"}
print(len(test))

unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

2
ebon island
#

no not a dict

shadow wraith
ebon island
#

len on the list itself

shadow wraith
#

!e
test = [{1: "one", 2: "two"}]
print(len(test))

unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

1
wanton veldt
ebon island
#

since the list is the outer layer

#

it wouldn't be formatted that way

shadow wraith
ebon island
#

look at the api result, it'd be like this

wanton veldt
#

ok

ebon island
#

!e

test = [{"word":"fretful","score":398,"numSyllables":2},{"word":"regretful","score":302,"numSyllables":3},{"word":"threatful","score":129,"numSyllables":2},{"word":"netful","score":28,"numSyllables":2},{"word":"let phil","numSyllables":2},{"word":"met phil","numSyllables":2},{"word":"set fill","numSyllables":2}]

print(len(test))

unkempt canyonBOT
#

@ebon island :white_check_mark: Your eval job has completed with return code 0.

7
shadow wraith
#

i counted and that's.... 7 "word" "objects" in the dict

ebon island
#

yeah

shadow wraith
#

cool cool

ebon island
#

hence why len of the list == 7

#

it's not in the dict

#

I have to correct your phrasing

shadow wraith
#

i was thinking of the minimum but i could do 0 as the minimum x]

ebon island
#

there are 7 dicts in the list

#

yeah, returning [0] will always return a result if there was one

shadow wraith
#

0 and len(test) would make up for the random number word value generation? am i right?

maiden fable
#

@shadow wraith u can always do dict[(len(dict) -1)] haha

ebon island
#

why would it make up for a random number?

#

0 = 0 and len = 7 there won't be anything random

shadow wraith
#

random rhyme x] like [random.randint(0, len(test)]['word']

#

so this would get a random word property, right???

ebon island
#

why not just do choice from the list

#

can !e use packages?

shadow wraith
#

!e
test =[{"word":"fretful","score":398,"numSyllables":2},{"word":"regretful","score":302,"numSyllables":3},{"word":"threatful","score":129,"numSyllables":2},{"word":"netful","score":28,"numSyllables":2},{"word":"let phil","numSyllables":2},{"word":"met phil","numSyllables":2},{"word":"set fill","numSyllables":2}]

import random
e = random.choice(test['word'])
print(e)

unkempt canyonBOT
#

@shadow wraith :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 4, in <module>
003 | TypeError: list indices must be integers or slices, not str
shadow wraith
#

fuck im stupid

#

!e
test =[{"word":"fretful","score":398,"numSyllables":2},{"word":"regretful","score":302,"numSyllables":3},{"word":"threatful","score":129,"numSyllables":2},{"word":"netful","score":28,"numSyllables":2},{"word":"let phil","numSyllables":2},{"word":"met phil","numSyllables":2},{"word":"set fill","numSyllables":2}]

import random
e = random.choice(test)
print(e)

unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

{'word': 'netful', 'score': 28, 'numSyllables': 2}
ebon island
#

!e

import random

test = [{"word":"fretful","score":398,"numSyllables":2},{"word":"regretful","score":302,"numSyllables":3},{"word":"threatful","score":129,"numSyllables":2},{"word":"netful","score":28,"numSyllables":2},{"word":"let phil","numSyllables":2},{"word":"met phil","numSyllables":2},{"word":"set fill","numSyllables":2}]

output = random.choice(test)['word']

print(output)

unkempt canyonBOT
#

@ebon island :white_check_mark: Your eval job has completed with return code 0.

netful
shadow wraith
#

oh alright that makes sense

#

well, i can handle some stuff like receiving the json

#

and reading it ig

minor comet
#

how do i program my bot to say "hi"?

#

just for a start

grim dove
#

!e

test = [{1: "one", 2: "two",3:"three"}]
print(test)
unkempt canyonBOT
#

@grim dove :white_check_mark: Your eval job has completed with return code 0.

[{1: 'one', 2: 'two', 3: 'three'}]
ebon island
#

btw, just as a note

#

better to use .get('word') instead of ['word'], I just used it as an example so it was easier to follow

grim dove
#

!e doc set

unkempt canyonBOT
#

@grim dove :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     doc set
003 |         ^^^
004 | SyntaxError: invalid syntax
grim dove
#

!e doc sets

unkempt canyonBOT
#

@grim dove :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     doc sets
003 |         ^^^^
004 | SyntaxError: invalid syntax
ebon island
#

.get('word') won't throw an exception if the key is not present

boreal ravine
#

@grim dove #bot-commands bruh

grim dove
#

how to read document

#

oops sorry everyone

ebon island
#

you could even have your error handling via that property

#

you could do it either via exception handling or via the return being None

#

https://api.datamuse.com/words?rel_rhy=frdsfs

returns

result = []

therefore if we use the same selection

result[0]['word']

it would throw an exception

but you could handle that via

try:
  result[0]['word']
except IndexError:
  do_something()
else:
  do_something_else()

or alternatively

 if result[0].get('word):
   do_something_else()
 else:
   do_something()

as some examples of handling

#

the second case works because if there is nothing in the 'word' key in the 0th dict in the result it will return None therefore False on the if statement so it will hit the else

slate swan
#

Any help here?

potent spear
slate swan
#

od

#

So the 's' was missing

ebon island
#

The error is pretty descriptive, you tried accessing an attribute that doesn't exist, be careful to be exact when accessing attributes of packages

slate swan
#

Ok thanks for the help

ebon island
#

You should use f strings by the way

potent spear
#

there are other ~~problems ~~ imperfections in his code
like a hardcoded guild name etc

ebon island
#

yeah

slate swan
#

thats the neat part see my username first

ebon island
#

haha

#

😄

#

you should use f strings for your message on the first lines though

ebon island
#

as an example

#
await member.send(f'You are kicked from {ctx.guild} because {reason}')
boreal ravine
#

!f-strings

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

slate swan
#

Oh thta's why it wasnt working

ebon island
#

assuming you have ctx passed into your method which you should

ebon island
#

true, good point sniper makes

#

I always use the objects in my code haha but I have a special use case

#

with the correction it would be

await member.send(f'You are kicked from {ctx.guild.name} because {reason}')
potent spear
#

member gets converted automatically iirc
like str(member)
would become Baron X#8210

slate swan
#

OH

potent spear
#

show us the data.json

ebon island
#

maybe repr?

slate swan
ebon island
#

he was talking to someone else Zero

potent spear
ebon island
#

:p

slate swan
#

oh

#

Bruh nvm

slate swan
potent spear
#

if you put something in the data, does it still error?

ebon island
#

no don't do {no name no shame}

slate swan
#

then what to put?

ebon island
#

like I had

slate swan
#

oki

ebon island
#

because it will automatically fill it with your guild's name

slate swan
#

Ok i ci c

ebon island
#

and it will do the same if it happens on another server

honest vessel
#

{token}

ebon island
#

get out of the habit of hard coding names and things

heavy folio
#

dont mind the name tho thebigstare

ebon island
#

your code should aim to be reusable

potent spear
heavy folio
#

use it in a string

unkempt canyonBOT
#

discord/guild.py lines 335 to 336

def __str__(self) -> str:
    return self.name or ''```
ebon island
#

As I imagine you are not familiar with f strings, the {} actually opens a codeblock in your string

#

!e

test = 'this is a test string, 5+2 = {5+2}'

print(test)

unkempt canyonBOT
#

@ebon island :white_check_mark: Your eval job has completed with return code 0.

this is a test string, 5+2 = {5+2}
potent spear
ebon island
#

ah shit

#

I didn't make it an f string I am an idiot

#

!e

test = f'this is a test string, 5+2 = {5+2}'

print(test)

heavy folio
#

ye

unkempt canyonBOT
#

@ebon island :white_check_mark: Your eval job has completed with return code 0.

this is a test string, 5+2 = 7
ebon island
#

but I guess that is a good demonstration of the difference, fstrings can handle code right inside the string so you can call variables or do calculations right inside your string

#

whereas a normal string can only do text

minor comet
#

can someone help me code my discord bot to send text?

ebon island
#

there are lots of great YT tutorials to get started with YK, that'd be a better option than requiring someone to one on one with you for something basic like that

minor comet
#

ok ill try to search, but i havent found good videos for now

ebon island
#

it will give you a baseline of understanding so you can get the basics down and ask better questions in here

#

they are out there, just make sure to look for more recent videos since code and best practices change

#

any discord.py beginners tutorial will do though, sending a message is very simple

minor comet
potent spear
ebon island
#

yeah, that is true, and they are generally poorly explained but if he doesn't know how to send a message I'm assuming a basic tutorial will give him more than he currently has in his bot, and will help with installing python and discord.py 😛

minor comet
potent spear
#

I like example bots and quickstarters in the docs more, but yeah, you do you

small igloo
#

so i wanna make my bot send message when the sender is not in database, i try use if isinstance(error, TypeError) but not work, any idea how?

potent spear
ebon island
# minor comet i dont have anything in my bot lol

haha I know 🙂

Yeah, as Sniper said, there are any number of ways to find the basics you're after

reading documentation is the best option but is also the most difficult since as a total newbie it might be overwhelming, documentation can be intimidating and difficult to follow

Beyond that, tutorials either video or text are a good option, the important part is to play around with what they suggest and try to research how to improve it, eventually you will want to get your feet wet on the documentation but as I am assuming you are totally new to Python in general it is best to start small. Discord is a cool project but it's going to be messy if you don't know basic Python first, so that might be something to learn first to save yourself a good deal of frustration, walk before you run and all that 😛

minor comet
#

i am actually not totally new in python

potent spear
minor comet
#

but i only did competitive python and i wanted to do something differnet with python

potent spear
ebon island
#

I assumed you were totally new since you didn't know how to install the dpy package :p

ashen spindle
#

Hi

#

i have an issue with my ds bot

minor comet
small igloo
dreamy sluice
#

Can someone help me with adding emoji on my bot? (I wanted to figure out adding an emoji before I actually started work on a command)
My code:-

@bot.command()
async def timer(ctx):
  print("sending emoji")
  emoji = bot.get_emoji(925736476904407071)
  #timer = "<a:aclock:925736476904407071:>"
  if emoji is None:
    await ctx.send("Didn't get the emoji.")
  else:
    await ctx.send(emoji)
  print("sent emojis")

My Output:-

potent spear
minor comet
#

lmao

ashen spindle
#

help xd

dreamy sluice
potent spear
dreamy sluice
slate swan
ebon island
# ashen spindle

I don't even see your code but I am assuming you didn't convert the 10s to integers and tried adding them so you ended up concatenating strings instead of addition

ashen spindle
# slate swan Typehint the args to int
import discord
from discord import client
from discord.ext import commands

bot = commands.Bot(command_prefix='>')

@bot.event
async def on_ready():
    print("Encendido !")


#comandos

@bot.command(name="sumar")
async def sum(ctx,n1,n2):
    await ctx.send(n1 + n2)
#

there is

ebon island
#

confirmed

potent spear
ashen spindle
#

oh ok, i gonna to try it

potent spear
#

^^

ebon island
#

all messages that come from discord are strings by default

#

that is important to know and account for

slate swan
#

copy id?

dreamy sluice
minor comet
dreamy sluice
#

ye

potent spear
small igloo
slate swan
potent spear
#

his english is superior, let him be

ebon island
dreamy sluice
#

I didn't right click at the message.

slate swan
#

The emoji?

dreamy sluice
#

Yessir, the emoji.

slate swan
#

I never saw an option to copy the emoji Id

dreamy sluice
#

It shows for me.

slate swan
#

it doesnt

dreamy sluice
#

It does.

small igloo
# dreamy sluice I copied that mate

tips: if u use custom emoji just use <:emoji_name:emoji_id>

to get emoji id, right click at the emoji's image, inspecc, and copy numbers from link

slate swan
#

Send ss?

dreamy sluice
#

This one is for the emoji

slate swan
#

that's the message id as I said earlier

dreamy sluice
minor comet
honest vessel
#

u can get emoji id with put a backslash infront of it

slate swan
ebon island
#

well yes, you have to get the actual response out of it Mini

dreamy sluice
slate swan
dreamy sluice
#

The other one is the emoji id

ebon island
#

I was just making my example for once you had the response :p

honest vessel
slate swan
#

^^ that's how you get emoji id

small igloo
slate swan
honest vessel
#

put backslash n it shows that

ashen spindle
honest vessel
#

@small igloo

ashen spindle
honest vessel
#

same with nicks

slate swan
small igloo
honest vessel
#

lol

#

\

#

infront

small igloo
dreamy sluice
slate swan
slate swan
ebon island
slate swan
honest vessel
#

@slate swan yes n post it

dreamy sluice
small igloo
#

@honest vessel

ebon island
#

If ever you encounter an error like that, you're dealing with data you need to manipulate, so you received a response but it isn't in the form you want it so you have to manipulate it further to get the output you are looking for

slate swan
honest vessel
#

u can check roles id too if roles mentionalable etc

dreamy sluice
#

Damn, my memory is trash

slate swan
#

it's the message id you got by copy id

dreamy sluice
#

O-o

slate swan
#

And the emoji I'd is the one you got using \:emoji:

small igloo
dreamy sluice
slate swan
small igloo
honest vessel
#

cause u can have same names on multi emojis

slate swan
#

Always better to not hardcode thing

#

Use codeblock / ``

dreamy sluice
#

Lemme try and see whether this change works

#

@slate swan Ayo thanks, it works

slate swan
dreamy sluice
#

👍

honest vessel
#

do u run windows 98 too?

minor comet
#

?

honest vessel
#

🤪

#

@minor comet always btr to try keep updated

minor comet
#

idk how to make it updated

honest vessel
#

throu pip

minor comet
#

this is what i got when i downloaded python.py

shadow wraith
ebon island
#

YK enter the whole command

#

including the python.exe part

shadow wraith
#

wdym

minor comet
#

python.exe -m pip install --upgrade pip' command?

ebon island
#

yeah

#

paste your code if you wouldn't mind Mini

#

both for making the request and processing itr

minor comet
ebon island
#

everything involving AIOhttp

shadow wraith
#

ok

#
@bot.command()
@commands.guild_only()
@commands.cooldown(1, 3, BucketType.user)
async def rhymeapi(ctx, word):
    ctx: commands.Context
    word: str = "rhyme"
    async with aiohttp.ClientSession() as session:
        url = await session.get(f"https://api.datamuse.com/words?rel_rhy={word}")
        urlJSON = await url.json()

        rdn = random.choice(url).get("word")
        await ctx.reply(f"Word: {word}\nRhyming Word: {rdn}")
maiden fable
ebon island
#

one thing I see is that you're still trying to do choice from the url not the urlJSON

minor comet
shadow wraith
#

fuck that makes sense

maiden fable
minor comet
pastel cobalt
#

I am running my bot in replit and it shows this error while installing the package. How to fix this?

#

Someone help ,me

ebon island
#

seems working @shadow wraith

shadow wraith
ebon island
#

Awesome 🙂

shadow wraith
#

thx for helping

ebon island
#

No problem! Happy to help ❤️

shadow wraith
#

:]

pastel cobalt
minor comet
ebon island
#

File not found error

pastel cobalt
pastel cobalt
heavy folio
#

it's an ssl error

shadow wraith
#

:|

heavy folio
#

Getting [SSL: CERTIFICATE_VERIFY_FAILED] on Python 3 on OS X?
Navigate to your Applications/Python 3.X/ folder and double click the Install Certificates.command to fix this.
Happy coding!

shadow wraith
#

as someone who uses mac, i can confirm the only two ssl errors i got were network issue and certificate verify failed

ebon island
#

no I tested it using my bot lmao

#

that's the only way to make sure everything works with your logic and API call

minor comet
#

can i use idle for the discord bot?

heavy folio
#

ye

#

use the status kwarg in commands.Bot

minor comet
#

bruh this is so hard

ebon island
#

Why would you want to use IDLE for your bot?

minor comet
#

well idk what else to use

hollow plover
#

can someone tell me how to make and use dropdowns and example or tutorial pls? thnks

hollow plover
minor comet
#

dnd?

hollow plover
#

Do not Disturb

#

like the one im using now see

slate swan
#

the thing is how to add space here?

#
@client.command(aliases=['b'])
@commands.has_permissions(ban_members = True)
async def ban(ctx,member : discord.Member,*,reason= "No reason provided"):
  await member.send(f'You are banned from {ctx.guild.name}, because: {reason}')
  await ctx.send(member.name + "has been banned from the server")
  await member.ban(reason=reason)
manic wing
#

@slate swan

#

i’m really, really sorry to tell you this

#

but i have a json file in my dir with 1800 colors - its the Lancebot resources one….

shadow wraith
#

i have the discordheximals.py file in the github because apparently i can't import discordheximals x]

#

!pypi discordheximals

unkempt canyonBOT
wispy spade
slate swan
#

??

#

oh ok

#

Works LOl

fervent shard
slate swan
dire folio
#

How do I send a msg when a user boosts a server

slate swan
fervent shard
slate swan
slate swan
unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

slate swan
#

You'll often concatenate strings in dpy, so.

slate swan
# unkempt canyon

ik i am doing cuz the server i am testing is not the server i will be using it

leaden hollow
slate swan
unkempt canyonBOT
#
Out of the question.

No documentation found for the requested symbol.

slate swan
slate swan
leaden hollow
#

Ashley is 210391 years old

#

yes

#

tell me when you find the docs

#

activity name works,no idea how to make assets work

slate swan
maiden fable
unkempt canyonBOT
#

property activity: Optional[Union[discord.activity.Activity, discord.activity.Game, discord.activity.CustomActivity, discord.activity.Streaming, discord.activity.Spotify]]```
Returns the primary activity the user is currently doing. Could be `None` if no activity is being done.

Note

Due to a Discord API limitation, this may be `None` if the user is listening to a song on Spotify with a title longer than 128 characters. See [GH-1738](https://github.com/Rapptz/discord.py/issues/1738) for more information.

Note

A user may have multiple activities, these can be accessed under [`activities`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.activities "discord.Member.activities").
hollow plover
#

for discord.ui.button, how to know what the user has chosen? and then reply

maiden fable
unkempt canyonBOT
#
Not in a million years.

No documentation found for the requested symbol.

maiden fable
#

Thanks @unkempt canyon

#

Anyways its inter.author

hollow plover
#

interaction.author?

maiden fable
#

Yea

hollow plover
#

how to use this?

maiden fable
#

It is the same as context.author

#

It returns the user/member who clicked on the button

#

!d disnake.MessageInteraction.author

unkempt canyonBOT
maiden fable
#

Phew, there

hollow plover
#

alright but how do you know what the button content was?

#

thanks by the way :)

maiden fable
unkempt canyonBOT
maiden fable
#

(;

hollow plover
#

thanks!

#

ill ask if any further problem appears ;)

maiden fable
#

Sure!

#

Hey @ebon island did u fix your issue?

ebon island
#

Nope, unfortunately not yet

#

haven't received a response in Async just yet

#

working on other things in the meantime 🙂

maiden fable
#

Ah cool (and that's sad)

ebon island
#

Haha no worries, I've got plenty to still be working on

maiden fable
#

Ah cool

ebon island
#

and the error only occurs after many hours running

maiden fable
#

Oh, hmm

ebon island
#

do you know offhand what the command is to check whether a user has permissions for a given action within a method? Not as a decorator, I remember it was a method on the ctx

maiden fable
#

Can u run pip install -U discord.py once?

hollow plover
maiden fable
#

Okay I forgot

vale wing
#

I don't get what is the purpose of user_command in disnake

ebon island
#

thanks Hunter 🙂

maiden fable
#

Thanks @unkempt canyon

rich wedge
#

hey guys, will I get banned if I ask about a specific discord fork problem in here..?

hollow plover
#

no idts

maiden fable
hollow plover
#

if a user clicks on a button, how to tell the label of the button that they clicked on is there a special element for that thanks

rich wedge
#

okay cool B)

unkempt canyonBOT
#

discord.on_interaction(interaction)```
Called when an interaction happened.

This currently happens due to slash command invocations or components being used.

Warning

This is a low level function that is not generally meant to be used. If you are working with components, consider using the callbacks associated with the [`View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View") instead as it provides a nicer user experience.

New in version 2.0.
vale wing
#

So it adds the commands to the context menu right?

vale wing
#

Ok thx got it

hollow plover
#

ll have a look thx

maiden fable
rich wedge
#

so, Im using nextcord, and I skimmed the docs and it looks like pretty much everything is the same, and it loads all my cogs, but then it has an error on running talking about future.result..? heres my full error

  File "main.py", line 39, in <module>
    bot.run('token', bot=True, reconnect=True)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 666, in run
    return future.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 645, in runner
    await self.start(*args, **kwargs)
TypeError: start() got an unexpected keyword argument 'bot'```
blazing lynx
#

how to make a command like this in py?

wicked atlas
maiden fable
#

!d discord.ext.commands.Bot.wait_for @blazing lynx

unkempt canyonBOT
#

wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
rich wedge
maiden fable
#

!d discord.Client.run

unkempt canyonBOT
#

run(*args, **kwargs)```
A blocking call that abstracts away the event loop initialisation from you.

If you want more control over the event loop then this function should not be used. Use [`start()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.start "discord.Client.start") coroutine or [`connect()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.connect "discord.Client.connect") + [`login()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.login "discord.Client.login").

Roughly Equivalent to...
rich wedge
blazing lynx
maiden fable
#

Thought so

maiden fable
maiden fable
hollow plover
#

@maiden fable im sorry i still dont get it after all your help :(

im making a rock papaer scissors game and i need the content the user has clicked on idk what the on_interaction means and how to do this please can u explain in more detail im soory

ebon island
#

is ctx.author sufficient to be passed into the permissions_for() method? I am assuming no as it is the string representation but perhaps that is a dunder str or repr, or if not, how can I get the Member object from a ctx?

maiden fable
hollow plover
#

yes i have one

wicked atlas
maiden fable
#

Dude @unkempt canyon

hollow plover
ebon island
#

awesome 🙂

hollow plover
#

thatss all i have

maiden fable
hollow plover
#

oh yea

blazing lynx
#

how about a command like this? where you just say the name of the role and if it can be assigned to me it will.

lament mesa
hollow plover
#

done

maiden fable
shadow wraith
#

how can you make multiple categories in help cmd without cogs

hollow plover
#

then what do i do do i store a variable after each of the callbacks?

blazing lynx
hollow plover
#

ill try that ig

ebon island
#

What would the proper usage be assuming the following:

user = ctx.author
if user...: #some permission check
  do_something()

I saw there is permissions_for() permissions_in and has_permissions() which is the proper choice in such a circumstance?

#

and what is passed

lament mesa
#

ctx.channel.permissions_for()

ebon island
#

assuming in that context user is passed as args, but where does it get the permission it is checking for in that case?

cloud dawn
#

#bot-commands Type !user for example there you can display your own information. But you are not allowed to tag a user. Only staff is.

leaden hollow
#

how to use height and width command in Embed.set_image

ebon island
#

seems like the following is working as I had desired:

if ctx.author.guild_permissions.kick_members:
wanton veldt
#

is that a normal thing?

cloud dawn
honest vessel
cloud dawn
unkempt canyonBOT
#

property image: _EmbedMediaProxy```
Returns an `EmbedProxy` denoting the image contents.

Possible attributes you can access are...
honest vessel
#

@command.has_permissions()

wanton veldt
blazing lynx
#

how to make a eval command ?

cloud dawn
unkempt canyonBOT
#
Command: eval

Run Python code and get the results.

Source Code
vale wing
slate swan
#

its just an unban command it doesnt work
Any help?
Btw I am new to python

blazing lynx
#

error?

#

whats the error

vale wing
#

If you eval single line of code it will just return a result

cloud dawn
vale wing
#

@slate swan user.discriminator is int I am pretty sure and you are comparing it to str you got from splitting

glass belfry
#

How to change it to make each person has his individual balance, because when I do !balance I get how much I have and then my friend tries and he gets the same thing, btw I'm new to the discord library I just started today

vale wing
#

Also I've never seen such way of comparing values not sure about it

unkempt canyonBOT
#

When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.

Instead of writing

def update_score():
    global score, roll
    score = score + roll
update_score()

do this instead

def update_score(score, roll):
    return score + roll
score = update_score(score, roll)

For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.

pulsar shell
final iron
vale wing
#

!e ("str1", 2) == ("str1", 2)

unkempt canyonBOT
#

@vale wing :warning: Your eval job has completed with return code 0.

[No output]
final iron
#

The timestamp will automatically change

pulsar shell
vale wing
#

It won't be able to convert to User if that user doesn't have mutual guilds with bot I think

pulsar shell
#

It will.

ebon island
#

What's the pycharm shortcut to comment out lines?

lament mesa
#

ctrl + /

final iron
ebon island
#

Thank you 🙂

pulsar shell
#

Unless the converter doesn’t fetch, it should work with any user

vale wing
#

Alr lemme check that

cloud dawn
#

Pretty sure the converter does fetch.

vale wing
cloud dawn
vale wing
#

I am just interested myself is it possible to fetch a user who is not in mutual guilds because I had an issue with that in past

pulsar shell
#

It will work with the id but not the name. Hopefully the people using the bot are literate enough to copy an id

cloud dawn
vale wing
#

And in our case he tries to get a user with name+discrim

#

So your example with hint wouldn't work for his case

pulsar shell
vale wing
#

Yes

cloud dawn
#

Everything works so much easier if everyone would just use either mention or id lol

pulsar shell
vale wing
#

Maybe

blazing lynx
#

disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.

#
    @commands.command(aliases=['p'], brief='$play [url/words]')
    async def play(self, ctx, *, video: str):
        channel = ctx.author.voice.channel
        voice = get(self.bot.voice_clients, guild=ctx.guild)
        song = Music.search(ctx.author.mention, video)

        if voice and voice.is_connected():
            await voice.move_to(channel)
        else:
            voice = await channel.connect()     

        if not voice.is_playing():
            self.song_queue[ctx.guild] = [song]
            self.message[ctx.guild] = await ctx.send(embed=song['embed'])
            await ctx.message.delete()
            voice.play(FFmpegPCMAudio(song['source'], **Music.FFMPEG_OPTIONS), after=lambda e: self.play_next(ctx))
            voice.is_playing()
        else:
            self.song_queue[ctx.guild].append(song)
            await self.edit_message(ctx)
#

does anyone know?

pulsar shell
#

Do you have ffmpeg downloaded?

blazing lynx
blazing lynx
#

visual studio code if that what you meant

pulsar shell
blazing lynx
#

Linux

#

so how to fix the error?

pulsar shell
# blazing lynx Linux

If you’re using a Debian based distro you can run this command

$ sudo apt install ffmpeg
ebon island
#

How do I make an asynchronous block still only run synchronously locally?

Like, still hand the interpreter off to any other functions but for that execution of the function do one thing completely then the next thing etc at specific points?

pulsar shell
blazing lynx
#

nvm it wasnt the same thing

#

i ran "sudo pip3 install ffmpeg" and it installed ffmpeg

#

i ran that command you told me to now do i restart vsc?

#

also @pulsar shell how do i put vsc as my status

cloud dawn
pulsar shell
blazing lynx
pulsar shell
unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
cloud dawn
#

You know what it is fact you just help him just seem to me like you don't really care.

pulsar shell
#

Where do you see anything ytdl-related in this code? This guy could just be playing royalty free music directly from his machine

manic wing
cloud dawn
#

Magic, you are aware just don't do it.

blazing lynx
#

how to put vsc as my rich presence?

cloud dawn
pulsar shell
blazing lynx
#

it worked thanks

pulsar shell
#

Ah ok

blazing lynx
proven osprey
#

what's wrong here? I typing number, but nothing happens, and even there any errors

blazing lynx
#

i didnt know it was still breaking tos even if it was a private bot for only 1 server

blazing lynx
final iron
forest blade
proven osprey
#

oh, ok, what i should do if i want to accept only numbers from user?

harsh stump
#

How do I make a discord bot that after running !badass command, it sends a gif and a text?

patent lark
#

pass the gif link as a string

harsh stump
#

how do I set it up?

patent lark
#

or pass a string containing a normal text

cloud dawn
#

URL or file

proven osprey
#

how to accept only integer messages from user ?

patent lark
#

typehints

cloud dawn
patent lark
#

or define a condition for it

harsh stump
patent lark
cloud dawn
blazing lynx
#

how long does that take?

harsh stump
ebon island
#

I'm a little confused about why I'm not getting the prints as I expect them, trying to troubleshoot an issue where the script stops on the pass_the_mic method:

    async def take_turn(self, server):
        for num in range(server.word_count):
            await self.make_message(server, num)
        else:
            print('sleepy time')
            await self.pass_the_mic(server)
            print('sleepy time 2')
            server.task = asyncio.create_task(self.take_turn(server))

    async def pass_the_mic(self, server):
        channel_to_be_sent = server.approved_channel
        pass_time = server.pass_time/2
        message_to_be_sent = f':checkered_flag: **Get ready to pass the mic! ({server.word_count}:{server.turn_time})**'
        await self.message_sender(channel_to_be_sent, message_to_be_sent)
        await asyncio.sleep(pass_time)
        message_to_be_sent = f':microphone2: **Pass the Mic!**'
        await self.message_sender(channel_to_be_sent, message_to_be_sent)
        await asyncio.sleep(pass_time)
        print('yeah')

prints yeah, doesn't print either sleepy time despite the fact that they are surrounding the call for pass the mic

patent lark
#

perhaps you should read the docs before trying to make commands

blazing lynx
patent lark
harsh stump
patent lark
#

do you want it to program itself ?

pulsar shell
ebon island
#

yeah it is

#

it runs normally

#

and it hits the "yeah" as mentioned

#

the else after the for loop means it executes only once the for loop has been completed fully

shadow wraith
#

ik basic python but how would i check if all the letters or content in the msg content is capital or not

blazing lynx
#

hey i would like to know how to get the bot's Servercount onto a status?

ebon island
#

reaches that point then does nothing

harsh stump
#

why does this not work?

shadow wraith
#

wait can't just i use msg.content.upper()

patent lark
pulsar shell
#

Is it possible that it’s being called by another function and not the one that you mentioned? Also if your’re using create_task recursively I’d recommend just using a while loop

ebon island
#

but I am confused why above it goes into the pass the mic call but not either print sleepy time call when they go directly before and after it

shadow wraith
blazing lynx
#

so py len(str(bot.guilds))?

ebon island
#

while is blocking if I'm not mistaken?

blazing lynx
cloud dawn
unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

001 | True
002 | False
pulsar shell
shadow wraith
#

no cant i just do

patent lark
slate swan
shadow wraith
#

!e

deez = "lol"
print(deez.upper())
unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

LOL
shadow wraith
#

this would work too?

blazing lynx
cloud dawn
shadow wraith
#

oh yeah and how do you measure how much letters there are in a message

boreal ravine
#

len func

patent lark
#

you want to convert all the bot guilds to a string as your status ? that’s very off

shadow wraith
#

fuck your right

slate swan
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 3
002 |     print(len(str(list_x))
003 |          ^
004 | SyntaxError: '(' was never closed
harsh stump
boreal ravine
shadow wraith
#

!e

test = "amogus lol"
print(test.isupper())
unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

False
sage otter
cloud dawn
boreal ravine
#

@shadow wraith #bot-commands

blazing lynx
shadow wraith
pulsar shell
slate swan
harsh stump
#

Why does this not work? Please someone help me its a mee6 custom commands

slate swan
#

this is not the mee6 support server

cloud dawn
unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

001 | True
002 | 4
blazing lynx
pulsar shell
ebon island
#

Figured out the issue, in my haste I somehow duplicated the take_turn method, now it should be working

shadow wraith
#

this looking good in a on_message event?

if bool(message.content.isupper()) is True and len(message.content) > 9:
        await message.delete()
        await message.reply("Fix your caps lock key damn")
patent lark
manic wing
#

im always right

#

😳

patent lark
#

false

blazing lynx
#

ik this isnt python related but please tell me whats wrong @patent lark

slate swan
#

is that kali linux?

blazing lynx
#

no

#

deb

slate swan
#

debian

cloud dawn
#

UI is way to fancy for kali lol

patent lark
#

i would be unable to help you there.

#

i don’t use linux

blazing lynx
#

oh

#

@slate swan do you know?

slate swan
patent lark
#

i’ve used linux few times. not enough knowledge to give help.

blazing lynx
slate swan
#

ik its debian based , but which one...

cloud dawn
blazing lynx
slate swan
#

ok , just show me a ss of your ui

patent lark
patent lark
#

forget i said anything.

manic wing
#

maybe he has a large database of songs

cloud dawn
#

Yeah don't think so.

manic wing
cloud dawn
slate swan
#

he just follows tos

blazing lynx
#

im asking for help on downloading discord

boreal ravine
#

chill

slate swan
#

not related to your current problem tho

blazing lynx
patent lark
#

well this is for discord bots. if your issue doesn’t relate, please ask somewhere else

blazing lynx
#

the 🌟 App 🌟

final iron
shadow wraith
#

wrong reply oop

blazing lynx
shadow wraith
#

wait im not meant to say that oop

pliant gulch
#

Seems like you got a broken install, since your on debian based try sudo apt-get -f install For further questions refer to #unix

slate swan
#

yea and what andy said

pliant gulch
#

Don't use debian myself so /shrug

patent lark
pliant gulch
#

I usually do pacman -Syu if pacman dies

pulsar shell
#

based

blazing lynx
#

they didnt say anything about mp3 in the tos did they?

pliant gulch
#

Do you own the music?

final iron
pliant gulch
#

Like did you buy a license for the music

#

Because otherwise, even if it's from an mp3 it would break ToS

pulsar shell
#

Yes, he’s playing royalty free music from an mp3 and you can’t prove otherwise

cloud dawn
#

Just because we can't prove it doesn't make it appropriate.

#

And him saying he is using mp3's is just a lie since what local file uses URL's?

final iron
cloud dawn
#

Anyways i don't really want to discuss it further i just asked you 2 to follow the rules of this server. I don't get why you guys are fuzzing about it so much.

final iron
#

Also he has no safe guards in place stopping people from accessing files they're not supposed to

pulsar shell
#

It’s totally possible that he has a lookup system based on urls. We’re literally helping him download ffmpeg and you’re trying to say he’s breaking tos out of pure speculation

leaden hollow
#

so I want to import a list from another python file which is not in the same folder,can I import it?

patent lark
#

it’s clear that they are disobeying ToS, may this discussing be dropped and brought back to topic?

leaden hollow
#

yes

cloud dawn
#

Python general do be bit crowded rn tbh.

leaden hollow
#

it's related to my bot so I just asked it here

leaden hollow
velvet tinsel
#

If I had an error that is in my discord bot but doesn’t relate to discord bots then I’ll ask in #python-discussion

cloud dawn
vocal shoal
#

if a bot runs out of computer resource (ram, cpu, etc..) will it get killed immediately or wait for resources (so like go not responding)?

cloud dawn
vocal shoal
#

yes?

#

idk i dont play alot

cloud dawn
#

Okay well it won't crash.

vocal shoal
#

ok thank you

cloud dawn
pliant gulch
pulsar shell
#

based

pliant gulch
#

If the game cannot allocate anymore memory how is it even gonna run

cloud dawn
#

to some extent

#

It can compress some of the RAM but the game will run pretty poor.

final iron
#

You mean extent?

pliant gulch
#

🤔

cloud dawn
pulsar shell
#

Does the Python interpreter compress the ram?

cloud dawn
pulsar shell
#

ohhh ok

velvet tinsel
#

I found a way to exploit my mobile data

cloud dawn
#

Would be pretty annoying if your pc RAM hits 100% it will just insta crash.

velvet tinsel
#

My mobile data ran out a week ago, but I found a way to connect to data without having any data

cloud dawn
#

Let's not talk about exploiting here 👀

velvet tinsel
#

I connected to my WiFi and did not leave my phone, until it disconnected my WiFi. However, with no mobile data my phone shouldn’t load anything, but it functioned perfectly and loaded everything as normal

#

I don’t know why it does that

cloud dawn
#

Until the bill comes because you used overbudget lol

velvet tinsel
#

Maybe I guess

pulsar shell
#

hahahahahah

velvet tinsel
#

But it shouldn’t take away money

#

Because all of it is gone

#

But I still managed to use it somehow

#

Idk how jam_cavedude

slate swan
#

guys what does this line do

if not not not not not "hello world" != (guild = discord.utils.get(bot.guilds,name=__str__(str(discord.utils.get(bot.guilds, id=getattr(discord.utils.get(bot.guilds, name=discord.utils.get(bot.guilds, id=getattr(guild,"id")).name), "name").id).name))).channels):
tough lance
#

Fcks your brain

sage otter
#

^^

unkempt canyonBOT
velvet tinsel
tough lance
#

Yeah but seriously what's the point here

velvet tinsel
#

He’s in the wrong channel

slate swan
blazing lynx
#
        async def open_account(user, ctx):
         users = await get_bank_data()
         user = ctx.author
         if str(ctx.author.id) in users:
             return False
         with open("bank.json","r") as f:
             users = json.load(f)
    
        if str(ctx.author.id) in users:
            return False
        else:
         users[str(user.id)]["cookies"] = 0
        
        with open("bank.json", "w") as f:
            json.dump(users,f)
        return true

#

ExtensionFailed: Extension 'cogs.cookies' raised an error: NameError: name 'ctx' is not defined

slate swan
#

ctx is first argument

#
async def open_account(ctx, user):
tough lance
blazing lynx
#

oh yeah thanks

velvet tinsel
blazing lynx
#
        async def open_account(self, ctx, user):
```?
velvet tinsel
#

Without knowing what it does

slate swan
blazing lynx
velvet tinsel
#

Cool

tough lance
velvet tinsel
#

Json

blazing lynx
tough lance
#

Yes I suppose

velvet tinsel
#

It’s mainly Json

blazing lynx
#

still says ExtensionFailed: Extension 'cogs.cookies' raised an error: NameError: name 'ctx' is not defined

wary kernel
#

Hi I'm trying to let my bot respond to another bot (Avrae) but can't figure it out, since I'm fairly new to Python. Anyone got any tips?

rolled_20 = 'Natty 20!'
@client.event
async def on_message(message):
if message.author == client.user:
return
if 'Total: 20' in message.content:
await message.channel.send(rolled_20)

zinc trench
#

hi
i want to do such that by just typing 4+5 the bot gives answer
but idk how to do that
my current code=
`@Bot.command()
async def add(ctx, numb1:int, numb2:int):
await ctx.reply(numb1+numb2)

@Bot.command()
async def multiply(ctx, numb1:int, numb2:int):
await ctx.reply(numb1*numb2)

@Bot.command()
async def divide(ctx, numb1:int, numb2:int):
await ctx.reply(numb1/numb2)`

final iron
manic wing
zinc trench
manic wing
#

!pypi simpleeval || you can also use this to solve messages. you can do ```py
import simpleeval

@Bot.listen("on_messaga")
async def solve_equation(message: discord.Message):
try:
x = simple_eval(msg.content)
except:
x = False
if x:
await ctx.send(x)```

unkempt canyonBOT
manic wing
#

god i love mobile coding

shadow wraith
#

how do you get if a message is sent in a channel and the information of it because rn im trying to make it so it adds ⬆️ and ⬇️ to each message in the channel

#

why does the formatting fail

umbral dome
#

Need help with discord bot

shadow wraith
#

what do you need help with

umbral dome
#

File "C:\Users\vgrav\OneDrive\Skrivebord\New folder (6)\config.py",
line 81, in on_message
if len(code) < 16:
TypeError: object of type 're.Match' has no len()

shadow wraith
#

show the command which has that

tacit horizon
#

iscord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: argument of type 'int' is not iterable

shadow wraith
#

show code (not the variable, the actual code in ur file)

shadow wraith
umbral dome
#
while 1:
    try:
        @bot.event
        async def on_message(ctx):
            webhook_url = hookurl
            global ready
            if not ready:
                print(Fore.LIGHTCYAN_EX + 'word ' + str(
                    len(bot.guilds)) + ' Servers 🔫\n' + Fore.RESET)
                print(Fore.LIGHTBLUE_EX + time.strftime("%H:%M:%S ", time.localtime()) + Fore.RESET, end='')
                print("[+] Bot is ready")
                ready = True
            if codeRegex.search(ctx.content):
                print(Fore.LIGHTBLUE_EX + time.strftime("%H:%M:%S ", time.localtime()) + Fore.RESET, end='')
                code = codeRegex.search(ctx.content).group(int)

                start_time = time.time()
                if len(code) < 16:
tacit horizon
shadow wraith
#

that's what i assume, but with libraries you can probably go further

tacit horizon
#

wait what

shadow wraith
umbral dome
#

okay

slate swan
#

not at all go for it

shadow wraith
glacial kernel
#

Does anyone know how to make a simple ticket bot?

shadow wraith
outer violet
#

For the reactions when using ext-menus, how do I make it so whenever a user reacts to one, it removes their reaction instantly? I’ve tried clear_reactions_after but that removes the users reaction when they press on another reaction which I don’t want. Full file: https://mystb.in/LaunchHappenedHungarian.python

severe rampart
#

which discord libraries support buttons?

#

disnake doesn't seem to

shadow wraith
#

i didn't pip3 install it since it didn't work, i just have the 2.9k lines of code as a local file in my bot's dir

slate swan
severe rampart
shadow wraith
#

!d disnake.ui.button

unkempt canyonBOT
#

disnake.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.

The function being decorated should have three parameters, `self` representing the [`disnake.ui.View`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.View "disnake.ui.View"), the [`disnake.ui.Button`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Button "disnake.ui.Button") being pressed and the [`disnake.MessageInteraction`](https://docs.disnake.dev/en/latest/api.html#disnake.MessageInteraction "disnake.MessageInteraction") you receive.

Note

Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Button "disnake.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
severe rampart
#

cool

slate swan
severe rampart
#

thanks

slate swan
#

your very welcome

shadow wraith
#

hey why doesn't my formatting work

slate swan
#

show

shadow wraith
#

:[

#
@bot.command()
@commands.guild_only()
@commands.cooldown(1, 5, BucketType.default)
@commands.check(isdev)
async def pypi(ctx, project):
    embed = disnake.Embed(
        title=f"({project})[https://pypi.org/project/{project}]",
        description="",
        color=disnakeheximals.Color.banana_yellow(),
    )
    await ctx.reply(embed=embed)

code

severe rampart
#

isn't it the other way around

shadow wraith
severe rampart
#

but also with that you can just do url = can't you

slate swan
#

you cant do a hyperlink in a title

shadow wraith
#

:[ so does the pypi command here use an author as a looking-like "title"

severe rampart
#
embed = disnake.Embed(
  title = "bleh",
  url = "https://google.com/"
)
#

can't you do this tho-

shadow wraith
#

does that work, have you tried it?

severe rampart
#

!d disnake.Embed

unkempt canyonBOT
#

class disnake.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.Empty "disnake.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") for you.
slate swan
#

ig so

severe rampart
slate swan
#

but no it wont work

severe rampart
#

right there

#

you can try it

slate swan
#

hes trying a hyper link lmfao

severe rampart
#

ik

shadow wraith
#

ima try it

severe rampart
#

mk

#

gl

slate swan
#

@shadow wraith what is that

#

disnakeheximals?

severe rampart
#

hmmm

#

maybe it's a custom module

slate swan
#

no its my module

shadow wraith
slate swan
#

!pypi discordheximals

unkempt canyonBOT
shadow wraith
#

i kept what you told me to import discordheximals as something

severe rampart
#

hm...

slate swan
#

creative of you

severe rampart
#

i would've done

#

import discordheximals as dhx

#

lol

shadow wraith
#

that's for lazy coders smh

slate swan
#

whatever you like tbh

manic wing
#

okimii

slate swan
#

no

manic wing
#

where’s my pull hm?

slate swan
#

i barely wokeup

manic wing
#

what tz are you

slate swan
#

ill do a pr later smh

shadow wraith
slate swan
#

ill maybe do a pr about idk more commands or sm

#

i still have to push my other package to pypi

#

the heximal package for the basic hexcode without 0x prefix

shadow wraith
#

the url= doesn't work

slate swan
#

its supposed to be a bare url

#

@slate swan thanks for the pr

#

i have to learn how to make better displays in git

#

i have to make a description for pypi with a markdown file but pycharm doesnt support it si thats theirs no description so i might have to download vsc to do it

tough lance
#

What're you doing?

#

I mean on github

slate swan
#

How do I update pycord (fork of dpy) to 2.0 in replit? I asked the comm, but they didn’t help much

ionic wadi
#
async def on_message(message):
    botnummer = 1
    if message.channel == "923698425126592592":
        if message.content == botnummer:
            if message.author == bot.user:
                return
            else:
                nummer = botnummer + 1
                print(nummer)
                await message.add_reacion("✅")
                botnummer = botnummer + 1
        else:
            await message.channel.send(f"Verkeerd nummer door {message.author.mention}, jullie hebben het gehaald tot {botnummer}. En we zijn nu weer bij 1.")
            botnummer = 1
    else:
        return````

I am in the specific channel, and I dont get any prints. But neither get an reaction added, but I am trying the 1 of the designated botnummer
fluid spindle
#

Maybe because botnummer is an integer, but message.content returns a string

fluid spindle
velvet tinsel
#

Hello

fluid spindle
#

Hello

ionic wadi
# fluid spindle Try replacing botnummer with str(botnummer) in line 5...
  
@bot.event
async def on_message(message):
    botnummer = 1
    if message.channel == "923698425126592592":
        if message == str(botnummer):
            if message.author == bot.user:
                return
            else:
                nummer = botnummer + 1
                print(nummer)
                await message.add_reacion("✅")
                botnummer = botnummer + 1
        else:
            await message.channel.send(f"Verkeerd nummer door {message.author.mention}, jullie hebben het gehaald tot {botnummer}. En we zijn nu weer bij 1.")
            botnummer = 1
    else:
        return```
#

Still no output

manic wing
fluid spindle
ionic wadi
fluid spindle
#

message.content and str(botnummer) at the same time?