#discord-bots

1 messages · Page 1032 of 1

slate swan
#

moving forward, please put your snippets inside a code block

#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

slate swan
#

'''py
print("hello world")
'''

slate swan
slate swan
#

`

loud junco
#

i feel like making a minecraft python hehehe
but not discord bot more like a real game with wasd those
which course should i take

slate swan
#

doesnt work

slate swan
slate swan
#

this is off-topic

loud junco
#

ok thanksss

nimble plume
slate swan
#

@slate swan help 😔

@lightbulb.option(..., type=hikari.GuildTextChannel)

why doesnt the type show the autocomplete for channels

nimble plume
#

i ||dont|| know

#

do u play minecraft

#

i want to play

slate swan
#

!ot @nimble plume

unkempt canyonBOT
slate swan
#

if you're not here to help/ask for help, refrain from using the channel

nimble plume
#

!ot @slate swan

#

doesnt work for me

slate swan
loud junco
#

🤣 whats these 2 kids doing here

nimble plume
loud junco
#

no for sure

nimble plume
slate swan
unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

loud junco
nimble plume
#

ok

#

how can i connect my keyboard and mouse with discord bot so i can play minecraft from discord

#

like move forward button

stray carbon
nimble plume
#

yes bro

loud junco
#

this is like the day the world ends

nimble plume
#

ok

#

idc

#

ill just play minecraft

loud junco
#

walking front for 5 steps u need to do
w enter w enter w enter w enter w enter

loud junco
nimble plume
#

i want that

stray carbon
#

Meh i thought i came to wrong server

loud junco
#

bruh

slate swan
#

quit it you two

loud junco
loud junco
nimble plume
loud junco
nimble plume
#

ok help me

loud junco
#

?

nimble plume
loud junco
#

not talking to u

nimble plume
#

u pinged me

loud junco
loud junco
#

:/

nimble plume
#

ye same wrong reply

slate swan
#

can you both stop?

nimble plume
nimble plume
slate swan
loud junco
#

not u

#

me and newbie
im finding source on that

#

U CANT

nimble plume
slate swan
#

i mean he probably can..

loud junco
#

discord bot doesnt have crosshair tracker

#

:/

#

u cant move ur mouse to make the head move

nimble plume
slate swan
#

you can use pyautogui to send the input signals through buttons or something

nimble plume
#

pyautogui.press("w")

slate swan
#

sort of, you might want to adjust the timing to move, say, 1 block per stroke

loud junco
#

the bot's ram usage

#

📈

nimble plume
#

i have 64 gb ram

slate swan
#

i've seen people run NES emulators using discord buttons

nimble plume
#

no problem

nimble plume
#

whats nes

loud junco
nimble plume
#

no

slate swan
loud junco
nimble plume
loud junco
#

...

slate swan
#

i'm talking specifically about the NES

nimble plume
#

1 day rockets will be controled from discord buttons

loud junco
slate swan
nimble plume
#

dont give me badwishes

loud junco
#

just telling u

slate swan
nimble plume
#

why

loud junco
loud junco
slate swan
nimble plume
loud junco
#

its going to be lagging

loud junco
slate swan
loud junco
#

nobody tells u to use hydrogen+oxygen

slate swan
#

it's just gonna be laggy because of discord api limitations

loud junco
nimble plume
slate swan
#

you can only update an embed with an image so fast

slate swan
loud junco
#

LOL

slate swan
loud junco
#

ashley gonna gives up

slate swan
nimble plume
#

😳

slate swan
loud junco
#

:/

#

why always give up

#

dont give up

nimble plume
slate swan
#

@novel apex is always there, but i won't bother with it

slate swan
nimble plume
#

😦

loud junco
#

sad newbie noises

slate swan
nimble plume
#

im happy hahahahahaha 🤣

loud junco
#

:/ ok byebye

nimble plume
#

;?

slate swan
nimble plume
#

how can i get guild from guild name if bot is in the guild

slate swan
nimble plume
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

loud junco
#

after i make the minecraft python i will show u all :D(more like showing buggy project)

slate swan
loud junco
loud junco
slate swan
nimble plume
slate swan
#

!d filter

unkempt canyonBOT
#

filter(function, iterable)```
Construct an iterator from those elements of *iterable* for which *function* returns true. *iterable* may be either a sequence, a container which supports iteration, or an iterator. If *function* is `None`, the identity function is assumed, that is, all elements of *iterable* that are false are removed.

Note that `filter(function, iterable)` is equivalent to the generator expression `(item for item in iterable if function(item))` if function is not `None` and `(item for item in iterable if item)` if function is `None`.

