#discord-bots

1 messages Β· Page 1001 of 1

slate swan
#

@boreal ravine he likes mcdonalds

silver agate
#

btw do I need a web interface or something to make it public? Or can I just use it as the old commands? (like !test) or something.

slate swan
#

for slash commands?

#

you would just need to do /command_name

#

since its a slash command

silver agate
#

so like the old commands too?

slate swan
#

yes but without the prefix

silver agate
#

ye oikay

#

it works a bit different, like the clear command right?

slate swan
#

wdym?

silver agate
#

Like /clear

#

Or old version !clear

slate swan
#

yes that is correct

silver agate
#

Tried to import my old command and just change it πŸ˜„ but isnt working

slate swan
#

all commands would be slash commands so no custom prefix only /

silver agate
#

like:

#
@slash.slash(name="clear")
async def clear(ctx, amount=100):
    mention = ctx.author.mention
    await ctx.channel.purge(limit=amount)
    my_embed = discord.Embed(title=f'{amount} Messages Delete', description=f'\n\n **message have been successfully delete βœ…**' f'\n\n **πŸ–±οΈ By :** {mention}', colour = 0x87FF00)
    my_embed.set_thumbnail(
        url = ctx.author.avatar_url)
    my_embed.set_footer(text=f"\n\n{ctx.author.name}" , icon_url=ctx.author.avatar_url)
    await ctx.send(embed=my_embed)
    await member.send(embed=my_embed)

But it isnt working

slate swan
#

defined not working and slash commands dont quite have Context

silver agate
#

so ctx isnt working?

slate swan
#
  1. what library are you using?
#

cause it doesn't seem like any fork, are you using discord_slash?

slate swan
# silver agate so ctx isnt working?

no no it does its just being satisfied by context and im not quite sure if the class thats satisfying the argument has those methods and attrs

silver agate
slate swan
#

god

#

why so much third party dpy libs

#

just use main or a fork

silver agate
#

bro do I seem like a pro in it?

slate swan
#

well i cant really answer that question

silver agate
#

Im still trying to figure it out.
I just do whatever the tutorials say xd

slate swan
#

neither am i a pro

silver agate
#

Im a designer and try to get back into programming atm

slate swan
slate swan
silver agate
#

I know now.
But how else im supposed to learn it ?

slate swan
#

its very straight forward and quite nice

silver agate
#

I just want to know how commands like clear, ping, and everything else work

#

thats my problem.
With the old commands I know how to but not with slash

slate swan
#

well they should work the same really

silver agate
#

as u see, it doesnt

slate swan
#

any errors ?

silver agate
#

nope

slate swan
#

well i cant really help because i havent used that library πŸ˜…

silver agate
#

I dont even know how to change it

#

lol : , )

slate swan
#

im actually gonna try to make a library thats better than that lib so ill probably see their implementation next week or so, im not sure how i will because the lib is quite done wellπŸ˜…

silver agate
#

Not even this is working : , )

@slash.slash(name="ping")
async def ping(ctx):
    embed = discord.Embed(title=f"Pong **{round(bot.latency * 1000)}ms**")
    await ctx.send(embeds=[embed])```
#

xd im crying

slate swan
silver agate
#

-.-

#

already send it in

silver agate
slate swan
#

wow.. you've like 4 discord libs installed lmao

silver agate
#

how to uninstall

slate swan
silver agate
#

wha should I uninstall

slate swan
#

where lib name is the lib name that u want to uninstal

slate swan
#

uhm..

#

idk if this is the best way

#

but u can do it like..

silver agate
#

Did but still whats the prob that text commands are working but things like clear, ping latency doesnt?

slate swan
#
if 'https://' in message.content:
    ''' shit goes here '''
``` something like this
#

like.. ik this isn't the most effective way.. but yeh...

slate swan
#

:")

silver agate
unkempt canyonBOT
silver agate
#

lol

slate swan
#

oof

#

?

slate swan
#

all you need to do is change discord to disnake

#

or u can use py-cord too....... if u want... :'''/

#

no

#

u hate it? lmao

#

pycords impl is garbage

#

lmao, py-cord surely getting some hate lol

#

welp, alright that's ok

#

because its garbage

#

okay, not gonna argue :")

#

eito is a good guy :")

silver agate
#

did and first 3 errors came

#

greate πŸ˜‚

boreal ravine
slate swan
silver agate
#

SyncWarning: Failed to overwrite commands in <Guild id=12345> due to 403 Forbidden (error code: 50001): Missing Access
warnings.warn(

#
import disnake
from disnake.ext import commands

bot = commands.Bot(command_prefix=">", test_guilds=[12345])

@bot.slash_command()
async def ping(inter):
    await inter.response.send_message("Pong!")

did the install too πŸ™‚

slate swan
#

your bot was not invited with application commands scope for that command

silver agate
#

it did

#

wait lemme re invite again

#

: , )

slate swan
#

and its like 20 days old.

silver agate
slate swan
#

may i see the invite link you invited the bot with, with bot's id removed

slate swan
# boreal ravine impl of what?
  1. inconsistent annotations
  2. horrible file organization
  3. horrible class organization
  4. everything is just smashed together and nothing is really clean
  5. confusing even to find something its dirs are just weird
#

hm weird

silver agate
#

Still the Sync Warning

slate swan
silver agate
#

I did what @slate swan send

slate swan
#

not the one given in docs

silver agate
#

I dont want to mention my guild in that

slate swan
#

your server's id instead of 12345

silver agate
#

I want to make it public one day or for my friends dcs and there friends...

#

for globalchat etc.

slate swan
#

ah, remove the guild_ids frim there then

#

it will take around 1 hr for the command to get addrd ( this is a discord limitation, not related to discord.py/disnake)

silver agate
#

^^

#

crying more and more haha

slate swan
#

your python version?

silver agate
#

3.9

slate swan
#

weird an internal error

#

reinstall disnake

silver agate
#

or 3.8 wait πŸ˜„ but new enough for that

#

o.o

#

so pip uninstall disnake

#

and now ? install disnake again?

slate swan
#

yep

#

yes

#

oh, hi oki how you been πŸ‘‹

boreal ravine
silver agate
#

so

slate swan
#

πŸ˜”

#

implementations for most of the forks remains same for things other than slash commands

silver agate
#

bot is running now but haha the slash doesnt work anymore

slate swan
silver agate
#

before the test worked.

slate swan
silver agate
#

should I wait or just re invite or what?

silver agate
#

I mean it worked before with the test what I tried before, but I made the disnake with a new file

slate swan
silver agate
#

so just let it run

slate swan
silver agate
#

aight

slate swan
slate swan
silver agate
#

so Ill gonna fvck u up again later guys πŸ˜„

slate swan
west mango
#

Hey folks, I recently made the switch from discord.py to 2.0 via git. Ive confirmed that installation is correct by testing out some button references, but now all of my previously working on_message events are not being triggered. It looks like it may be intent related, but Im finding conflicting documentation. Am I correct in my understanding that 2.0 requires intents (specifically messages) to be explicitly set defined in the code?

slate swan
#

you should have message_intents yes and do you have listeners?

#

you need message_content intents to be turned on explicitly

#

!d discord.Intents.message_content

unkempt canyonBOT
#

Whether message content, attachments, embeds and components will be available in messages which do not meet the following criteria:

β€’ The message was sent by the client

β€’ The message was sent in direct messages

β€’ The message mentions the client

This applies to the following events...

west mango
#

thanks folks I'll take a look! and @slate swan listeners = cogs in this context right? If so, I do not.

slate swan
#

!d discord.ext.commands.Bot.listen

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").

Example...
boreal ravine
west mango
#

got it, so that would only be necessary if I wanted to reference events from a different class/event within the on_message event, right? Sorry python is not my main programming language.

#

also I appreciate the help on this probably more than you know lol. Im always down to read documentation but sometimes its difficult to find the right documentation to reference.

slate swan
west mango
#

ohhh got it

#

thanks for explaining! I'll read the linked docs and see if I can get this working

slate swan
#

i.e you can have 2 listeners in different places like one in cogs and the other one in your bot file where you bot class instance is defined

west mango
slate swan
west mango
#
bot = discord.Client(intents=intents) ``` did the trick
slate swan
#

ah nice

#

i keep forgetting those are kwargsπŸ˜…

west mango
#

ts is my main language I work in so I kind of always (often wrongly) assume anything can be passed that way in python lol

slate swan
#

ah lol

silver agate
#

soooo

#

why is this so weird

silver agate
west mango
paper sluice
slate swan
#

hey, is there any isinstance event error for a ValueError ?

#

so lets say I use

?help test

but the function is

async def(self, ctx, number: int):

and that throws a ValueError, is there a way I can send something like "Incorrect Usage"?

paper sluice
#
try:
    ...
except ValueError:
    await ctx.send('incorrect usage')
#

!d try

unkempt canyonBOT
#
try

8.4. The try statement

The try statement specifies exception handlers and/or cleanup code for a group of statements...

slate swan
paper sluice
#

replace the ValueError with Exception

slate swan
slate swan
#

do you know where I should put the try and except?

slate swan
#
    async def spoof(self, ctx, amount: int = None):

paper sluice
#

show the whole function

slate swan
#

the whole function is like 300 lines

#

lmao

paper sluice
#

then show the part where u used try and except

slate swan
#

oh I just put it at the start and at the end

paper sluice
#

just have an error handler for that function then

#
@spoof.error
async def handler(self, ctx, error):
    ...

u can check the instance of error and do what u want with it

silver agate
#

bro I have the module whats wrong

#

I did

#

...still

#

bro

#

I did kinda 1000 times

vale wing
#

You are not receiving any errors because of improper error handler I think

#

It should have

else:
    raise error  # or do something else with the error just to see it```
gaunt ice
silver agate
#

I got the problem

gaunt ice
#

fixed?

#

aight

silver agate
gaunt ice
silver agate
#

there it showes me the problem

gaunt ice
#

hm

silver agate
#

cant figure it out either?

vale wing
#

There can't be just a random decorator

silver agate
#

I just want to get the ping command working

#

when I try it on another way its not working either

vale wing
#

You need to write the command code for it to work lmao

#

Currently you only have a decorator and no actual function

silver agate
#

I did

vale wing
#

And yeah for god's sake use better lib for slash commands like dpy 2.0 or disnake

silver agate
#

I tried disnake

#

it wasnt working and when I asked for help no ones answered

vale wing
vale wing
silver agate
#

Nothing was working

vale wing
#

You were probably doing something wrong and there just were no people who are experienced enough to help you

#

Try it again

silver agate
#

The person who told me to install it didnt helped.

vale wing
#

Cause you are most likely using discord_slash or some other random 3rd party lib

vale wing
#

And yeah in pycharm you do have an integrated terminal so there won't be issues at all

silver agate
#

I know

vale wing
#

So did you install it

silver agate
#

im about to

#

so

#

this mtf problem again

vale wing
#

Authorise the bot with applications.commands scope

silver agate
#

-.-

#

the 5. time?

vale wing
#

And yeah wtf is 12345 id

silver agate
#

I dont fucking know?1

vale wing
#

Search for its occurences probably you have wrong test guilds or something

silver agate
vale wing
#

Imagine copypasting code

#

And not actually thinking what it does

#

Look at test_guilds

silver agate
vale wing
#

Tf

silver agate
#

πŸ™‚

vale wing
#

Could you send the whole code

silver agate
#

xD

#
import disnake
from disnake.ext import commands

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

@bot.slash_command()
async def ping(inter):
    await inter.response.send_message("Pong!")```
vale wing
#

Print disnake._version_

silver agate
#

?

#

where

#

imma go play valorant

#

to gay for me atm this shit

cold sonnet
scarlet sorrel
#

i have my bot hosted on AWS but after a white i get Connection reset by etc etc
how do i keep it active?

heavy folio
scarlet sorrel
#

pip install discord

#

in cmd

silver agate
scarlet sorrel
#

yea thats not cmd

scarlet sorrel
unkempt canyonBOT
#

Hey @frigid flame!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

clever hamlet
boreal ravine
clever hamlet
clever hamlet
#

and im just begginer about this thingy

boreal ravine
#

Any errors? And you just leaked your bots token..

clever hamlet
#

you need to put a prefix i think

boreal ravine
#

No.

clever hamlet
#

ohhhh

frigid flame
boreal ravine
# clever hamlet

you tried to index a list with a string, python doesn't allow that

frigid flame
#

[SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]

clever hamlet
boreal ravine
slate swan
#

owo

wanton cipher
#

Is it possible to have a slash command only visible to certain users? I have a set of user ids as a bot attribute and was wondering if you can only see the command if you are in said set... Any help is appreciated :) (Also, just incase I need to mention this, I am using disnake)

slate swan
#

Not that I know of, might be coming with the new permission system of slash commands.

#

.snip fortnite, fortnite being the name in the json file. how could I do this?

slate swan
boreal ravine
#

the left side

slate swan
#

then yes.

boreal ravine
#

load the JSON file, index the dictionary you get

slate swan
boreal ravine
west mango
#

has anyone seen any clever ways of keeping some text visible just above the message input field in a discord channel? Input formatting guidelines for example. Not a programming question, just more of a "have you seen anything" kind of question.

#

near here is where I mean

slate swan
boreal ravine
west mango
#

is there a better channel? Its bot UX design that I will be coding in python

slate swan
boreal ravine
slate swan
#

like it'll auto set the variable to that

boreal ravine
slate swan
#

And how can I search for that key?

#

the argument's key

boreal ravine
#

just index the dictionary.. searching will only make the command slower

west mango
boreal ravine
slate swan
boreal ravine
#

you have to load it first ```py
from json import load

data = load(open('file.json', 'r'))

formal basin
#

I’m trying to make reaction roles but I don’t understand what this error means

slate swan
paper sluice
boreal ravine
formal basin
#

Oh

#

So what could I do?

boreal ravine
#

it's empty

formal basin
#

Ik

#

That’s the error

paper sluice
#

by the looks of things, maybe replace {} with [] , then u can use it as a list and append to it

formal basin
#

It WORKS

#

THANKS

wanton cipher
slate swan
#

what does this mean?
<discord.ext.commands.context.Context object at 0x0000017EBA39DF30>

boreal ravine
#

it's where the command object is stored

slate swan
#
@client.command()
async def snip(ctx, snip):
    snippets = get_config("snippets")
    if snip in snippets:
        await ctx.send(snip)
    else:
        await ctx.send(f"No snippets found for ``{snip}``")

Ok, so instead of it returning the snip how would I make it return the value of it?

paper sluice
#

snip is the name of the command

#

change it

slate swan
boreal ravine
#

in the if statement

slate swan
#

ok great

#

is there anyway to make it insensitive to capitalization?

boreal ravine
#

yes

slate swan
#

how.?

boreal ravine
#

call the lower method in snip using dot notation and make all the keys inside of snippets lowercase

frigid flame
#

@client.command()
async def poll(ctx,*,message):
author = message.author
emb=discord.Embed(title=" POLL ", description= (author + ' asks if '+ f"{message}"))
msg = await ctx.channel.send(embed=emb)
await msg.add_reaction('πŸ‘')
await msg.add_reaction('πŸ‘Ž')

author name is not visible

slate swan
loud junco
#

how do u import a file in a folder

#

import file from folder.file?

paper sluice
#
from folder import file```
loud junco
#

okok

#

thanks

paper sluice
#

or u can also do this

from folder.file import some-object
slate swan
#

correct?

loud junco
#

!d try except

unkempt canyonBOT
#
try

8.4. The try statement

The try statement specifies exception handlers and/or cleanup code for a group of statements...

boreal ravine
loud junco
#
try: 
  #normal code
except KeyError:
  #outputs error
 ```is this how try except block works?
boreal ravine
#

yes

loud junco
#

thanks

loud junco
#
#try here
@bot.command(name='hunt')
@commands.cooldown(1, 60, commands.BucketType.user)
async def hunt(ctx):
  #or here
  stats = Stats(ctx)
  num1 = random.randint(0, 100)
  num2 = random.randint(0, 100)
#

down right?

slate swan
#

@boreal ravine if the key contains a number will it still work?

frigid flame
#

cant see the wuthor

loud junco
#
@client.command()
async def poll(ctx,*,message):
    author = message.author
    emb=discord.Embed(title=" POLL ", description=  f"{author,' asks if ', message}")
    msg = await ctx.channel.send(embed=emb)
    await msg.add_reaction('πŸ‘')
    await msg.add_reaction('πŸ‘Ž')
```do it like this
loud junco
paper sluice
#

ya but what error?

loud junco
frigid flame
paper sluice
#

inside then

loud junco
#

just for that particular error

#

ok

boreal ravine
loud junco
#
@bot.command(name='hunt')
@commands.cooldown(1, 60, commands.BucketType.user)
async def hunt(ctx):
  try:
    stats = Stats(ctx)
    num1 = random.randint(0, 100)
    num2 = random.randint(0, 100)
  except keyError:
    ctx.send('error')
```like this?
frigid flame
#

f"{ctx.author,' asks if ', message}''??

loud junco
#

just to make sure i dont wanna mess up this one

ashen perch
#

hey is there an easy way of getting a list of users who reacted with a specific reaction

loud junco
#

f"{ctx.author}, asks if , {message}''

paper sluice
frigid flame
loud junco
#

u wan the full code?

frigid flame
#

yea

boreal ravine
loud junco
#

i mean @paper sluice

frigid flame
#

oh

boreal ravine
unkempt canyonBOT
#

Hey @loud junco!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

paper sluice
loud junco
#

here u go

boreal ravine
loud junco
#

but not now

#

after i fix this stupid error handler then i will change to switch case

frigid flame
#

@client.command()
async def poll(ctx,*,message):
author = ctx.author
emb=discord.Embed(title=" POLL ", description= f"{author} asks if {message}")
msg = await ctx.channel.send(embed=emb)
await msg.add_reaction('πŸ‘')
await msg.add_reaction('πŸ‘Ž')

three messages

loud junco
#

msg = await ctx.channel.send(embed=emb)

#

and ctx.send will do

#

no need ctx.channel.send

boreal ravine
frigid flame
loud junco
#

just restart it a few times i guess

boreal ravine
#

reset your bots token, use the new one you generated

frigid flame
#

o

#

solved...

loud junco
#

noice

slate swan
#

bot is not responding when i use prefix ? but it is working when got mentioned
bot = commands.Bot(command_prefix=when_mentioned_or("?"), case_insensitive=True, intents=intents)

loud junco
#

how do i define keyerror =.= is it even possible

#

alright its KeyError not keyError

dense swallow
frigid flame
#

@client.event
async def on_ready():
await client.change_presence(game=discord.Game(name='test'))
print ('You have logged in as {0.user}'.format(client))

#

Ignoring exception in on_ready
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/Users/nagarajukanike/Documents/Python Codes/rps.py", line 17, in on_ready
await client.change_presence(game=discord.Game(name='test'))
TypeError: Client.change_presence() got an unexpected keyword argument 'game'

slate swan
#

@boreal ravine it's spamming no snippets found for

#

because it's not taking the whole title

#

just first word

vocal snow
unkempt canyonBOT
#

await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter...
vocal snow
#

it's the activity kwarg ^

slate swan
#

hey, how can I add a argument that doesn't only take the first word?

slate swan
#

I just added an all argument, *

boreal ravine
slate swan
#

fixed the problem haha

#
@client.command()
async def snip(ctx, *, snip):
    snippets = get_config("snippets")
    snip = snip.lower()
    if snip == snip.lower():
        await ctx.send(snippets[snip])
    else:
        await ctx.send(f"No snippets found for ``{snip}``")

seems to be working.

#

in the future, is there any way to add multiple values to one key? @boreal ravine

slate swan
#

it works as it should when I do the command

#

json file yes

#

if it gets the job done?

#

exactly!

#

thats what I want to happen

#

and replace it with what

#

if user does capitals it will not show up in the json

boreal ravine
#

@slate swan how do you make a snippet?

slate swan
#

snippet, just a short portion of a song

#

hm I see. I like keeping it more spread out if that makes sense

dapper jolt
#

And you can throw off or how to create where you can send me a link or application + I'm on the phone @slate swan

boreal ravine
#

Would raise an error if there was a KeyError

paper sluice
#

also dont name ur function and parameter the same, it creates alot of confusion

slate swan
#

yes u are right my bad

boreal ravine
#

send only takes one positional argument

slate swan
#

when I do a invalid name the except doesn't send.
Command raised an exception: TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given

paper sluice
slate swan
#

Wtf?
await ctx.send(f"No snippets found for {snip)")
^
SyntaxError: f-string: unmatched ')'

dapper jolt
#

Ohh thanks ☺️😊

slate swan
potent spear
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
paper sluice
slate swan
#

omg Im way to tired for this

little ivy
#

Why does my button say "interaction failed" when it worked before with the same script and the bot has not restarted

paper sluice
#

timed out?

slate swan
#

you can get only persistent views ( views with custom ids and None timeout) to work after a restart

dense swallow
#

does anyone know how to disable a select menu after its been timed out (pycord)

#
class HelpView(discord.ui.View):
    def __init__(self, mapping: dict, ctx: commands.Context):
        super().__init__(timeout=180)
        self.add_item(HelpDropdown(mapping, ctx))
``` this is how i timeout
little ivy
#

Ahh thanks

maiden fable
#

!d discord.ui.View.on_timeout

unkempt canyonBOT
#

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

A callback that is called when a view’s timeout elapses without being explicitly stopped.
slate swan
#

you would have to attach a message attribute to the view for editing the select menu

dense swallow
#

how do i disable the menu after its been timed out

#

oh wait

slate swan
#

working remains same

dense swallow
#

this is for buttons?

loud junco
#

how do i try except for this error

slate swan
#

People will answer when someone can, simply be patient :D

loud junco
#

lol

loud junco
placid skiff
slate swan
#

sorry

loud junco
#

thankss

#

but why except that as e

#

and print e

loud junco
#

i have one

slate swan
scarlet sorrel
#

i have this keep alive thing that i didnt write or anything, it works well for replit, but i need to use it for AWS, and i have no idea where the link i need to put into uptime robot would be for AWS. on replit it just comes up in the top right when you run it, but since AWS is just a console window idk how to get the link. this is what i mean by link: https://name.name.repl.co but what would it look like on AWS?

from flask import Flask
from threading import Thread

app = Flask('')

@app.route('/')
def home():
    return "Hello. I am alive!"

def run():
  app.run(host='0.0.0.0',port=8080)

def keep_alive():
    t = Thread(target=run)
    t.start()

also wouldn't mind if there was a more simple way of getting it to not sleep after 20 minutes but yea

slate swan
#

commands.MissingPermissions

#

Would be your exception

#

Considering you've imported from discord.ext import commands

dense swallow
#

!d discord.ext.commands.MissingRequiredArgument

unkempt canyonBOT
#

exception discord.ext.commands.MissingRequiredArgument(param)```
Exception raised when parsing a command and a parameter
that is required is not encountered.

This inherits from [`UserInputError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.UserInputError "discord.ext.commands.UserInputError")
dense swallow
#

this on on_command_error

#

yeah

dapper jolt
#

PPC I don't understand how to download how to log in and how to create πŸ˜”

oblique adder
#

Can I send content as txt file without saving the file ?

paper sluice
#

can i add view to a message later, like i send a normal message first then add a view to it

slate swan
#

Is there anyway for me to track who invited somebody?

dense swallow
frigid flame
#

await client.send_message(author, embed=embed)

AttributeError: 'Bot' object has no attribute 'send_message'

dense swallow
#

also u just need embed=embed, no need author

frigid flame
#

i need to dm the message

dense swallow
#

then it'll be user.send()

lyric apex
#

Then you have to define who is author

dense swallow
#

!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.
frigid flame
#

author = ctx.message.author

dense swallow
#

ctx.author is also enough..

lyric apex
#

What the problem coming?

slate swan
#

Is there anyway for me to track who invited somebody?

frigid flame
#

yea

delicate hornet
#

how do i encript?

lyric apex
#

They why are you sending message using send_message use ctx

#
await ctx.send(author, embed=embed)```
frigid flame
#

oh

#

k

lyric apex
#

What happened@frigid flame

frigid flame
#

got it

#

thx

lyric apex
slate swan
jade tartan
#
async def verify1(ctx):
    channel = client.get_channel(967788019526561822)
    e = discord.Embed()
    e.set_image(url="https://media.discordapp.net/attachments/762780334458011679/945068984380850286/verificationd.png?width=1440&height=281")
    await ctx.send_file(channel, "verificationd.png", content="...", filename="...")
    file = discord.File("verificationd.png", filename="...")
    await channel.send("content", file=file)``` is this right?
slate swan
#

Is there anyway for me to get a user ID from username and discriminator?

#

!d discord.utils.get

unkempt canyonBOT
#

discord.utils.get(iterable, /, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Changed in version 2.0: The `iterable` parameter is now positional-only.

Changed in version 2.0: The `iterable` parameter supports [asynchronous iterable](https://docs.python.org/3/glossary.html#term-asynchronous-iterable "(in Python v3.10)")s...
slate swan
#

use this, with bot.users as iterable and name and discriminator as attrs

dense swallow
#

btw still its not working

jade tartan
#
async def verify1(ctx):
    channel = client.get_channel(967788019526561822)
    e = discord.Embed()
    e.set_image(url="https://media.discordapp.net/attachments/762780334458011679/945068984380850286/verificationd.png?width=1440&height=281")
    await ctx.send_file(channel, "verificationd.png", content="...", filename="...")
    file = discord.("verificationd.png", filename="...")
    await channel.send("content", file=file)``` is this right?
slate swan
#

that should work after 30 seconds

lyric apex
jade tartan
#

No inside the embed

lyric apex
#

Then for what are you using await ctx.send_file @jade tartan

jade tartan
#

client.send_file?

lyric apex
#

No i am not saying that, i am saying you want file inside the embed using embed.set_image@jade tartan

#

Maybe this may not work

jade tartan
#

Yeah it didnt work

#
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 227, in verify1
    await client.send_file(channel, "verificationd.png", content="...", filename="...")
AttributeError: 'Bot' object has no attribute 'send_file'

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

Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\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: 'Bot' object has no attribute 'send_file'
lyric apex
#
@client.command()
async def verify1(ctx):
    channel = client.get_channel(967788019526561822)
    e = discord.Embed()
    e.set_image(url="your-link")
    await channel.send(embed=e)```
#

Try this

supple thorn
jade tartan
#

It worked now

#

But what if i wanted my embed with no color

lyric apex
jade tartan
#

i mean whats the hex code for dark theme if that make sense

paper sluice
lyric apex
#

0x36393F

#

Use this hex

#

dark_theme()

#

This is simplest way for getting it

jade tartan
#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 226, in verify1
    e.set_image(url="https://media.discordapp.net/attachments/762780334458011679/945068984380850286/verificationd.png?width=1440&height=281", color=0x36393F)
TypeError: Embed.set_image() got an unexpected keyword argument 'color'

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

Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\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: TypeError: Embed.set_image() got an unexpected keyword argument 'color'```
#
async def verify1(ctx):
    channel = client.get_channel(967788019526561822)
    e = discord.Embed()
    e.set_image(url="https://media.discordapp.net/attachments/762780334458011679/945068984380850286/verificationd.png?width=1440&height=281", color=0x36393F)
    await channel.send(embed=e)
lyric apex
#

Why are you using

#

Use That where you define that

e = discord.Embed(color=hex)```
clever field
#

I find how make this

slate swan
#

Inspecting the embed element will give you that color as background, more specifically the background-secondary variable. Which is --background-secondary: #2f3136;

lyric apex
#

I got it from docs sorry i was not knowing

zenith mural
#

even after running pip install -U nextcord im getting an error. please help me

#

still

zenith mural
#

this is after i import it

slate swan
#

bro

high sun
#

Does the error occur aswell when you try to run the code?

slate swan
zenith mural
slate swan
high sun
#

Wouldn't make a difference, does it?

zenith mural
high sun
#

Just try to run it

zenith mural
#

alr wait

slate swan
slate swan
zenith mural
high sun
#

No

#

It isn't used anywhere in your code

slate swan
#

basically u didnt use that

#

@zenith mural do u know python basics?

zenith mural
#

yes

slate swan
#

ok

slate swan
zenith mural
#

no

zenith mural
slate swan
#

cuz u are not using it

zenith mural
#

i am gonna use it

brisk dune
slate swan
zenith mural
#

thanks guys

brisk dune
#

well, not an error

#

it's a warning from VScode

high sun
#

^

slate swan
#

ye

zenith mural
#

alright

slate swan
#

whatever

zenith mural
#

ty

brisk dune
#

Code will run without it, it's just saying that it'd be better if you did what it's telling you

zenith mural
#

ah ok

#

new to vsc

slate swan
#

oh

zenith mural
#

yeah

slate swan
#

nice

zenith mural
#

yes

#

does that mean that anything with a yellow line under it isnt exactly an error?

slate swan
#

yellow line means it is not defined

zenith mural
#

alr

#

ty

brisk dune
#

Red = error (code will not run because major problem), yellow = warning (code will run fine, just it's dead-weight/could be better)

steady ember
#
@bot.command()
async def check(ctx, *, msg=None):
    if not msg:

        await ctx.send('Kindly enter msg!')
        return
    else:
        try:
          fetchedchannel = []
          all_data = list(channels.find())
          for i in all_data:
            fetchedchannel.append(i['ids'])
            embed=discord.Embed(color=discord.Color.red())
            embed.set_author(name=f"{msg}")
            coroutines = [channel.send(embed=embed) for channel in fetchedchannel]   
            await asyncio.gather(*coroutines)
        except Exception as e:
          print(e)```

```'Int64' object has no attribute 'send'```
#

How to fix it?

nimble plume
#

Show whats int64

steady ember
#

channel id stored are int64

#

coroutines = [channel.send(embed=embed) for channel in fetchedchannel]

brisk dune
#

Isn't there meant to be some get_channel stuff going on? (I haven't worked with this in a long time, sorry can't be specific)

#

You're getting the id, not the channel object

steady ember
#

yup there is but It will reduce my process of sending message!

brisk dune
#

!d discord.ext.commands.Bot.get_channel

unkempt canyonBOT
brisk dune
steady ember
#

get_channel

#

& then send message!

brisk dune
#

Sure

zenith mural
#

@brisk dune i completed some of the code and am trying to run it, but its saying "ModuleNotFoundError: No module named 'nextcord'"

zenith mural
#

i ran pip install -U nextcord and imported it

quaint epoch
zenith mural
#

yes

quaint epoch
#

what ide are you using?

zenith mural
#

im using vs code

quaint epoch
#

try to do py -m pip uninstall nextcord then py -m pip install nextcord

#

then restart your ide

zenith mural
#

restarting it now

#

yeh it worked ty @quaint epoch

quaint epoch
#

np

zenith mural
#

@quaint epoch need help again πŸ˜…

quaint epoch
#

show config(w/ a place holder for the token)

zenith mural
#

wdym

quaint epoch
#

config is a file no?

zenith mural
#

yes

quaint epoch
#

so show the contents of the file, and replace the token with "TOKEN"

zenith mural
#

wdym show the contents

quaint epoch
#

and then the dir tree

zenith mural
#

would this work

quaint epoch
#

sure

#

just make sure the names match

steady ember
#

Is there way to send message fast to every channel of server because for in loop takes a long time to send messages!

olive osprey
#

Most likely not possible faster due the discord ratelimiting

slate swan
#

^ yes

#

Is there anyway for me to get an ID from a username? (such as test#0001)

steady ember
#

yup

slate swan
steady ember
slate swan
#

the ratelimit is 5/5s its dynamic so it can change as well

steady ember
slate swan
#

oh wait nvm lmao

slate swan
steady ember
slate swan
#

^

steady ember
slate swan
#

it returns a user object

unkempt canyonBOT
slate swan
#

Ok

steady ember
#

@slate swan

#

async def sendallchannel(self, embed):
coroutines = [channel.send(embed=embed) for channel in fetchedchannel]
await asyncio.gather(*coroutines)

#

what the use of this then?

slate swan
#

seems like a list of coros which are quite useless

steady ember
#

So will need to use For in loop only?

slate swan
#

im saying its useless by you would probably get ratelimited

steady ember
#
for channel in fetchedchannel:
   channel = bot.get_channel(channel)
   await channel.send("Text")
olive osprey
slate swan
#

it would scream that NoneType class doesnt have such an attr lol

olive osprey
#

Wouldn't that just work

for channel in ctx.guild.channels:
    await channel.send("hi")
gaunt herald
#

hey i am making bot using code of sir lancebot. so where should i add my bots token?

slate swan
olive osprey
#

ye ofc, but there's no way to prevent that

slate swan
#

that is correct.

olive osprey
#

that's what they wanna do tho ig

gaunt herald
slate swan
#

its quite advance and just copying the repo and pasting your token isnt the best idea

olive osprey
olive osprey
#

much more fun

slate swan
#

@lament depot

#

.help

#

..

olive osprey
#

lmao

slate swan
#

Hello, good day.
How do I get the plain username without discriminator from an ID?

#

!d discord.ext.commands.Bot.fetch_user

unkempt canyonBOT
#

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

Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID.
You do not have to share any guilds with the user to get this information,
however many operations do require that you do...
slate swan
#

I would first try to get from cache before making an API call.

#

yeah

gaunt herald
#

i know we can add watch together in python. but how we add other like fishing.io games?

slate swan
#

Last time I heard from this it was against the ToS

gaunt herald
slate swan
#

As I said, last time I heard from these integrations there was an announcement in the official Games Lab server about being against ToS and bots being flagged by Discord. So I would beware when doing it and get informed to make sure it's no longer against ToS.

#

Just get the ID of the other game if you really want to do it.

dense swallow
#

they are not against TOS.. they won't verify public bots which have these

#

if it's a private bot it's fine

slate swan
slate swan
unkempt canyonBOT
slate swan
#
 embed = discord.Embed(
      title=name + " Server Information",
      description=description,
      color=0x00FFFF
    )

how to add hex in this code?

#

anyone?

slate swan
slate swan
#

@slate swan check now

#

correct?

#

color=00FFFF // color=0xHEX

#

Doesn't look like the same

#

means?

#

Hi

#

00FFFF = cyan hex

#

You skipped this

slate swan
#

ok

#

check now

#

Try it and see

#

thx working

slate swan
#

Without code - can't help

olive osprey
#

it's set_footer

slate swan
#

!d discord.Embed.set_footer # Might help though

olive osprey
#

!d discord.Embed.set_footer

unkempt canyonBOT
#

set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.

This function returns the class instance to allow for fluent-style chaining.
olive osprey
#

What

slate swan
#

what?

olive osprey
#

nothing lmao

slate swan
#

Yeah?

#

i want to change hex

#

You've never used add_footer here

slate swan
#

bot there is error

#

You have another issue

olive osprey
#

!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
#

Yeah - bot uses master docs aka for version 2.0

unkempt canyonBOT
slate swan
#

Would be that one for 1.x

slate swan
#

AttributeError: 'coroutine' object has no attribute 'name'

olive osprey
#

What was the answer?

slate swan
#

Again

olive osprey
#
x = await bot.fetch_user(id)
print(x.name)
slate swan
#

?

olive osprey
#

hi sparky

slate swan
#

yo

slate swan
olive osprey
#

hi okimii

slate swan
#

doing homework + sql + discord

slate swan
olive osprey
#

one liner awkwardflushed

zenith mural
#

o

slate swan
#

😩

slate swan
#
embed.add_field(name="Roles:", value=(ctx.message.guild.roles), inline=True)
#

is that correct?

slate swan
#

Thanks

olive osprey
slate swan
olive osprey
#

Len the roles

slate swan
#

what u want

olive osprey
#

role count ig

olive osprey
slate swan
olive osprey
# slate swan

Also, I suggest using .title() for the Region looks much better

slate swan
#

!roles

#

huh?

#

nt

#

@slate swan i ghost ping u by mistake

olive osprey
#

lol

slate swan
slate swan
# slate swan

@slate swan how to solve this roles menu and my code is correct or not?

olive osprey
#

what

slate swan
#

h?

#

wtf

olive osprey
#

Be more specific

olive osprey
#

Do you want the roles Show one by one, or every role counted up together?

slate swan
#

huh?

olive osprey
#

confusion

slate swan
slate swan
#

solve*

#

!e

list = [41242531525,12565,2425425,254,36,346,346]
a = [users for users in list]
print(a)
#

yaya les go

potent spear
# slate swan

this is a list of role objects... idk what you want from that

slate swan
slate swan
#

just testing my list compe skills

slate swan
#

lol

slate swan
#

a = [role.mention for role in ctx.guild.roles]

#

idk

boreal ravine
#

map(lambda r: r.mention, guild.roles) shipit

slate swan
#

😢

#

what is Role Count code anyone?

#

Role count code?

#

yes

slate swan
#

Simply get the length of the list of roles if you mean getting the number of roles in the guild.

#

!e

a = [1,2,24,4,35,35,235,236,236,2356,236,25,235,2367,346]
print(len(a))
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

15
slate swan
paper sluice
#

[*]

slate swan
#

EXENIFIX.lower() is typing....

paper sluice
vale wing
#

!e ```py
from random import randint
from time import time
class E:
def init(self, num):
self.num = num

arr = [E(randint(0, 500)) for _ in range(100)]

t = time()
a = [i.num for i in arr]
print(time() - t)
del a
t = time()
a = map(lambda i: i.num, arr)
print(time() - t)```

unkempt canyonBOT
#

str.capitalize()```
Return a copy of the string with its first character capitalized and the rest lowercased.

Changed in version 3.8: The first character is now put into titlecase rather than uppercase. This means that characters like digraphs will only have their first letter capitalized, instead of the full character.
slate swan
#
embed.add_field(name="Roles", value=len(ctx.guild.roles)

correct?@slate swan

#

L

boreal ravine
unkempt canyonBOT
#

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

001 | 1.1444091796875e-05
002 | 2.6226043701171875e-06
vale wing
#

Map is faster confirmed

slate swan
slate swan
slate swan
slate swan
#

You opened twice ( but closed only once )

#
embed.add_field(name="Roles", value=len(ctx.guild.roles))
#

like this?

#

Try it and see

#

ok

vale wing
#

You might need to cast it to str

slate swan
#

done working

paper sluice
slate swan
#

Bruh i need to find a new free hosting service😭😭😭

vale wing
#

Amazon

slate swan
#

lol

vale wing
#

Does digitalocean become angry if I create a new account with same card

slate swan
#

Just create one with a new card 🀷

slate swan
vale wing
slate swan
vale wing
slate swan
#

FortniteDude πŸ˜‚πŸ˜‚πŸ˜‚

slate swan
slate swan
vale wing
#

Amazon requires a card as well

slate swan
#

imagine finding a free hosting service & getting a "good" one

slate swan
cold sonnet
#

y'all gotta learn that nothing's free in life

slate swan
#

yeah imagine

slate swan
#

yes, air is also not free :'/

slate swan
vale wing
slate swan
cold sonnet
slate swan
#

LMFAOO

#

replit :>

slate swan
#

free forever

modest plover
#

But

slate swan
#

need*

#

meed

modest plover
#

It ratelimits easily

#

Shared IP and all that

slate swan
#

saad ong i wish doe

modest plover
#

Railway supports discord bots

vale wing
#

Amazon is the minimum

slate swan
#

imagine buying replit premium service

cold sonnet
#

electricity bills

slate swan
slate swan
# potent spear selfhost

still not free lmao, u want to me use my resources 24/7? instead i'll spend $10 a month for a good host lmfao

vale wing
#

Btw I am gonna build own server soon (if I figure out how to install ubuntu on it)

potent spear
slate swan
#

if that ppl can self host why will he say i need a hosting

slate swan
unkempt canyonBOT
#

@olive osprey Please don't try to ping @everyone or @here. Your message has been removed. If you believe this was a mistake, please let staff know!

modest plover
#

Just use railway πŸ§β€β™‚οΈ

cold sonnet
#

a eyes

slate swan
#

if u have cc ur free hosting gates are open

potent spear
olive osprey
#

Bruh

slate swan
slate swan
#

πŸ’€

#

imagine elec cut off

#

that's why i would rather prefer to spend $10 or some on a host

vale wing
#

Imagine

slate swan
#

btw idk why heroku doesnt work with me nomo πŸ’€ when i tried to connect it with my github it says "internal server error" something like that

potent spear
#

I'd only spend money on hosting if the service you're hosting is lucrative

vale wing
#

Because heroku broke

slate swan
slate swan
slate swan
slate swan
#

a few days ago

slate swan
#

some shit fucked up with github auth token... idk exactly

slate swan
# slate swan ye lol ig

I mean heroku is fine doe 🀷🏾atleast its free🌚🌚 i have like 30+ accs

slate swan
#

When my dynos ran out i use the other acc etcyessirfast

#

replying to that deleted msg
nah it didn't fuck me... my bot still working fine lmao

paper sluice
#

i lost too many braincells

potent spear
#

they're just sharing how bad hosts suck etc

slate swan
supple thorn
slate swan
#

I need to re host it but :3

slate swan
paper sluice
slate swan
#

async with braincells():
await createnew()

slate swan
slate swan
potent spear
slate swan
slate swan
slate swan
vale wing
#

!pypi amogus

unkempt canyonBOT
supple thorn
potent spear
slate swan
#

(no comments)

supple thorn
#

Not defined

paper sluice
#

eh what?

supple thorn
#

kek

vale wing
#

You actually need internet to connect to a host

#

So yeah internet + host

paper sluice
#

host bots on sockets

slate swan
slate swan
slate swan
slate swan
#

HOST BOTS ON BOT NET!! πŸ”₯