See [`itertools.filterfalse()`](https://docs.python.org/3/library/itertools.html#itertools.filterfalse "itertools.filterfalse") for the complementary function that returns elements of *iterable* for which *function* returns false.
loud junco
#

byebye

nimble plume
loud junco
#

going to sleep

slate swan
slate swan
# slate swan yeah, sure

hm i see, imma try it again, it raises an error for some reason
Snowflake object has no attribute 'id'

slate swan
#

im sure you are using a for loop on a Mapping

#

nvm it worked for no reason now

slate swan
slate swan
#

😔

slate swan
# slate swan lmaoooo
member = ctx._options.get("member") or ctx.author if isinstance(ctx.author, hikari.Member) else _guild.get_member(ctx.author.id) or await mod.bot.rest.fetch_member(ctx.guild_id, ctx.author.id)

am I weird to do this or is it normal 😔

#

hikari syntax is hard

slate swan
slate swan
#

its confusing

#

i mean

paper sluice
#

does hikari not have commands?

slate swan
# slate swan its confusing

it just gets the member argument from a slash command and if the member argument is not given, it then defaults to the message author and if the message author is an instance of a User object, it gets the Member object and if the member is not found in the cache, it fetches the member from the api

slate swan
paper sluice
#

👍

slate swan
#

ctx.options.member or ctx.member

#

happy mothers daypithink

heady sluice
#

why do I have to download it

#

the fuq is that

#

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

no download but wait

heady sluice
#

async def status_task():
while True:
await client.change_presence(activity=discord.Game('WARTUNG'), status=discord.Status.online)

#

that's not gonna do it for ya

#

you could use @tasks.loop() to make a task and make it wait for like 30 seconds so @tasks.loop(seconds=30)

#

your code would look something like

@client.event
async def on_ready():
    print("Ich bin nun Online")

@tasks.loop()
async def status_task(seconds=30):
     await client.change_presence(activity=discord.Game('WARTUNG'), status=discord.Status.online)

status_task.start()
obtuse zinc
#

Why is this bot not running? Please help i sit here for hours finding ut

heady sluice
#

it could be a wrong token

#

that's it...

obtuse zinc
#

but its the right one

slate swan
#

how to create channel by interacting to button

#

how to make change language command?

formal basin
#

Anyone know why this doesn’t work

fading marlin
fading marlin
#

:p

slate swan
#

!d discord.ext.commands.Bot.wait_until_ready

unkempt canyonBOT
#

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

Waits until the client’s internal cache is all ready...
slate swan
#

that is so

#

its kinda crazy how fast my bot connects to the gateway compared to dpy

#

dpy takes like a solid second while mine just almost connects instantly

#

not on disconnect because i never close the ws and i leave the connection to get zombified😭

#

which version of python is good? i use 3.10.4

pliant gulch
slate swan
#

im not sure if they do something to wait for the cache to be ready and then connect

#

probably not idk

pliant gulch
#

If you compare start times you need to compare it to discord.py's on_connect

#

Since the underlying is READY, whereas on_ready isn't actually READY it's an asyncio.Event waiting for cache to be populated

slate swan
#

ik

#

how to create channel by interacting to button

fading marlin
#

is that a user bot...?

scarlet aurora
#

It's a discord bot?

fading marlin
unkempt canyonBOT
slate swan
#

Does anyone know how I could create an invite tracker bot?
I have no clue how I can keep track on invites.

paper sluice
#

!d discord.ClientUser

unkempt canyonBOT
paper sluice
#

u need to call discord.ClientUser

scarlet aurora
#

how

paper sluice
#

discord.ClientUser()

pliant gulch
#

No 😔

#

This won't work, plus bot's can't even have friends

#

This just isn't possible with the API

paper sluice
pliant gulch
scarlet aurora
#

oh ok

slate swan
#

how to add bank balance? I don't know mongoDB very well

#

pls^^

slate swan
slate swan
scarlet aurora
#

Can someone tell me why I'm receiving this error?

mortal thistle
#

Guys I need help

#

I'm making a Discord Bot which sends messages to multiple servers, in some of them there is slowmode enabled. At first the bot sent messages to all servers but second time there was slowmode enabled and it waited for slowmode to end. I wanna make it ignore the channel where slowmode timeout is going on and my bot shouldn't have to wait for it....any help would be appreciated

slate swan
#

Bot accounts don't have friends, so you can't access that data even if you access the property correctly and we don't help with self-bots here

slate swan
#

Then like I said, it's pointless to access that property

mortal thistle
#

What are you trying to do?

slate swan
#

Your friends? Yeah a bot account can't view your friends

#

on the docs say that it only works on non-bot accounts

mortal thistle
#

make a selfbot then

#

but it isn't allowed according to Discord ToS

#

That's what I said above

slate swan
vocal snow
slate swan
#

How can i let it check if the mentioned user is in the file and if yes it sends the reason?

#

try this

file_lines = file.readlines()
for line in files_lines:
  if line.find(member.mention):
    await ctx.send(line)
slate swan
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

quick gust
#

yeah, enable them in the dev portal too (as told in the embed)

#

oh and

#

remove client = discord.Client()

slate swan
quick gust
#

and rename all the clients to bots

slate swan
slate swan
quick gust
#

what?

#

going?

slate swan
#

bruh

#

how to specify the amount the user has\

#

I used client days ago and the bot was good too, but now I use the same code but I had to turn the client into a bot

#

...

#

because you used bot instead of client somewhere?

crimson compass
#

Καλησπέρα σας.

slate swan
#

!rule 4 please

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

slate swan
#

how to specify the amount the user has?

#

that can be the only reason.

fading marlin
slate swan
slate swan
# slate swan Didnt work

i think have figured the issue

with open("[FILE NAME]", "r") as file:
    file_lines = file.readlines()
    for line in file_lines:
        if member.mention in line:
            print(line)
fading marlin
slate swan
slate swan
fading marlin
# slate swan db

not really sure what you mean by 'how to specify the amount the user has'... Access your database, add/get the amount of money the user has and send it??

slate swan
# slate swan np : )

One more question;
If the user has more warns it sends them in two separate messages
How could i make it so its in just one message but in separate lines?

fading marlin
#

instead of sending the warns from your for loop, add them to (maybe) a list, and then send the whole list (1 message)

slate swan
fading marlin
#

you can join the whole list with str.join() 🤷

stiff gorge
#

how to make a live timer in embed ?

fading marlin
#

could you elaborate?

slate swan
#

or maybe create the list with all the warnings and then get only the warnings and put in front of the message

slate swan
#

!d discord.utils.format_dt

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
slate swan
fading marlin
stable leaf
#

how can u make a channel with permissions for specific roles?

slate swan
#

on the guild use the create_role

#

there you can give the permissions and the specific role

slate swan
slate swan
stable leaf
#

not like that, i mean create a channel whith setup permissions like view_channel and so

slate swan
#

try using then the set_permissions

stable leaf
#

ok

slate swan
unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., default_auto_archive_duration=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission
to create the channel...
slate swan
#

the overwrites key-word-argument

stable leaf
#

thx

slate swan
#

Hi, I bought a bot and i can't start it, I get this error:

python3 main.py
/Moderation/main.py:12: MessageContentPrefixWarning: Message Content intent is not enabled and a prefix is configured. This may cause limited functionality for prefix commands. If you want prefix commands, pass an intents object with message_content set to True. If you don't need any prefix functionality, consider using InteractionBot instead. Alternatively, set prefix to disnake.ext.commands.when_mentioned to silence this warning.
  bot = commands.Bot(case_insensitive=True, command_prefix='!', intents=intents)
quick gust
#

the error is what it says

austere musk
#

Hi

maiden fable
#

Hi

slate swan
#

heya guys is it possible to have a discord bot inside a class?

slate swan
#

alr, any examples?

#

well i don't have any examples to show but i know it is possible to make it

mortal thistle
#

I wanna make
my bot sends a message in slowmode enabled channel in a loop
but the next time it's sending the message it should tell me that there is slowmode of x minutes is enabled
any help would be appreciated

slate swan
#

everything in python is a class/object

#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result
anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with
this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality
to manage commands...
slate swan
#

see a class

#

yes you can subclass it as well

craggy cloak
#

How can I fix when someone uses a button the bot sends the command again?
tried this lol?
Ping me if you can help me pls
await interaction.response.send_message(f"{async def mine}")

slate swan
#

mine()

craggy cloak
slate swan
#

how can i delete something in a txt file with aiofiles?

slate swan
#

how to make like ctx.send("") pick random number

#

like pick random number of 1990 to 2010

craggy cloak
# slate swan What do u want

So when you click the button below a message the bot sends that embed message from another command like when you have an embed for a fish command and you press Fish again the embeds sends again in the chat

slate swan
unkempt canyonBOT
#

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

2002
slate swan
#

when someone join in server
bot ping him and

#

bot pick random number of 1990 to 2010

#

hello

#

can anyone send to me a tutorial how to add 2 languages (for example: Polish and English) to python. You know... The command determines which language

fading marlin
#

!d discord.Interaction

unkempt canyonBOT
#

class discord.Interaction```
Represents a Discord interaction.

An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.

New in version 2.0.
fading marlin
#

discord.Interaction.locale (if you're using app commands) ^

grand raven
#

someone have fivem status bot to give me?

fading marlin
#

application command localisation

slate swan
fading marlin
#

they literally gave you the answer...?

slate swan
slate swan
#

How can I fix this error?

grand raven
#

oh

#

thank you any way

slate swan
#

ok 👍

slate swan
#

and it should upgrade it

#

or pip install discord.py==2.0.0

pliant gulch
#

You have to install it from the github repo

#

It's not on pypi yet

slate swan
#

ok

#

and you need to have git installed

#

yeah

#

i got that

slate swan
slate swan
#

alright

#

thats on dc.py documentation

#

ok

#

thanks ❤️

slate swan
slate swan
#

what would a basic discord.py "/ping" command look like?

nimble plume
#

Hi

slate swan
slate swan
#

ok

modern fiber
#

how do I make bot add a suggestion to every message in a certain channel?

#

like check and NORP_No

slate swan
#

!d discord.Message.add_reaction

unkempt canyonBOT
#

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

Adds a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji")...
buoyant zodiac
#

How do i load cogs in 2.0

maiden fable
nimble plume
#

same as 1.0

fading marlin
modern fiber
solemn marlin
#

hello

midnight gorge
#

but yeah still works

buoyant zodiac
nimble plume
#

ok

midnight gorge
#

setup_hook

river rain
#

hi, when I get:

<p>The owner of this website (discord.com) has banned you temporarily from accessing this website.</p>

on the bot-startup (something to do with cloudfare), how long is the ban for?

nimble plume
#

No

fading marlin
midnight gorge
modern fiber
#

👍 👎 🚩

nimble plume
buoyant zodiac
slate swan
slate swan
modern fiber
#

how exactly?

#

like another await message.add_reaction or

midnight gorge
#

yes

fading marlin
modern fiber
#

thanks

slate swan
modern fiber
#

thanks man

#

*girl

slate swan
#

lmao

slate swan
fading marlin
#

?

midnight gorge
fading marlin
#

how so?

slate swan
midnight gorge
# fading marlin how so?
from discord.ext import commands, tasks

class spooky(commands.Bot):
    def init(self):
        super().init(command_prefix='$')
        self.initial_extensions = [
            'cogs.moderation',
            'cogs.utility',
            'cogs.fun',
        ]

    async def setup_hook(self):
        self.background_task.start()
        self.session = aiohttp.ClientSession()
        for ext in self.initial_extensions:
            await self.load_extension(ext)

    async def close(self):
        await super().close()
        await self.session.close()

bot = spooky()
bot.run('token')
#

like that

fading marlin
slate swan
torn sail
#

Oh I thought u had to subclsss

#

Interesting

slate swan
#

preferred

midnight gorge
#

yeah rhat

fading marlin
midnight gorge
#

Subclassing

midnight gorge
fading marlin
midnight gorge
#

Thanks tho

fading marlin
#

np

slate swan
fading marlin
#

await bot.change_presence(...) smh 😔

slate swan
fading marlin
#

dis better super().__init__(..., activity=...)

#

hybrid commands

hybrid fjord
#

how would i make a list of specific options using slash as shown here:

sacred plume
#

Hi ! I have a bot made on another account, is there any way i can set myself as the owner in the code and use @is_owner commands ?

fading marlin
#

!d discord.ext.commands.hybrid_command

unkempt canyonBOT
#

@discord.ext.commands.hybrid_command(name=..., **attrs)```
A decorator that transforms a function into a [`HybridCommand`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.HybridCommand "discord.ext.commands.HybridCommand").

A hybrid command is one that functions both as a regular [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
and one that is also a [`app_commands.Command`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.Command "discord.app_commands.Command")...
fading marlin
fading marlin
hybrid fjord
sacred plume
fading marlin
#

oh, yeah, maybe I used the wrong deco, not sure what lib you're using 🤷

fading marlin
hybrid fjord
#

none yet

#

any library you know would be sufficient

#

i think there's one in discord_components, let me check

fading marlin
#

doesn't get any simpler than this

@commands.hybrid_command()
async def ping(self, ctx):
    await ctx.send("pong")
fading marlin
hybrid fjord
#

2.0?

fading marlin
#

yep

hybrid fjord
#

im keeping away from that, i have rewrite all my code if i wanted to do that

fading marlin
#

😬 _ _

hybrid fjord
#

my whole code revolves around libraries which aren't supported

rapid knoll
#

how do you make bots edit their own posts?

fading marlin
#
msg: discord.Message = await ctx.send(...)
await msg.edit(...) # this only takes key-word arguments
rapid knoll
#

I got this on hand

if message.content == "Test!":
        ctx = await message.reply("Processing!")
        await ctx.edit("Test Successful!")

but it gives out an error for to many arguments

shrewd apex
#

then await msg.edit

#

yes

rapid knoll
shrewd apex
#

np

slate swan
#

thoughts on slash commands?

gentle crescent
#

Basic one

#

If you want it to edit

shrewd apex
#

don't use bot.remove command help
instead edit it using commands.HelpCommand

shrewd apex
gentle crescent
#

@client.command()
async def test(ctx, pass_context=True)
message = await ctx.send("Processing")
asyncio.sleep(5)
await message.edit(content="Test successful")

#

client is defined as

client = commands.Bot(command_prefix = "!")
shrewd apex
#

bot.remove help command is not a legit way of doing that it's shown wrong in yt tutorials

shrewd apex
#

it puts the whole bot to sleep that means bot won't work for 5 secs in all servers

#

instead use

await asyncio.sleep(5)
rapid knoll
#

do I have to import something to edit posts

gentle crescent
#

cant edit for some reason

#

but here

@client.command()
async def test(ctx, pass_context=True)
  message = await ctx.send("Processing")
  asyncio.sleep(5)
  await message.edit(content="Test successful")
shrewd apex
#
@client.command(brief="Ping", help="The time it takes for a small data set to be transmitted from your device to a server on the Internet and back to your device again.")
async def ping(ctx):
    await ctx.send(f'`Pong! {round(client.latency*1000)}ms`')
shrewd apex
#

all async stuff need to be awaited

gentle crescent
#

yep sorry, missed it

shrewd apex
#

no slash only takes slash no custom prefix

stone beacon
#

I'm assuming that's totally not related to the outdated d.py yt tutorials from 2018

#

There is no decorator named hybrid command

slate swan
#

how can i fix that

stone beacon
#

Uh

#

I wouldn't know

stone beacon
# slate swan how can i fix that

1 - I'd suggest you avoid those third party libs for forms and just use discord Modals which are much much easier to use
2 - you have ctx.send(form) ur sending the object to discord

slate swan
#

ctx.send(form) sends the the question, and once theres an answer, the next question until it's done

slate swan
#

i'm using logging, and why does it log like websock connecting and etc when i run the file

#

can anyone help with setting command languages?

lime trench
#

using psql, how could i check if a key is in the db or not. My idea is on startup, it checks if every guild has its data in the db, it chekcs if the guild id is in the db, if not, it will insert the data. How could i make the bot chwck if the guild id is in the db or not?

vale wing
vale wing
slate swan
#

how can i do a form like that without using that lib

vale wing
#

And yeah you can make guild id UNIQUE and do something like

INSERT INTO guilds (...) VALUES (...) ON CONFLICT DO NOTHING```
slate swan
#

how i can use the timestamp?

vale wing
#

!d datetime.datetime.timestamp if this is what you mean

unkempt canyonBOT
#

datetime.timestamp()```
Return POSIX timestamp corresponding to the [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instance. The return value is a [`float`](https://docs.python.org/3/library/functions.html#float "float") similar to that returned by [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time").

Naive [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances are assumed to represent local time and this method relies on the platform C `mktime()` function to perform the conversion. Since [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") supports wider range of values than `mktime()` on many platforms, this method may raise [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") for times far in the past or far in the future.

For aware [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances, the return value is computed as:

```py
(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()
```   New in version 3.3.

Changed in version 3.6: The [`timestamp()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp "datetime.datetime.timestamp") method uses the [`fold`](https://docs.python.org/3/library/datetime.html#datetime.datetime.fold "datetime.datetime.fold") attribute to disambiguate the times during a repeated interval.
slate swan
#

How can I put this into a discord bot?

#

so that it sends in chat

#

like so that it asks for rating, name and vouch in chat

#

and sends it to the webhook

#

or just to a channel

modern fiber
#

Hey guys, so I have this little problem that it's adding both Verified and Unverified role in my server, so can I make a command something like "if member.has role1 remove role2" if you get me?

slate swan
#

send the code to add the role

modern fiber
slate swan
#

ok...

#

then idk

slate swan
modern fiber
#

how do I make sticky messages with bot in a certain channel?

slate swan
#

How can i make it send it into a channel named "logs" and if theres no channel named like that create one?

vocal plover
#

<@&831776746206265384>

slate swan
#

another one for the filters

vocal plover
#

if only there was a maintained API of scam domains

maiden fable
#

Lol

modern fiber
#

and define logging channel

slate swan
#

How do I delete the command if I enter the command and then an embed comes?

slate swan
#

Not directly an API

slate swan
#

Pretty slow sometimes

vocal plover
#

Oh?

slate swan
#

Yeah - not always though

#

But sometimes it takes like 3-5 seconds to get a result

vocal plover
#

hm

slate swan
#

It's pretty random

vocal plover
#

3-5s is still better than a minute waiting for mods tbh

#

Though it really shouldnt be taking that long

slate swan
#

Yeah true true

zealous jay
#

How much time does my application has to respond?

vocal plover
#

for an interaction, 3 seconds

zealous jay
#

oh

#

that kinda sucks

slate swan
#

You can defer if you need longer

zealous jay
#

how can I do that?

slate swan
#

!d discord.ext.commands.Context.defer

unkempt canyonBOT
#

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

Defers the interaction based contexts.

This is typically used when the interaction is acknowledged
and a secondary action will be done later.

If this isn’t an interaction based context then it does nothing.
slate swan
#

You use that method on a context object, then you get 15 minutes to reply I believe

zealous jay
#

thanks!

sacred plume
#

Hi ! I want to make my bot unban deleted users (what's the point in having them banned). Is there any on_user_delete event ?

zealous jay
#

Like if they delete their account?

sacred plume
#

yea

#

my banlist is filled with these guys

zealous jay
#

hmm

#

maybe you could make your bot check for deleted users every once in a while and unban them

slate swan
#

How can I remove the #xxxx in a username when sending a message?
so like print(f"Message: {message} by {}".format(ctx.message.author))

stable leaf
slate swan
#

ok

stable leaf
#

i am not sure

slate swan
#

leme check

stable leaf
#

nice

slate swan
paper sluice
slate swan
#

dont question my brain

paper sluice
slate swan
#

🤣

slate swan
zealous jay
#

@slate swan sorry for bothering you but after the calling defer(), how do I delete the "thinking" message

stable leaf
slate swan
#

Then put your message in there, for example your success message

zealous jay
#

Instead of sending another message I can just edit the "thinking" one?

slate swan
#

Yeah bascially

zealous jay
#

Thanks, it worked

slate swan
zealous jay
#

And slash commands look beautiful ngl

slate swan
#

Indeed

#

We don't help for bots the breaches the terms of service of YouTube

#

!rule 5

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

rare saddle
#

I just don't know what exactly I can break

slate swan
#

Music bots are not allowed

#

As per YouTube's terms of services

#

!ytdl

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)
rare saddle
slate swan
#
@client.command()
async def vouch(ctx, *, rating, vouch):
    embed = discord.Embed(
        title = "New vouch",
        description = f"{rating}/10 - {vouch}",
        color = 0,
        timestamp = ctx.message.created_at
    )
    embed.set_footer(text='Vouch by {}'.format(ctx.message.author.name))
    channel = client.get_channel(972852585314787388)
    await channel.send(embed=embed)
    await ctx.send(embed = discord.Embed(title="Vouch sent!", description="Your vouch has been sent successfully!"), delete_after=60.0)

How can I get the rating to get detected as a number from 1 to 10?

slate swan
slate swan
#

The developers of these bots are most likely well aware that their bot is against YouTube's Terms of Services.

slate swan
#

ok

#

let me give it a shot

#

My bot kicks the user if hes under 10 days old but doesnt send the message?

#

i also tried await chat.send

minor totem
stable leaf
#

but you can still vote above 10

vale wing
minor totem
#

Yup lol, that's what I am being suspicious of

slate swan
vale wing
#

99% sure you do

slate swan
#

100%*

minor totem
slate swan
vale wing
slate swan
#

You're most likely using the event incorrectly if it's a well known library

vale wing
#

!d discord.on_member_join

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

You've used pip to be able to use discord, hence it's the library you're using

#

What's interesting though is that

My bot kicks the user if hes under 10 days old but doesnt send the message?

vale wing
#

Yes

slate swan
#

I don't believe your bot even kicks the user

vale wing
#

Very interesting

stable leaf
#

you didnt specified the var channel

#

above

#

so it doesnt know where to send the message

slate swan
#

You can't just add any parameter in an event

#

Events have specific parameters which must not be changed.

stable leaf
#

what is the chat, created, now and delta

spring flax
#
    async def on_channel_message(self, message):
      async with self.bot.db.execute("SELECT ...") as cursor:
        result = await cursor.fetchone()
        if not result:
          return
        else:
          await message.delete()

This is for like an autodelete for a guild channel, if there is a record in the database table with a channel from the guild, it deletes the message otherwise it returns. What is the best approach to this? I know this isn't currently efficient

slate swan
#

An on_member_join event only uses member so you can't add message and use that one. You need to use what you've already defined, chat

vale wing
stable leaf
#

write under delta channel = bot.get_channel("Your channel id")

slate swan
#

IDs are not strings

slate swan
#

And it got already defined with chat = ...

#

So not needed at all

vale wing
stable leaf
#

so change it to message.chat.send

slate swan
#

Again

#

You can't add message in the parameters list.

#

It must be removed and only use chat.send.

stable leaf
#

he has it

slate swan
#

Again.

spring flax
vale wing
#

Right above

slate swan
#

Events have pre-defined parameters which must not be changed

spring flax
#

Ah okay thanks

slate swan
#

So you will only have member as function parameter as this is the only one it takes, and message will be gone, hence you can't use it at all.

minor totem
slate swan
#

how would I go about making the command output go to a channel first & add ✅ and ❎ reactions to the message, and if anyone checks the ✅ it get's sent to another channel otherwise it get's deleted if ❎ is reacted

pliant gulch
#

Inb4 bot.dispatch("join", message, member)

slate swan
pliant gulch
#

wait?

midnight gorge
#

from discord.ext import commands
ImportError: cannot import name commands from discord.ext (unknown location)

pliant gulch
#

Wouldn't it be wait_for

midnight gorge
#

what the problem here

#

?

slate swan
#

By using the second part of my message

#

ok

#

ima give that a shot

#

!d discord.ext.commands.Bot.wait_for

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...
slate swan
#

There is an example there I believe

minor totem
#

Oh yeah! That reminds me, what do you guys think of using async iterators for wait_for()?

async for message in bot.wait_for('message'):
    ...
#

For more advanced checks you could put them in the body of the loop

slate swan
#

I believe wait_for only waits for the first dispatched event now - maybe if that's changed it would make sense

#

Just don't really see a use case right now where you would need to wait for multiple dispatched events within a timespan.

minor totem
#

Yeah, well it's the same as ```python
while True:
message = await bot.wait_for('message')

#

I have definitely seen code where you use a loop like this

slate swan
#

How to load a cog only for one server? Like;
-antibots on

Loads cog only for this server
-antibots off
Unloads cog from this server

slate swan
pliant gulch
slate swan
#

await reaction.add("👍", "👎")

#

ok

vale wing
slate swan
#

No, twice the code (line)

#

Not twice the emoji

vale wing
#

Just make this

async def add_reactions(self: discord.Message, *reactions: str | discord.Emoji):
    for r in reactions:
        await self.add_reaction(r)

discord.Message.add_reactions = add_reactions  # idk if you can extend a module like this, never tried```
minor totem
vale wing
#

I suspect it's not installed at all

pliant gulch
minor totem
pliant gulch
#
async for event in Bot.messages.filter(...):
    ...
``` 😳
vocal plover
pliant gulch
#

Yea stream makes total sense here

#

Like HTTP streams kinda

vale wing
slate swan
#

    @commands.command(name="rate")
    async def rate(self,ctx,member: discord.Member=None, rating=None):
        if member == None:     
            member = ctx.author
        membermention = member.mention
        with open('starcount.json', 'r') as starcount:
            starcount = json.load(starcount)
        if str(member.id) not in starcount:
            starcount[int(member.id)] = rating
            await ctx.send(f"(DEBUG) {membermention} added to starcount database, stars set to {rating}")
        oldstarcount = starcount[str(member.id)]
        newstarcount = oldstarcount + rating
        print(newstarcount)
        starcount[int(member.id)] = newstarcount
        with open("starcount.json", "w") as f:
            json.dump(starcount, f)
        await ctx.send(f'OLD: {oldstarcount} NEW: {newstarcount} ADDITION: {rating}')

how do i make this so it adds 5 to the number instead of adding 5 to the end
e.g rn if its set to 0 and rating = 5, it'll show as 05
and so on and so forth, adding the number to the end rather than the total

minor totem
vale wing
slate swan
#

what does that mean

vale wing
#

!e

num1 = 0
num2 = 5
print(str(num1) + str(num2))```
unkempt canyonBOT
#

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

05
slate swan
#

So many things wrong but why?

midnight gorge
slate swan
tidal hawk
slate swan
vale wing
slate swan
#

so if i start at 0 then do;
-rate @slate swan 5, it goes to 5
then if i do:
-rate @slate swan 2, it goes to 7

cloud dawn
vale wing
#

And yeah that's not how you disable commands

vale wing
minor totem
cloud dawn
#

You can also say cheese-sticks and it will turn on.

vale wing
#

Unless he doesn't parse anything

tidal hawk
pliant gulch
vale wing
#

If he doesn't parse anything it won't work at all tho

#

Cause both are ifs

#

Why not make it like enable/disable or setstate or smth why the heck that construction

cloud dawn
# slate swan So many things wrong but why?
from typing import Union

@bot.command(name="antialts")
async def anti_alts(ctx, arg: Union[str, None] = None):
    if not arg and arg in ["on", "off"]:
        return await ctx.send("Pass either on/off")

     if arg == "on":
         bot.load_extension("antialts")
     else:
         bot.unload_extension("antialts")
vale wing
#

You can typehint with bool

cloud dawn
vale wing
#

Well yeah

#

Idk are enums supported in this case

cloud dawn
#

Not likely.

vale wing
#

You need 3.10 or do this

from typing import Union

arg: Union[type1, type2]```
#

And don't copypaste code for god's sake

#

You would need to track their status

#

With the @tasks.loop and a database

cloud dawn
#

For the bot just have a datetime obj when the bot launces.

#

!d datetime.datetime.now

unkempt canyonBOT
#

classmethod datetime.now(tz=None)```
Return the current local date and time.

If optional argument *tz* is `None` or not specified, this is like [`today()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.today "datetime.datetime.today"), but, if possible, supplies more precision than can be gotten from going through a [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time") timestamp (for example, this may be possible on platforms supplying the C `gettimeofday()` function).

If *tz* is not `None`, it must be an instance of a [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass, and the current date and time are converted to *tz*’s time zone.

This function is preferred over [`today()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.today "datetime.datetime.today") and [`utcnow()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow "datetime.datetime.utcnow").
vale wing
#

I have once wrote that kind of bot but it was based on pickle files so yeah it's gone now

#

It's relatively easy to implement tho

cloud dawn
#

You don't need a database, but you do need to track their online status. I don't really recommend doing this since it's unreliable.

vale wing
#

How would you store those minutes without a database

#

Yes

hybrid fjord
#

how do i timeout?

cloud dawn
vale wing
#

Good point

#

But you need a database still

#

To store the times of last registration

cloud dawn
#

So unreliable result.

#

So someone will get stored once the bot is certain it's right else the bots function is kind of useless.

vale wing
#

Well with the minute-by-minute tracker it is more reliable but more expensive as well and totally unsuitable for large amount of guilds

cloud dawn
#

Well why do you need an on minute tracker if you can just calculate it when someone requests it?

#

Less heavy and avoiding a lot of unnecessary loops.

#

If someone were to request it you can just get the current time and the subtract the stored time from it making it even second accurate.

mighty plinth
#

How can I use hikari's webhooks?

sand sun
#

How does the bot verification process work? What happens if you get rejected? Can you apply again? All the info and threads I see online have very different answers. Some say if you get denied its permanent, some say you can reapply a few weeks later, and some even say if you get flagged for inorganic growth you get raised to 250 server limit. I am having trouble finding the most up to date FACTS.

slate swan
#

how can i do if the embed has more than 5 fields it makes a pagination?

#

so i have a list i loop through till it reaches it end and every loop i add a field

#
async def on_message(message):
    if message.content == "testcmd":
        if message.author.id == 966318461582213121:
         channel = bot.get_channel(chn)
         await message.channel.send(msg)
         print(f"{Fore.LIGHTBLUE_EX} {msg} | {channel.name} | {message.guild.name}") 
    else:
        print("your not alx you cant do this")``` so i wanna send message to channel ids in txt like so: ```chn = open("channels.txt").read().strip()``` and it wont send message
#

this is basic command but im super tired and lazy

vital whale
#

does anyone know if discord has a streaming time limit? I have a bot streaming 24/7 and wondering if that will get flagged or hit a cap

slate swan
#

I'm getting 'ERROR:discord_webhook.webhook:[1/1] Webhook status code 400: {"embeds": ["0"]}' even tho the discord embed is valid

#

no limit

vital whale
slate swan
vital whale
#

it's a private bot on my personal discord

#

definitely breaking some other rules though

slate swan
# slate swan send ur code

from discord_webhook import DiscordEmbed, DiscordWebhook

webhook = DiscordWebhook(url="MY HOOK")
embed = DiscordEmbed(title="Error", description="'CONNECTION ABORTED', connection error (squish)",color='ff8a00')
webhook.add_embed(embed)
webhook.execute()

#

and i get

#

[1/1] Webhook status code 400: {"embeds": ["0"]}
and i don't see the webhook

#

ok

#

do you know why?

#

are you trying to run that as a discord bot command?

#

or just in python

#

    @commands.command(name="rate")
    async def rate(self,ctx,member: discord.Member=None, rating=None):
        if member == None:
            member = ctx.author
        if not isinstance(rating, int):
            await ctx.send(f'Needs to be a number.')
            return

why is this sending Needs to be a number. when I type 5?

slate swan
slate swan
#
from discord_webhook import DiscordEmbed, DiscordWebhook

webhook = Webhook.from_url('ur url here', adapter=RequestsWebhookAdapter())
embed = discord.Embed(title="whatever", description="whatever")
webhook.send(embed=embed)

try using this then

#

im trying to send a embed to a webhook

#
input_date = [int(item) for item in input_date.split('-')]```
Error:
```ValueError: invalid literal for int() with base 10: '08 22:02:33.839007'```
slate swan
#

how can I get a command to be activated/triggered by a webhook?

keen mural
#

how could i add muted role to the loser? (look near member.add_roles section)

#

:/

slate swan
#

    @commands.command(name="rate")
    async def rate(self,ctx,member: discord.Member=None, rating=None):#: Optional[int] = None):
        if member == None:
            member = ctx.author
        #if not isinstance(rating, int):
        #    await ctx.send(f'Needs to be a number.')
        #    return
        if rating == '1':
            ratingfinal = '1'
        elif rating == '2':
            ratingfinal = '2'
        elif rating == '3':
            ratingfinal = '3'
        elif rating == '4':
            ratingfinal = '4'
        elif rating == '5':
            ratingfinal = '5'
        else:
            ctx.send("Please choose a number 1-5")
        print(ratingfinal)
    print(ratingfinal)
UnboundLocalError: local variable 'ratingfinal' referenced before assignment
#

how?

stone beacon
stone beacon
#

And you did not define ratingfinal in your else block

#

So python didn't like that

slate swan
#

oh yeah

stone beacon
#

np

keen mural
#

how could i add muted role to the loser? (look near member.add_roles section)

#

errors like this

rustic onyx
#

guys do discord bots receive discord webhooks? Meaning can the bot read the content of the message sent by a webhook? thanks in advance

slate swan
#

How would I fix this error

pliant gulch
pliant gulch
#

!d discord.Message.webhook_id specifically to check if the message was sent by a webhook, if it's None then it's a regular user

unkempt canyonBOT
pliant gulch
#

Then just get the content via Message.content

rustic onyx
rustic onyx
#

thanks

slate swan
#

it worked before lol

rustic onyx
#

well then if it worked why its not working now

#

lol

slate swan
#

because thats a slash command

#

and its only working on regular

rustic onyx
#

thats not the issue there

#

the traceback is another

unkempt canyonBOT
#

property name```
Equivalent to [`User.name`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.name "discord.User.name")
slate swan
#

lol

rustic onyx
slate swan
#

what?

slate swan
slate swan
#

!e print(None.strip())

unkempt canyonBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | AttributeError: 'NoneType' object has no attribute 'strip'
slate swan
#

since the NoneType class doesnt have that attr it would raise an attribute error

#

0k

#

remember None is an instance of the NoneType class hence why the NoneType object doesnt have such an attr!

slate swan
sick birch
unkempt canyonBOT
zealous jay
#

Could someone help me with loading cogs using discord.py 2.0?

terse coyote
#

how to make it so that when a command is used it is written to json (discord.py)? pls help me...

zealous jay
#

what do you mean by "spam a discord bot"

feral timber
#

Per our #rules , we don't help with projects that could be considered malicious - that includes spam bots

zealous jay
#

oh

rustic onyx
#
    await self.start(*args, **kwargs)
TypeError: Client.start() got an unexpected keyword argument 'bot'

uhhh, im not in a cog using self and I never wrote the word client in the code

#

🤔

zealous jay
#

Per our rules , we don't help with projects that could be considered malicious - that includes spam bots

#

We cant help you here

#

And also you shouldn't do those kind of things

stone beacon
#

Raiding will cause the python snake to bite you

zealous jay
#

can you send the full code?

rustic onyx
#
import discord
from discord.ext import commands
import json

intents = discord.Intents.default()
intents.members = True

bot = discord.Bot()

@bot.event
async def on_message(message):
    if message.author != bot.user:
        if message.channel.id == 972996659749466143: #APEUSDT-30m

            data = json.loads(message.content)

            suggestion_channel = bot.get_channel(972525892079349830)
            await suggestion_channel.send(f'#{data["symbol"]} (ByBit)\n#{data["side"]}\nPrecio: {data["order_price"]}\nTake Profits: {data["tps"]}\nStop Loss: {data["sl"]}\nRiskReward: {data["rr"]}')

        if message.channel.id == 972996698173505587: #LUNAUSDT-1h

            data = json.loads(message.content)

            suggestion_channel = bot.get_channel(972908552920379422)
            await suggestion_channel.send(f'#{data["symbol"]} (ByBit)\n#{data["side"]}\nPrecio: {data["order_price"]}\nTake Profits: {data["tps"]}\nStop Loss: {data["sl"]}\nRiskReward: {data["rr"]}')

        if message.channel.id == 972996713306533988: #BTCUSDT-4h

            data = json.loads(message.content)

            suggestion_channel = bot.get_channel(972525759430291499)
            await suggestion_channel.send(f'#{data["symbol"]} (ByBit)\n#{data["side"]}\nPrecio: {data["order_price"]}\nTake Profits: {data["tps"]}\nStop Loss: {data["sl"]}\nRiskReward: {data["rr"]}')

        if message.channel.id == 972996726841565184: #LINKUSDT-1d

            data = json.loads(message.content)

            suggestion_channel = bot.get_channel(972980874649952256)
            await suggestion_channel.send(f'#{data["symbol"]} (ByBit)\n#{data["side"]}\nPrecio: {data["order_price"]}\nTake Profits: {data["tps"]}\nStop Loss: {data["sl"]}\nRiskReward: {data["rr"]}')


bot.run("token here", bot = True, reconnect = True)

#

want me to upload it in a python paste website?

sick birch
#

This could benifit from a database

stone beacon
#

You should pass intents into Bot()

sick birch
#

Learn from something that's not TOS-violating

rustic onyx
stone beacon
#

Bot(intents=...)

rustic onyx
#

ah

#

so intents should go after defining bot?

stone beacon
#

bot = discord.Bot(intents=your intents)

#

The intents you stored in the variable intents

#

So, Bot(intents=intents) in your case

rustic onyx
#

bot = discord.Bot(intents=intents)

stone beacon
#

Nice

rustic onyx
#

then same story:

    await self.start(*args, **kwargs)
TypeError: Client.start() got an unexpected keyword argument 'bot'
stone beacon
#

Bot is not an argument of Bot.run

#

I mean think abt it, if it's discord.Bot why would you need to put bot=True

#

Just remove the bot argument and ur bot should run

rustic onyx
#

you were right

stone beacon
#

I retreat to play watch dogs now

rustic onyx
#

I dont understand though why that caused the error

#

I mean I get it was already defined

#

but whats the problem of defining it again

rustic onyx
stone beacon
#

You had 2 errors. The one causing the traceback was cuz you gave bot.run() an argument it doesn't take

rustic onyx
#

ohhhh

#

yeah right Laughing_Facepalm

#

thanks @stone beacon@zealous jay

zealous jay
#

No hay problema

twin idol
#

ISO… wait for it…. A discord bot developer

slate swan
#
        starrounded = round(starcalculation * 2) / 2
        print(starrounded)
        profilembed = embed=discord.Embed(title=f"{member} | {final_pronouns}", description=f"{final_description}", color=0xFF69B4)
        embed.set_thumbnail(url=(pfp))
        embed.set_author(name="Profile", icon_url=guildicon)
        embed.set_footer(text=f"Based on {oldstarsubmissions} reviews")
        if starrounded == '1':
            starroundedfinal = 'https://i.gyazo.com/2e011d87b0193074e131cea7e43c9a05.png'
        elif starrounded == '1.5':
            starroundedfinal = 'https://i.gyazo.com/e649df7987d3c131e510d9ae4c919f2d.png'
        elif starrounded == '2':
            starroundedfinal = 'https://i.gyazo.com/fabcf4ff15203b5261252df4ce8bd0fd.png'
        elif starrounded == '2.5':
            starroundedfinal = 'https://i.gyazo.com/03d2648145defb9dc3a1b255b67e7dd4.png'
        elif starrounded == '3':
            starroundedfinal = 'https://i.gyazo.com/73058cee6dae1edb85bba4d061b0b44f.png'
        elif starrounded == '3.5':
            starroundedfinal = 'https://i.gyazo.com/0bfa6ddb9207ed2a91514a09aaf1258d.png'
        elif starrounded == '4':
            starroundedfinal = 'https://i.gyazo.com/b2365bd9ad6fa613d577fbbad0c3c4f2.png'
        elif starrounded == '4.5':
            starroundedfinal = 'https://i.gyazo.com/c12bae2a8c8288643779cae9201e5ffb.png'
        elif starrounded == '5':
            starroundedfinal = 'https://i.gyazo.com/467f07a1e7e8430b4033679c374694b1.png'
        else:
            print("somehow theres an error")
            return
        embed.set_image(url=starroundedfinal)```

gives me

```py
1.0
somehow theres an error

the 1.0 is print starrounded

#

you do know youre comparing a float with a string right?

zealous jay
#

By putting things between ' ' you are making a string

slate swan
#

correct me if im wrong cause im pretty new

#

but shouldn't this fix it?


        starrounded2 = round(starcalculation * 2) / 2
        starrounded =  str(starrounded2)
        print(starrounded)
#

if you want to make it a string sure

#

i tried that and it's still not fitting in and giving me the somehow theres an error

#

then all the if/elif statements were false

visual yarrow
#

@slate swan It is against the rules of this server to help with such code. And please don't try to circumvent to rules by asking people in DMs. Thanks.

slate swan
#

wait what?

slate swan
#

why would i ask someone for code when i can make it myself? i kinda feel like im being falsely accused?

#

it might be a wrong @, happened to me earlier

#

@visual yarrow ?

#

yeah im so confused right now

slate swan
#

well i didnt know my bad

visual yarrow
#

I'm so sorry lemon_sweat

#

I meant to ping @slate swan

visual yarrow
slate swan
#

phew😮‍💨

visual yarrow
#

I should sleep lol.

slate swan
#

you should😭

regal pulsar
slate swan
regal pulsar
#

lmao

flint isle
slate swan
#

or maybe you got your bot verified?

#

it kinda seems like it

flint isle
slate swan
#

AHHHHH

flint isle
slate swan
#

right

#

has happened to me like 3 times already😭

flint isle
#

im currently suffering from trying to upload my code using mgit and it not working

slate swan
#

dang😭

flint isle
slate swan
#

How do I make my bot have mobile status?

#

they cant have it

#

I've seen some java bots have it before

#

iirc they mutate the api which is against tos

#

ah I see

pliant gulch
slate swan
#

is it?

pliant gulch
#

But it's pretty much unsupported

slate swan
#

oh

pliant gulch
#

You can ask in the offical API server as well, they will say yes

slate swan
#

i believe you chill🗿

fading marlin
#

you gotta do some sketchy stuff to be able to have it though, so I wouldn't recommend it

pliant gulch
#

You literally change one property inside your inner payload for IDENTIFY

slate swan
#

i was gonna ask which but i shouldnt and dang its that easy

pliant gulch
#

Why would you need to do sketchy stuff to do that??

slate swan
#

its just wording bro

#

calm down😭

rain burrow
#

will anyone help me code a discord bot im new to this stuff?

pliant gulch
# slate swan calm down😭

!e ```py
import ctypes
ctypes.py_object.from_address(id(True)+tuple.itemsize).value=type("",(),{"repr":lambda*:"True"})
this, sketchy = 0, 1
print(this is not sketchy)

unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your eval job has completed with return code 0.

True
pliant gulch
#

wait, I'm an idiot

#

with or without ctypes it would've printed True anyways

slate swan
#

and you really needed to use the import keyword

#

just use the dunder to make yourself look cooler😎

pliant gulch
slate swan
#

that is so cool but at the same time scary(for your health)

slate swan
#

        embed=discord.Embed(title=f"**Post Removal**", description=f"**Discord User**: {membermention} | {member} ", color=0xFF0000)            
        embed.set_thumbnail(url=(pfp))
        embed.add_field(name="**Removal Reason**:", value="hi", inline=False)
        embed.set_footer(text="Roleplay Hub⠀⠀⠀Developed by r0yal#9604")
        with open("removal.stonks","r") as f:
            removalchannel = int(f.read())
            f.close()
        channel3 = self.bot.get_channel(removalchannel)
        ratestaffmsg = await channel3.send(f"{membermention}\n@here\n[#649402476285394944](/guild/267624335836053506/channel/649402476285394944/)\n[#649402513388470272](/guild/267624335836053506/channel/649402513388470272/)\n[#649402550537158696](/guild/267624335836053506/channel/649402550537158696/)", embed=embed)
        await ctx.send("sent")
        
        await ratestaffmsg.add_reaction('\U0001F4CB')
        def check(reaction, user):
            return not user.bot and str(reaction.emoji) == '\U0001F4CB'
        try:
            reaction = await self.bot.wait_for('reaction_add', timeout=180.0, check=check)
            await channel3.send("confirmed")
            await ratestaffmsg.clear_reactions()
        except asyncio.TimeoutError:
            await message.clear_reactions()
            await ctx.send(f'no reaction in 180s (DEBUG).')
            return

how do i make it so this doesn't affect every pending message with an active emoji when one is clicked and ONLY affects the message the emoji is attached to?

#

e.g clicking the emoji on the bottom one fulfills the code for both instead of just the bottom one

slate swan
boreal ravine
flint isle
#

every bot

slate swan
flint isle
#

github itself scans for the tokens and sends the alert to discords server and the server revokes it. they likely scan common places aswell

slate swan
#

hmm

rustic onyx
#

guys whats the pip command to install this discord version? 2.0.0b1

slate swan
jade tartan
#
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 1, in <module>
    import discord
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\__init__.py", line 25, in <module>
    from .client import Client
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 53, in <module>
    from .webhook import Webhook
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\webhook\__init__.py", line 12, in <module>
    from .async_ import *
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\webhook\async_.py", line 52, in <module>
    from ..channel import PartialMessageable
ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\channel.py)```
dusky pine
boreal ravine
#
Traceback (most recent call last):
  File "C:\Users\raimy\AppData\Local\Programs\Python\Python310\lib\site-packages\jishaku\features\python.py", line 156, in jsk_python
    async for send, result in AsyncSender(executor):  # type: ignore
  File "C:\Users\raimy\AppData\Local\Programs\Python\Python310\lib\site-packages\jishaku\functools.py", line 125, in _internal
    value = await base.asend(self.send_value)
  File "C:\Users\raimy\AppData\Local\Programs\Python\Python310\lib\site-packages\jishaku\repl\compilation.py", line 154, in traverse
    async for send, result in AsyncSender(func_g(*self.args)):  # type: ignore
  File "C:\Users\raimy\AppData\Local\Programs\Python\Python310\lib\site-packages\jishaku\functools.py", line 125, in _internal
    value = await base.asend(self.send_value)
  File "<repl>", line 5, in _repl_coroutine
    await paginator.start()
  File "C:\Users\raimy\Desktop\Reddi-bot\bot\paginator.py", line 48, in start
    self.message = await self.ctx.send(embed=self.items[self.index])
  File "C:\Users\raimy\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\context.py", line 700, in send
    return await super().send(
  File "C:\Users\raimy\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 1521, in send
    with handle_message_parameters(
AttributeError: 'str' object has no attribute 'to_dict'
jade tartan
#
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 7, in <module>
    from discord_components import *
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_components\__init__.py", line 1, in <module>
    from .client import *
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_components\client.py", line 3, in <module>
    from discord import (
ImportError: cannot import name 'Client' from 'discord' (unknown location)```
boreal ravine
supple thorn
#

Well that's one interesting username

keen mural
#
# CURRENCY ATTEMPT!
import pickle

data_filename = "data.pickle"

class Data():
    def __init__(self, wallet, bank, shovel):
        self.wallet = wallet
        self.bank = bank
        self.shovel = shovel


#Commands
blah blah blah

#Functions
def load_data():
    if os.path.isfile(data_filename):
        with open(data_filename, "rb") as file:
            return pickle.load(file)
    else:
        return dict()

def load_member_data(member_ID):
    data = load_data()

    if member_ID not in data:
        return Data(0, 0)

    return data[member_ID]

def save_member_data(member_ID, member_data):
    data = load_data()

    data[member_ID] = member_data

    with open(data_filename, "wb") as file:
        pickle.dump(data, file)

  
for filename in os.listdir('./cogs'):
  if filename.endswith('.py'):
    client.load_extension(f'cogs.{filename[:-3]}')```
if i want to add shovel, how would i go about doing that because it isnt working
supple thorn
supple thorn
#

!d discord.Embed.to_dict

unkempt canyonBOT
boreal ravine
#

OH wait

#

Thanks coke

supple thorn
#

I finally helped

supple thorn
keen mural
#

the other 2, bank and wallet, work but im tried to add shovel but its saying data has no attribute shovel

slate swan
keen mural
keen mural
boreal ravine
slate swan
#

show the member_data object

keen mural
boreal ravine