#discord-bots

1 messages · Page 858 of 1

unique lichen
#
Traceback (most recent call last):
  File "/home/runner/testingthis/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 43, in on_message
    async with aiohttp.ClientSession('https://aipokedex.com',headers=headers) as session:
TypeError: __init__() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given``` how to resolve this error ?
slate swan
#

why is the url there?

#

it's supposed to be inside session.get

#

or wherever you make the request

#

!d aiohttp.ClientSession

unkempt canyonBOT
#
class aiohttp.ClientSession(base_url=None, *, connector=None, cookies=None, headers=None, skip_auto_headers=None, auth=None, json_serialize=json.dumps, ...)```
The class for creating client sessions and making requests.
slate swan
#

ah, use base_url kwarg there

crisp shoal
slate swan
#

Ah the bot does not support json evals

#

No I'm dumb

#

this will work anyways

maiden fable
#

Cool

unique lichen
#

how to downgrade aiohttp to meet with requirements of discord?

maiden fable
#

pip install aiohttp==version

#

BTW, no need to downgrade it if there are no breaking changes

unique lichen
maiden fable
#

like changing a method name from get_xxx to get_yyy and so on

unique lichen
#

ohh

#

its giving some error like cant make package because discord requires this version and that

maiden fable
#

then just do pip install aiohttp==version

unique lichen
#

ty

austere solstice
#

why not working using sublime text for it

hazy oxide
#

Indentation

#

There's some extra space

#

Show the for alias in command.aliases code

bleak karma
#

is it possible to make an event where if someone decides to put the server's vanity url on their status the bot would detect it?

manic wing
#

you can iterate through all the members in the server and check their status

#

bearing in mind this requires member intents

oblique adder
#

How to get ctx from interaction ?

verbal agate
oblique adder
#

ctx: commands.Context

#

is they a way ?

#

probably not ?

slim ibex
#

interactions don’t have ctx

verbal agate
#

@client.event async def on_message(message): ctx = await client.get_context(message)

#

found this on stackoverflow

slim ibex
#

interactions have the interaction

oblique adder
#

can I invoke a command using interaction ?

slim ibex
#

Generally ApplicationCommandInteration

#

it has different methods like send_message instead of send

slim ibex
oblique adder
#

is it interaction.invoke ?

#

I need the alternative of ctx.invoke

slim ibex
#

What lib are you using

oblique adder
#

nextcord

slim ibex
#

they have slash commands now?

oblique adder
#

yes but im not using a slash command

slate swan
slim ibex
#

What are you using? A button interaction or something

oblique adder
#

dropdown

slim ibex
verbal agate
slate swan
oblique adder
slim ibex
#

and I used to use nextcord religiously

slate swan
#

still prefer disnake more due to their pushing of features earlier than nextcord

#

And the fact they test everything multiple times

#

Which is reassuring

#

Sad that everyone leaves after I write something

final iron
#

🗿

grim oar
final iron
#

You can just use the send method on the user object

#

No need to create a dm channel

#

It's done automatically

#

Don't use a bare exception

#

You'll want to handle the specific error

#

When a member has their dms closed the error is

slim ibex
#

^

#

discord.HTTPException

final iron
#

Would it not be forbidden

rancid stump
#

hy guys how to sent a embedd text in discord bot like the one above

unkempt canyonBOT
#

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

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

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

New in version 2.0.

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

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

robin and i had this discussion a bit ago

#

he said httpexception would be best more cases iirc

final iron
#

Cool

rancid stump
slim ibex
#

embed=embed_name

rancid stump
surreal sierra
#

hi shouldnt this work? Im using a .ini file as config file but I only get errors when I try to run it

config.ini

[Bot]
TOKEN = 'BOT_TOKEN'

main.py

# Config File
file = 'config.ini'
config = ConfigParser()
config.read(file)

bot.run(config['Bot']['TOKEN'])

Error:

    raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.ilure: Improper token has been passed.
maiden fable
#

Try printing the token var

slate swan
#

looks better + personal preference

sage otter
slate swan
quick gust
#

But if you are making a public respository it matters

slate swan
sage otter
#

That’s not always the case

#

You literally argued the point to put it in the main file

#

Then are saying to use a .env

quick gust
#

anyways, it's better we shift from the argument. They're using a .ini file because it's their preference

final iron
#

What even is a .ini file

#

I know it's the file extension

quick gust
#

lol

slate swan
#

sum1 help me with this ._tsad

quick gust
final iron
#

Oh so it's basically json

slate swan
quick gust
final iron
#

Key and value pairs

quick gust
#

pip install git+repo_url

slate swan
#

kk thx

sage otter
#

It’s like old ass yaml

slate swan
quick gust
slate swan
#

thank u

slate swan
quick gust
#

add a + in between git and the url

#

git+https://github.com/Rapptz/discord.py

drowsy thunder
#

Error,help me(Replit)

gaunt wedge
final iron
drowsy thunder
gaunt wedge
slim ibex
drowsy thunder
slim ibex
#

we found another one

drowsy thunder
#

I mean music bot

#

Hope to not get copyright strike

slim ibex
#

not a good idea

drowsy thunder
#

And make a bot like Rythm

gaunt wedge
rancid stump
#

in discord.embed

i want to small the image size how i can do it ?

drowsy thunder
slim ibex
final iron
gaunt wedge
slim ibex
#

YouTube forced rhythm to shut down

drowsy thunder
slate swan
slim ibex
#

they don’t want people using their API for music bots

gaunt wedge
final iron
bleak karma
#

i wanna make the event mention the member after smt changed but if i put 'member' it keeps saying missing 1 required positional argument: 'after'. Help please-

slate swan
drowsy thunder
slate swan
quick gust
slim ibex
#

^

slate swan
#

it's against rule5

bleak karma
gaunt wedge
#

i thought banned from discord

final iron
#

You can get banned from discord

gaunt wedge
#

oh ye, i forgor that webhook is a whole different thing in discord, how do i actually let discord make POST requests to my server, not me requesting incoming messages to them? and let discord.py automatically handle them

#

i think it's called interaction endpoint url

velvet tinsel
#

music bots aren't allowed?

visual island
gaunt wedge
final iron
gaunt wedge
slate swan
#

without an event or something?

final iron
#

Put it in here

#

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

final iron
#

What's with the 6 second slowmode

slate swan
#

ah

tough stone
#

Hello guys ! I created a discord bot on multiple guilds, and each server has an object which contains different informations, such as an admin list. I have a command named !addadmin which need 2 parameters -> server id and discord id. When I add an admin on 2 differents server, lists are the same but it's supposed to be 2 differents lists. This is complete non-sense

        elif message.author.id == admin and message.content.startswith('!addadmin'):
            msg = message.content.split(' ')
            index = getguild(int(msg[1]))
            listguilds[index].addToAdminsList(int(msg[2]))
            print("Users as been add to administrator in the following guild : " + listguilds[index].guildname)
bleak karma
maiden fable
#

👀

slim ibex
tough stone
#

I need it

slim ibex
#

And I wouldn’t use a list as a database

#

^

maiden fable
slim ibex
#

wow a beginner that actually knows some Python

tough stone
#

I understand what you say, but it's not solving my problem right now

maiden fable
tough stone
#

I'll use a database whatever

gaunt wedge
#

so a long time ago, i tried making discord bots with AWS Lambda + py, and i see discord has interactions endpoint url thing, where you can assign in the developer portal, i found out that if you do have the interaction endpoint url, discord will send POST requests to your server / endpoint when your bot receive a message, now, how can i do this exact same thing in discord.py where the POST requests are handled by discord.py itself?

sorry if my explaining is kinda weird 😂

maiden fable
bleak karma
maiden fable
#

Don't tell me u copied the code...

bleak karma
#

well i learned from it bc they provided sources

#

so err

slim ibex
#

💀

maiden fable
maiden fable
slate swan
maiden fable
#

reinstall

slate swan
bleak karma
maiden fable
maiden fable
slate swan
maiden fable
maiden fable
gaunt wedge
maiden fable
#

use a while True loop

#

!d asyncio.loop.run_forever also exists

unkempt canyonBOT
#

loop.run_forever()```
Run the event loop until [`stop()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.stop "asyncio.loop.stop") is called.

If [`stop()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.stop "asyncio.loop.stop") is called before [`run_forever()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_forever "asyncio.loop.run_forever") is called, the loop will poll the I/O selector once with a timeout of zero, run all callbacks scheduled in response to I/O events (and those that were already scheduled), and then exit.

If [`stop()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.stop "asyncio.loop.stop") is called while [`run_forever()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_forever "asyncio.loop.run_forever") is running, the loop will run the current batch of callbacks and then exit. Note that new callbacks scheduled by callbacks will not run in this case; instead, they will run the next time [`run_forever()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_forever "asyncio.loop.run_forever") or [`run_until_complete()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_until_complete "asyncio.loop.run_until_complete") is called.
gaunt wedge
#

yeah, i used run_forever

slate swan
bleak karma
#

im aware but im not too fond of javascript either-

gaunt wedge
maiden fable
bleak karma
#

uh yes

small igloo
#

expected emoji jobName

        if l >= 10:
            g = []
            for i in range(len(topJobList)):
                g.append((job_emote[topJobList[i]], topJobList[i]))
            v = "\n".join(map(str, g))
            e.add_field(name="Top Job List: ", value = "".join(v), inline=False)```

code used
maiden fable
#

Wish I followed these... I just went on copying code and understanding it myself without anyone's help, with google

#

Fun but difficult tbh

#

Took me an year and a half to like become an intermediate-professional in Python

quaint epoch
#

@restive coral , we found a half baked

maiden fable
#

Huh?

manic wing
maiden fable
#

idk

quaint epoch
maiden fable
#

Ah that way

manic wing
#

ah

small igloo
#

no error but it send (image below) dat text instead of what i want, which is "emoteImage Name"

#

🗿 ok, lemme try

#

w-where to add that 🗿

unkempt canyonBOT
#

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

001 | ('💖', 'healer')
002 | 💖 healer
small igloo
#

ah i see, ok thanks

gaunt wedge
#

they have dicord server!!!!!111??!?

#

didnt know tht, ty

small igloo
#

ig i'm not doing it right 🗿

        if l >= 10:
            g = []
            for i in range(len(topJobList)):
                g.append((job_emote[topJobList[i]], topJobList[i]))
            v = "\n".join(map(str, *g))
            e.add_field(name="Top Job List: ", value = "".join(v), inline=False)```
#

so, just "*v"?

#
e.add_field(name="Top Job List: ", value = *v, inline=False)```...
slate swan
#

_tsad sum1 help

small igloo
#

k wait

manic wing
slate swan
small igloo
#
(':stab~1: ', 'knight')
(':tank: ', 'tank')
(':moni: ', 'stealer')
(':royalguard: ', 'royal guard')
(':brewer: ', 'brewer')```
manic wing
#

what do you want pages to be?

small igloo
#

yes

#

is print?

#

🗿 ??

#

oh ok (variable??)

#

🗿 ok

#

ok 🗿 so u r yerlikaya

#

:v ok

#

🗿 ok wait

#

["(':healer: ', 'healer')", "(':stab: ', 'knight')", "(':tank: ', 'tank')", "(':moni: ', 'stealer')", "(':royalguard: ', 'royal guard')", "(':brewer: ', 'brewer')"] 🗿

#

arent they are the same 🗿

#

🗿 ok

#

:big_moyai:

boreal ravine
#

map returns an object if it's true right?

small igloo
#

just need brachet?

slate swan
boreal ravine
#

oh

#

thanks

small igloo
#

i try in dat embed=*v but....

#

k then
(':healer: ', 'healer') (':stab: ', 'knight') (':tank: ', 'tank') (':moni: ', 'stealer') (':royalguard: ', 'royal guard') (':brewer: ', 'brewer')

valid elbow
#

hey is there anyone work with me on the project of NLP(natural language processing) if yes please pin me out

boreal ravine
small igloo
#

no prob and GGTY 🗿👍

manic wing
#

ggty?

small igloo
manic wing
#

i see

lament mesa
#

Zzz

#

Xxx

#

T

maiden fable
#

sure!

manic wing
#

first of all, dont call it Application

pliant gulch
#

The cog loading could use some work? Did you try what I suggested to you a while ago

manic wing
#

its not an Application, its a bot - you can call it Bot or the name of your prroject

maiden fable
#

use load_extensions

manic wing
#

dont use load_extensions

#

it tries to load pycache and fails

maiden fable
#

!d disnake.ext.commands.Bot.load_extensions

unkempt canyonBOT
slate swan
#

Isn't self.connection supposed to be a connection object?

pliant gulch
#

Here is what I suggested in case you lost it

slate swan
#

No it's not, you just do it = object , not create an instance of it

pliant gulch
#

You also annotated the function returns, but not anything else? It would be best to stay consistent

slate swan
#

like ```py
#what u did
bot = commands.Bot
#what you should
bot = commands.Bot()

#

that's just an example of instancing.

pliant gulch
#

True, but for regular ol people it's a lot harder to infer the type

#

For me with typehinting it's always all or nothing

slate swan
#

This is not an instance.

#

Ah nevermind

pliant gulch
#

A nitpick @ line 40 asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) you could set that below the imports

slate swan
#

Yea gotit, I'm on phone and the text appears to small so..

manic wing
#

just iterate through and load them individually

maiden fable
#

Why tho

manic wing
#

that way you can check for pycache or unwated stuff

maiden fable
#

Ah that way

manic wing
#

it literally iterates throughj

pliant gulch
#

pycache is already ignored

#

Look at the if not file.startswith("_")

unkempt canyonBOT
#

os.walk(top, topdown=True, onerror=None, followlinks=False)```
Generate the file names in a directory tree by walking the tree either top-down or bottom-up. For each directory in the tree rooted at directory *top* (including *top* itself), it yields a 3-tuple `(dirpath, dirnames, filenames)`.
vapid anchor
#

!d pkgutil.iter_modules

unkempt canyonBOT
#

pkgutil.iter_modules(path=None, prefix='')```
Yields [`ModuleInfo`](https://docs.python.org/3/library/pkgutil.html#pkgutil.ModuleInfo "pkgutil.ModuleInfo") for all submodules on *path*, or, if *path* is `None`, all top-level modules on `sys.path`.

*path* should be either `None` or a list of paths to look for modules in.

*prefix* is a string to output on the front of every module name on output.

Note

Only works for a [finder](https://docs.python.org/3/glossary.html#term-finder) which defines an `iter_modules()` method. This interface is non-standard, so the module also provides implementations for [`importlib.machinery.FileFinder`](https://docs.python.org/3/library/importlib.html#importlib.machinery.FileFinder "importlib.machinery.FileFinder") and [`zipimport.zipimporter`](https://docs.python.org/3/library/zipimport.html#zipimport.zipimporter "zipimport.zipimporter").

Changed in version 3.3: Updated to be based directly on [`importlib`](https://docs.python.org/3/library/importlib.html#module-importlib "importlib: The implementation of the import machinery.") rather than relying on the package internal [**PEP 302**](https://www.python.org/dev/peps/pep-0302) import emulation.
vapid anchor
#

this one's the best, disnake uses it for client.load_extensions("./cogs")

slate swan
#

basically loading all the cogs in the folder?

vapid anchor
#

wait

#

lemme just send exactly what disnake does

#

!d disnake.ext.commands.Bot.load_extensions

unkempt canyonBOT
slate swan
#

Mhm yea

vapid anchor
#

if you're using disnake then use that

manic wing
#

they changed load_extensions im pretty sure

#

looks like the most efficient method now

vapid anchor
#

it wasn't in discord.py. I didn't change it, I added it

manic wing
#

but i think before it was worse

manic wing
vapid anchor
#

load_extension for 1 extension, load_extensions for multiple

slate swan
#

load_extension was a thing, load_extensions wasnt

tough stone
#

Hi, is there a way to detect if the bot is added to a new server while running ? Thanks !

vapid anchor
#

I didn't want to touch load_extension because it looked like it would break if I tried to touch anything

#

I migrated to hikari purely because of all the internal dpy fuckery

unkempt canyonBOT
#

discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.

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

Thanks !

pliant gulch
#

All the type: ignores in discord.py's codebase is enough to make me stay away

vapid anchor
#

you sure it's not something like botname/cogs or whatever? It should work with just what you did

#

the search may be a bit restrictive

#

try adding an __init__.py

#

but I swear it shouldn't be required

#

kinda sussy

#

it should find events and slash_commands as modules and go recursively into them

quick gust
#

try adding a / before cogs? that probably won't change anything though lol

pliant gulch
#

Did you just do /cogs or ./cogs

quick gust
#

forward slash?

#

oh yeah try doing ./cogs

vapid anchor
#

that cwd error just means it got something like ../cogs

quick gust
#

. means the current directory

#

strange

vapid anchor
#

and the python importer just straight up doesn't support that most of the time

#

I decided to just disallow that instead of dealing with the bugs

#

wait wait

#

how are your directories further nested?

#

If it's cogs/slash_commands/category/cog.py it won't be able to tell that category is a module

#

wtf

#

maybe slash_commands needs __init__.py too?

#

I honestly hate python's importer

#

that shit's so unreliable

pliant gulch
#

Is your bot in the same server with the emoji?

#

In the case of the lemon emoji it probably isnt, that's why you got an ID out

slate swan
#

that won't be the same emoji...

vapid anchor
#

gawd alright that's surprising

#

should maybe try to make it allow that too

limber plume
#

Hello. Is there any way to reduce cooldown for users with specific role?:

@commands.cooldown(1, 300, commands.BucketType.user)

slate swan
#

how do i make it so when I were to click a button only I could see the result

slate swan
unkempt canyonBOT
#

@discord.ext.commands.dynamic_cooldown(cooldown, type=BucketType.default)```
A decorator that adds a dynamic cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

This differs from [`cooldown()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.cooldown "discord.ext.commands.cooldown") in that it takes a function that accepts a single parameter of type [`discord.Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") and must return a [`Cooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Cooldown "discord.ext.commands.Cooldown") or `None`. If `None` is returned then that cooldown is effectively bypassed.

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.

A command can only have a single cooldown.

New in version 2.0.
slate swan
#

you may return None if the user has the role.. ( cooldown is a fictional here )

vapid anchor
#

as long as pkgutil doesn't support it disnake won't either

slate swan
#

why do you do that when you can just typehint a as discord.User?

#

just like you typehinted it to a string, typehint it to discord.User

#

how do i make it so when I were to click a button only I could see the result
could someone help me

slate swan
#

ephemeral = True exists for most of them

slate swan
vapid anchor
#

you know what, we could make a custom SourceFileLoader to allow that

slate swan
# slate swan discord.py

the master branch right? While creating the response you may use ephemeral=True inside the sending method

vapid anchor
#

nah it's just that I realized it is possible after all. If the disnake team agrees it's worthwhile to add it we might

nimble plume
#

Hi anyone remember me

vapid anchor
#

I mainly work on hikari these days so there's not a high chance

timid wagon
#

What will be the purpose of having it built-in?

timid wagon
vapid anchor
#

no idea but it's a thing

timid wagon
#

I'll ping arl or smth

slate swan
#

a is already a discord.User

#

just send it..

nimble plume
#

Or import disnake as discord

manic wing
#

or use the disnake shim

timid wagon
slate swan
#

how would i make a cooldown on a button in discord. (discord.py)

nimble plume
#

Nvmd

slate swan
#

wdym by cooldowns for a button?

nimble plume
#

Like

#

If i click one time so we cant spam click he mean

slate swan
#

well you would be subclassing the ui.Button and would do some cache-ing stuff

limber plume
#

Is there any way to rerun command as user in the **on_command_error ** handler?

slate swan
timid wagon
#

You could disable the button for a certain time period after a user clicks, I guess?

slate swan
nimble plume
#

Idk that sorry

slate swan
#

uh

nimble plume
#

Lol

nimble plume
limber plume
#

Thanks

slate swan
#

!d discord.ext.commands.Context.invoke

nimble plume
#

I have not coded my bot for more than 1 week

unkempt canyonBOT
#

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

Calls a command with the arguments given.

This is useful if you want to just call the callback that a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") holds internally.

Note

This does not handle converters, checks, cooldowns, pre-invoke, or after-invoke hooks in any matter. It calls the internal callback directly as-if it was a regular function.

You must take care in passing the proper arguments when using this function.
maiden fable
nimble plume
#

I realize that we can import as

maiden fable
#

U do know u just replied to a week old message of mine, right?

maiden fable
#

Okay cool then

limber plume
#

Is there any way to check if user has specific role by checking role id?

kindred epoch
#

Same as a normal command, use has_permissons

#

Best bet is to store the time and call it every hour depending on the tim

#

So store the time in a db and use a tasks.loop to see if the current time is the time you stored in the db

#

Or if you don't restart your bot that often then use sleep_until @slate swan that's what I do for my reminder cmd

#

Ye prob the best choice

slate swan
#

Guys I want to create an economy bot and I want to make something different from the YT tutorials

kindred epoch
#

No idea

slate swan
#

what do you mean by bot's top role?

pliant gulch
#

Interaction has a guild property, so then you could do Interaction.guild.me

#

guild is None, was the command ran in the guild?

#

Oh, you haven't ran it yet

#

Well the linter isn't messing with you, guild can be None | Guild

#

Just add an if statement checking if guild is not None

#

User's aren't bound to a guild, they have no roles

#

You need to access me through interaction.guild

limber plume
#

Is it possible to get what arguments user provided in command in on_command_error event?

pliant gulch
cold sonnet
#

you gotta work it out

pliant gulch
#

Oh, then yea just isinstance

limber plume
#

I tried using invoked_with but it doesn't give arguments

cold sonnet
#

the errors don't return arguments, maybe the one that's missing if it's MissingRequiredArgument

#

well ctx.message

#

!d discord.ext.commands.Context.invoked_with

unkempt canyonBOT
cold sonnet
#

wait wth

#

!d discord.ext.commands.Context.args

unkempt canyonBOT
cold sonnet
#

completely my bad

limber plume
#

oh

#

thanks

cold sonnet
#

I don't think the bot has anything to do with that

#

does a bot have subprocesses?

#

that'd be cool

merry charm
#

my website for my discord bot is haunted

#

that image is in a entire other file

#

and the links lead to their normal images

cold sonnet
#

so?

hexed copper
#

Why?

pale pier
#

Hello, im learn some basics about python, actually im after this video: ||https://youtu.be/rfscVS0vtbw|| , do u think im ready to start with discord.py? Or i need to learn some more about py?

This course will give you a full introduction into all of the core concepts in python. Follow along with the videos and you'll be a python programmer in no time!
Want more from Mike? He's starting a coding RPG/Bootcamp - https://simulator.dev/

⭐️ Contents ⭐
⌨️ (0:00) Introduction
⌨️ (1:45) Installing Python & PyCharm
⌨️ (6:40) Setup & Hello Wor...

▶ Play video
maiden fable
#

Because Discord waits for the next PING event sent by the gateway/websocket every x seconds and if it doesn't receive it, it sends the bot offline

oblique adder
#

Is it possible to get ctx from interaction ? i need to use ctx.invoke to invoke a command from dropdown

slate swan
#

you can get context from a message object

#

unsure how you would use an interaction to get it

maiden fable
slate swan
#
    def __init__(self, usernames: List[str]):
        self.to_check = usernames```    im tryna make username var to be username = ''.join((random.choice('abcdefghijklmnopqrstuvwxyz1234567890')) for x in range(14))
#

but i get errror

maiden fable
#

what is the error

slate swan
#

discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
what does this mean

slate swan
#

to use random.choice and pick a random char

vale wing
vale wing
#

You could just call it as a method and provide an interaction instead of context

slate swan
vale wing
#

They have some different attributes and methods so you gotta check for that

#
await bot.get_command('cmd').__call__(inter, arg1, arg2, ...)```
But remember that you are parsing not the `Context`, but `Interaction`. Better refactor your code and extract the command to some method
#

!d discord.Member.edit

unkempt canyonBOT
#

await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the member’s data.

Depending on the parameter passed, this requires different permissions listed below...
vale wing
#

nick param

slate swan
#

use an error handler

slate swan
#

is there a emoji converter so i can put the emoji in without doing it manually

#

one easier method to deal with it using a none default value py async def command(ctx, arg: discord.User=None): if arg is None: # not provided return #do your stuff

slate swan
manic wing
#

?

#

share your usecase

#

what are you trying to do, whats the end goal

slate swan
#

just got this error. was working perfectly fine last night!

Code:

#

error:

quick gust
#

seems like an internal error

slate swan
#

what's the fix?

quick gust
#

what lib are u using?

slate swan
#

for this im using os

#

u want all my libs?

quick gust
#

no, which discord api wrapper

manic wing
#

look at the error

quick gust
#

dpy, a fork or another lib

quick gust
manic wing
#

look at the error

quick gust
#

yeah okay

slate swan
#

anyways yeah

#

first time getting this error, last night and earlier today it was working fine

quick gust
#

try updating it

#

pip installl -U discord.py

#

or

manic wing
quick gust
#

uh

#

i don't know then lol

slate swan
#

caeden you know a fix?

manic wing
#

do pip list

slate swan
#

lemme send the list in a hastebin

tawdry plover
#

Trying to make a log Bot, can anyone help as I have no experience with making Bots at all.

slate swan
slate swan
# slate swan error:

either do py except exceptiontype1, exceptiontype2: or py except (exceptiontype1, exceptiontype2:) you cant py except (exceptiontype1, exceptiontype2), exceptiontype3

final iron
#

!d discord.Member

quick gust
#

it isn't in their code tho

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.
quick gust
#

is it?

slate swan
manic wing
slate swan
#

wait what

manic wing
#

try doing pip uninstall Cogs

slate swan
#

they have a lib named cogs

quick gust
#

ah

slate swan
#

oh shit

quick gust
#

that's causing the error

slate swan
#

christ bro

#

yeah it works now thanks

final iron
#

Didnt guild permissions for specific members get removed?

slate swan
#

Is that even possible?

#

!d discord.Embed.title

unkempt canyonBOT
slate swan
#

And set the value

#

embed.title = "uwu"

#

Same goes with desc

dense swallow
#

how does some bots ask for admin perms and others at the same time?

slate swan
slate swan
quick gust
#

embed.title = arg

slate swan
#

bold?

#

if bold its like this
**Bold** would give you bold

slate swan
dense swallow
#
async def command_name(ctx, title, desc):
    # make embed
    title = embed.title
    desc = embed.description # smth like that
slate swan
#

not how kwargs work lol

quick gust
#

yeah

slate swan
#

you're just setting a variable

#

what is your issue its not very clear

#

can you reword it?

dense swallow
#

I think he wants to make custom embeds as seen in other bots thru commands

#

you know Carl bots embed builder? smth like that

tough stone
#

Hello, can someone explain me how is it possible and what could be the problem ? Thanks
g is a tuple and g[3] is an id of a channel

slate swan
#

ah

#

just make different arguments lol

#

just add the kwarg in to the description kwarg?

#

no need for that f string lol

dense swallow
#

yeah bcz it's just one thing

#

description=announcemsg

slate swan
dense swallow
#

no need of f string like f".."

slate swan
#

just take a positional argument that takes the title and then a kwarg its basic python

tough stone
#

<class 'int'> for the g[3] variable

slate swan
#

can you show whats g

tough stone
#
    def recoverAllGuilds(self):
        with mysql.connector.connect(**self.connection_params) as db:
            with db.cursor() as c:
                request = "SELECT * FROM serveurs"
                c.execute(request)
                results = c.fetchall()
                return results
#

results => g

slate swan
#

you probably stored the ids as strings if not they are wrong

tough stone
#

Yeah but just before the line channel = client.get_channel it's telling me it's an int

#

I stored them as bigint

#

I'll check the value

#

Values are correct

quick gust
#

fetchall returns a list/tuple

#

are u indexing?

tough stone
#

Yeah I know but I'm using a for loop so the value g contains only a tuple, so I can access to g[3] which is an int, but client.get_channel(g[3]) returns None

#

And all channel ids are correct

slate swan
#

then the id is wrong

#

the method only returns None when incorrect so if its a string or a wrong id it will return None

tough stone
tidal hawk
#

Hey, does someone with python knowledge, know how to make member: disnake.Member param optional?

tough stone
#

It's integer, and I checked over and over the values

tawdry plover
#

Can anyone help me make a log bot on Discord?

tough stone
#

Ok I found my mistake

tough stone
still swan
still swan
slate swan
# still swan yeah xD

optional is good for return types as well but since 3.10 has typing unions what for

slate swan
#

logging everything is against tos

#

if you have a reason to log msgs youre fine but everything and saving a ton of data in discord is against tos

tough stone
slate swan
#

you mean if it wasnt cached?

tough stone
#

Yes, if you try to access get_channel when the bot is still starting

tawdry plover
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
#

use this^

tough stone
#

Nice

slate swan
tawdry plover
#

Oh, where

slate swan
tawdry plover
#

oh ty

slate swan
tawdry plover
slate swan
tawdry plover
#

Yeah.

slate swan
#

just check docs for the events lol

tawdry plover
#

kk

#

I'm really knew to developing Bots

slate swan
#

whats the dir

#

!d discord.on_member_remove

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") leaves or joins 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.
manic wing
tawdry plover
#

So much discord Moderators here.

tardy atlas
#
@bot.event
async def on_message(message):
    if message.author.bot:
        return
    if message.guild.id != 692305542324027424:
        print("222")
        return
          
    with open("banwords.json") as f:
        banwords = json.load(f)

    with open("banwords.json", "w") as f:
        json.dump(banwords , f)
    
    
    if {i.lower().translate(str.maketrans('','', string.punctuation)) for i in message.content.split(' ')}.\
    intersection(set(json.load(open('banwords.json'))["banwords"])) != set():
        name = 'banwords'
        
        base.execute("""CREATE TABLE IF NOT EXISTS {}(userid INT, count INT)""".format(name))
        base.commit()
        
        warning = cursor.execute('SELECT * FROM {} WHERE userid = ?'.format(name),(message.author.id,)).fetchone()
        
        if warning == None:
            cursor.execute('INSERT INTO {} VALUES(?, ?)'.format(name),(message.author.id,1))
            base.commit()
            await message.channel.send(f'1 предупреждение\n{message.author.mention} по губам отшлепать?')
        
        elif warning[1] == 1:
            cursor.execute('UPDATE {} SET count = ? WHERE userid = ?'.format(name),(2,message.author.id))
            base.commit()
            await message.channel.send(f'2 предупреждение\n{message.author.mention} по губам отшлепать?')
        
        elif warning[1] == 2:
            cursor.execute('UPDATE {} SET count = ? WHERE userid = ?'.format(name),(3,message.author.id))
            base.commit()
            role = message.guild.get_role(921806885831716875)
            await message.channel.send(f' 3 предупреждение.\n{message.author.mention} по губам отшлепать?')
            cursor.execute('DELETE FROM banwords WHERE count AND userid') # удаляет значение переменных
            base.commit()
    await bot.process_commands(message) 

slate swan
#

!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") leaves or joins 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.
manic wing
slate swan
manic wing
tardy atlas
slate swan
tawdry plover
maiden fable
slate swan
maiden fable
#

Meh as if I want to get welcomed

cold sonnet
#

did someone say meh?

slate swan
#

😳

maiden fable
slate swan
#

bro DeniaL where you come from😳

maiden fable
#

No

cold sonnet
#

I've been summoned by meh

slate swan
tardy atlas
#
@bot.event
async def on_message(message):
    if message.author.bot:
        return
    if message.guild.id != 692305542324027424:
        print("222")
        return
          
    with open("banwords.json") as f:
        banwords = json.load(f)

    with open("banwords.json", "w") as f:
        json.dump(banwords , f)
    
    
    if {i.lower().translate(str.maketrans('','', string.punctuation)) for i in message.content.split(' ')}.\
    intersection(set(json.load(open('banwords.json'))["banwords"])) != set():
        name = 'banwords'
        
        base.execute("""CREATE TABLE IF NOT EXISTS {}(userid INT, count INT)""".format(name))
        base.commit()
        
        warning = cursor.execute('SELECT * FROM {} WHERE userid = ?'.format(name),(message.author.id,)).fetchone()
        
        if warning == None:
            cursor.execute('INSERT INTO {} VALUES(?, ?)'.format(name),(message.author.id,1))
            base.commit()
            await message.channel.send(f'1 предупреждение\n{message.author.mention} по губам отшлепать?')
        
        elif warning[1] == 1:
            cursor.execute('UPDATE {} SET count = ? WHERE userid = ?'.format(name),(2,message.author.id))
            base.commit()
            await message.channel.send(f'2 предупреждение\n{message.author.mention} по губам отшлепать?')
        
        elif warning[1] == 2:
            cursor.execute('UPDATE {} SET count = ? WHERE userid = ?'.format(name),(3,message.author.id))
            base.commit()
            role = message.guild.get_role(921806885831716875)
            await message.channel.send(f' 3 предупреждение.\n{message.author.mention} по губам отшлепать?')
            cursor.execute('DELETE FROM banwords WHERE count AND userid') # удаляет значение переменных
            base.commit()
    await bot.process_commands(message) 
manic wing
tardy atlas
#

This command is used only on one server, but for some reason I stopped using other commands on other servers, if I use other commands on other servers, 222 is written to the console, although this if is in another command, what's the problem?

maiden fable
cold sonnet
#

me

#

meh is me

tardy atlas
#

Can you help me?

maiden fable
slate swan
#

im trying to get it to join a vc

maiden fable
#

pip install discord.py[voice] @slate swan

slate swan
#

ah thanks

tardy atlas
void mortar
sick birch
slate swan
sick birch
slate swan
#

i thought i already had it installed but i had downgraded py on accident and it got rid of it all

maiden fable
sick birch
#

:wah:

tardy atlas
maiden fable
void mortar
tardy atlas
#

Ok,thank you

void mortar
#

np

slate swan
maiden fable
#

It do be hella expensive here

slate swan
#

Rip

#

nitro payment methods are trash

maiden fable
#

the classic one costs like 5 USD here which is hella expensive

slate swan
#

!rule 7

unkempt canyonBOT
#

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

slate swan
#

pithink wonder who started being ot

#

Totally not me

tardy atlas
slate swan
#

hun did

slate swan
maiden fable
#

Don't expect an answer from me, I hate slash commands

#

User, Message commands FTW since no way of giving args

sick birch
#

Which fork?

maiden fable
#

Bruh

slate swan
#

We dont about that

maiden fable
#

Now who is breaking rule 7?

slate swan
unkempt canyonBOT
maiden fable
#

U do know that simply saying "Go away from here" will also make me leave this channel, right?

void mortar
slate swan
#

kinda useless get attr imo

#
if __name__ == '__main__':
        username_list = ''.join((random.choice('abcdefghijklmnopqrstuvwxyz1234567890')) for x in range(4))
        total = len(username_list)
system(f'cls && title Ok..')
checker = Checker(username_list)
loop = asyncio.get_event_loop()
loop.run_until_complete(checker.start())```



```py
lass Checker:
    def __init__(self, usernames: List[str]):
        self.to_check = usernames

    async def _check(self, session: aiohttp.ClientSession,
                     username: str) -> None:
        total_checked = 0
        async with session.head(
                f'https://www.tiktok.com/@{username}') as response:

            if response.status == 200 and len(username) > 2:
                print('%s[UNAVAILABLE] https://www.tiktok.com/@%s%s' %
                      ('\u001b[31;1m', username, '\u001b[0m'))``` how do i change it from importing to txt to random string
void mortar
void mortar
#

xd

slate swan
tidal hawk
#

Is there a way disable member param, if I choose Robot as option?

tardy atlas
slate swan
void mortar
maiden fable
#

He answered your question

void mortar
slate swan
stone beacon
#

You can of course just ignore the extra parameter

tardy atlas
mystic vault
#

I have the following code:

import discord 
import asyncio 
import threading

client = discord.Client()
async def do():
    while True:
        await client.get_channel(id).send("test")

@client.event
async def on_ready():
    th = threading.Thread(target=asyncio.run, args=(await do(),)
    th.start()
    print("HELLO")

client.run("token")

And I want that HELLO to be printed, actually I want to run a asyncio.run in a thread and continue with the rest of the code, but what happening is that the thread prevent other code from being executed till it ends, any solutions ??

Note: I tried with and without await in the args

slate swan
#

on_ready

void mortar
#

xdd

void mortar
tidal hawk
slate swan
void mortar
slate swan
void mortar
#

ty ;)

stone beacon
slate swan
#

youre trying to send a msg on a while true loop that will get you ratelimited easily

mystic vault
#

still the same problem

slate swan
#

and use the bot framework

mystic vault
#

hello is not being printed

slate swan
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **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.
stone beacon
#

You could use a task loop from the commands.Bot class

maiden fable
#

I used the Client class once

slate swan
maiden fable
#

Was just a simple task to use tasks

slate swan
maiden fable
slate swan
maiden fable
#

Who said it was bad practice lemon_glass

slate swan
cold sonnet
#

who said hun needs practice lemon_glass

stone beacon
#

I need more moyai emojis

slate swan
cold sonnet
#

k hun

slate swan
stone beacon
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
mystic vault
maiden fable
#

with?

slate swan
stone beacon
#

It's a decorator so

from discord.ext.tasks import loop
@loop(seconds=...,minutes...)
async def foo():
  pass
maiden fable
cold sonnet
#

what?

slate swan
cold sonnet
#

meh

maiden fable
stone beacon
#

avec?

#

Ew wut

maiden fable
#

Okay I suck at slash commands

cold sonnet
slate swan
maiden fable
void mortar
#

XD

stone beacon
#

confused screams

cold sonnet
maiden fable
cold sonnet
#

I also stopped calling Ashley brirl instantly

stone beacon
#

If you want to apply options it's usually:

async def (interaction, argument : str = SlashOption(name,description, required etc..)
  pass

unless we using two different libraries

maiden fable
#

he/she is using disnake

#

smh I am sleepy

stone beacon
#

!d

unkempt canyonBOT
stone beacon
#

!d discord

unkempt canyonBOT
#

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

Creating a Bot account is a pretty straightforward process.

stone beacon
#

Oh that's why

#

That's still on 1.7 or whatever

maiden fable
#

no

#

!d discord.ui.View exists

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
stone beacon
#

Well then

#

I'm perpetually complex

maiden fable
#

reasons I hate slash commands

#

takes ages to register

stone beacon
#

Ohh makes sense

#

I use a slightly different library

stone beacon
slate swan
stone beacon
#

Makes sense I don't use mobile discord due to its horrible response times

slate swan
#

right now title is a kwarg make it a positional argument

#

(ctx, titleMsg=None , *, announcementMsg=None) should be your params

#

np

#

yeah its a positional argument

#

well im not sure because arguments would get confused

#

and having 2 kwargs idk how the wrapper wont get confused with the parameters

tardy atlas
#

Is it possible to make sure that when the bot is restarted, the variable (sql database) is not reset, otherwise it was 2/3 warns, and after rebooting 0?

tawdry perch
#

And do you run the code locally and what database system do you use?

tardy atlas
#

there is a table where the userid and the number of warns

tawdry perch
#

And do you host code locally?

tacit token
#

hi guys, whats the problem?

@client.event
async def on_ready():
    db = sqlite3.connect("main.sqlite")
    cursor = db.cursor()
    cursor.execute('''
    CREATE TABLE IF NOT EXISTS main(
    guild_id TEXT,
    msg TEXT,
    channel_id TEXT
    )
    ''')
    print("DB Done")

@client.group(invoke_without_command=True)
async def welcome(ctx):
    await ctx.send("Available Setup Commands: \nWelcome channel <#channel>\nwelcome text <message>")

@welcome.command()
async def channel(ctx, channel:discord.TextChannel):
        db = sqlite3.connect('main.sqlite')
        cursor = main.cursor()
        cursor.execute(f"SELECT channel_id FROM main WHERE guild_id = {ctx.guild.id}")
        result = cursor.fetchone()
        if result is None:
            sql = ("INSERT INTO main(guild_id,channel_id) VALUES(?,?)")
            val = (channel.id, ctx.guild.id)
            await ctx.send(f"Channel has been set to {channel.mention}")
        elif result is not None:
            sql = ("UPDATE main SET channel_id = ? WHERE guild_id = ?")
            val = (channel.id, ctx.guild.id)
            await ctx.send(f"Channel has been updated to {channel.mention}")
        cursor.execute(sql,val)
        db.commit()
        cursor.close()
        db.close()

Error:discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'main' is not defined

slate swan
#

Make the title msg a kwarg too, there's nothing much you can do

#

def(ctx, *, msg)
Then you will need the command invoker to add a delimiter in it too so that you can use it to split the msg parameter

#

Rip I'm bad at explaining

slate swan
slate swan
hoary cargo
slate swan
slate swan
#

lollllll

#

😭

#

language lol

hoary cargo
slate swan
#

😔

hoary cargo
#

Well I'm on my phone so MR_uncanny_9

slate swan
#

doesnt matter

slate swan
# hoary cargo Get better

My lack of understanding of what is happening prohibits me to snap myself out of my daze, I cant get better

#

read this

hoary cargo
slate swan
#

!rule 1

unkempt canyonBOT
slate swan
slate swan
#

inappropriate language

#

swearing falls into it

unkempt canyonBOT
#

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

slate swan
#

if you disagree i can ping mods?

#

they can and will tell you the truth

hoary cargo
unkempt canyonBOT
slate swan
#

im just saying if you dont think it falls into it i can ping them

#

and prove you wrong

hoary cargo
#

MR_uncanny_10 stop starting drama for some irrelevant bullshit

slate swan
unkempt canyonBOT
#

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

slate swan
#

<@&831776746206265384> @slate swan says that swearing doesnt fall into inappropriate language only pinged you guys since he isnt quite following rule 1

west escarp
#

That is what you are supposed to do, yes

slate swan
#

im just saying to follow the rules

west escarp
#

While swearing is not against our rules, excessive swearing, or at other users, falls under harassment and is not permitted

slate swan
#

still not good practice as many young developers come into this channel i we like to keep it civil

hoary cargo
#

The context was different

slate swan
#

doesnt matter

hoary cargo
#

NotStonks my respect for you

slate swan
#

i dont swear here

west escarp
#

@slate swan please back off, because you are causing a problem by prolonging this

slate swan
#

im just saying i like to keep this channel family friendly and theirs nothing wrong with that lol

west escarp
#

Then if it becomes a problem, contact @novel apex after maybe one attempt to resolve. It's been a few screens now.

slate swan
#

!rule 3

unkempt canyonBOT
#

3. Respect staff members and listen to their instructions.

hoary cargo
slate swan
west escarp
#

@hoary cargo that's also inappropriate

#

New topic, final warning for everyone here

#

.topic

lament depotBOT
#
**What's one feature you wish more developers had in their bots?**

Suggest more topics here!

cold sonnet
slate swan
#

say all you guys want but i go by the rules

slate swan
slate swan
daring olive
#

uhh

west escarp
#

...I've never heard of those

#

what is a "nuke template"?

cold sonnet
west escarp
#

and I've been around the block, I thought

ashen notch
#

!sshhhhhhhhhhhhhhhutthefuckup

cold sonnet
#

HUH

ashen notch
#

!shhhhhhhhhhhhhhhutthefuckup

unkempt canyonBOT
#

✅ silenced current channel for 15 minute(s).

ashen notch
#

I just need to make sure everyone is clear on something

#

Treat our staff with respect. If you disagree with a decision made, contact modmail. If you continue to harass our staff, there will be a problem.

#

Okay?

#

Okay

#

!unhush

unkempt canyonBOT
#

✅ unsilenced current channel.

slate swan
#

can you guys pls keep this discussion not against tos or against the rules?

daring olive
#

sure we'll do that

slate swan
#

Thank you mina

daring olive
#

what features are you guys working on today?

cold sonnet
#

birthday system!

daring olive
#

oh so the bot pings them a birthday message?

cold sonnet
#

yeah

daring olive
#

should have it include a birthday gif :)

cold sonnet
#

and it will be shown in the user profile

#

sure thing

slate swan
cold sonnet
#

bro that's nice

slate swan
#

yeah

slate swan
#

sure im working on akeno so go for it

daring olive
#

hm i heard of something called the tmdb api for movies

#

the movie database

slate swan
#

hey mina have you learned dpy yet?pithink

west escarp
#

IMDB has an API

unkempt canyonBOT
#

Qt Style Sheets support various properties, pseudo-states, and subcontrols that make it possible to customize the look of widgets.

daring olive
#

i made some contributions to our bots using dpy so that counts right? DogeKek

lyric tusk
#

how can i get a link to show content in a embed like that

slate swan
west escarp
slate swan
#

any website just look up on google hex codes

slate swan
unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

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

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
west escarp
slate swan
daring olive
umbral umbra
#

Hello can someone help me with this discord problem. First one main.py and the next picture is music.py import discord
from discord.ext import commands
import youtube_dl

class music(commands.Cog):
def init(self, client):
self.client = client

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

@commands.command()
async def disconnect(self,ctx):
await ctx.voice_client.disconnect()

@commands.command()
async def play(self,ctx,url):
ctx.voice_client.stop()
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': "-vn"}
YDL_OPTIONS = {'format': "bestaudio"}
vc = ctx.voice_client

with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(url, download=False)
url2 = info['formats'][0]['url']
source = await discord.FFmpegOpusAudio.from_probe(url2,
**FFMPEG_OPTIONS)
vc.play(source)

@commands.command()
async def pause(self,ctx):
  await ctx.voice_client.pause()
  await ctx.send("Paused")

  @commands.command()
  async def resume(self,ctx):
    await ctx.voice_client.resume()
    await ctx.send("resume")
west escarp
#

Also, the color numbers used are formatted like

#

0xRRGGBB in hex

#

except white.. which they treat as black.. (so lets ignorethat)

slate swan
daring olive
west escarp
#

0xFF0000 is red

west escarp
#

0xFFFF00 is yellow

#

You can literally just type it in like that:

slate swan
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)
west escarp
#

!e print(0xFFFF00)

unkempt canyonBOT
#

@west escarp :white_check_mark: Your eval job has completed with return code 0.

16776960
west escarp
#

or

#

!e print(hex(16776960))

unkempt canyonBOT
#

@west escarp :white_check_mark: Your eval job has completed with return code 0.

0xffff00
west escarp
#

to go the other way

slate swan
#

!pypi discordheximals i actually have a package with 742 colors that are methods that return hex codes

unkempt canyonBOT
slate swan
#

not trying to advertise but if anyone would like to use it its their lol

daring olive
#

@umbral umbrafyi like ashley said above, unfortunately we won't be able to help with such projects (using youtubedl or other projects that would break providers' ToS)

slate swan
# slate swan not trying to advertise but if anyone would like to use it its their lol

basic color codes

default = 0
teal = 0x1abc9c 
dark_teal = 0x11806a
green = 0x2ecc71 
dark_green = 0x1f8b4c
blue = 0x3498db 
dark_blue = 0x206694 
purple = 0x9b59b6 
dark_purple = 0x71368a 
magenta = 0xe91e63
dark_magenta = 0xad1457
gold = 0xf1c40f 
dark_gold = 0xc27c0e 
orange = 0xe67e22 
dark_orange = 0xa84300 
red = 0xe74c3c
dark_red = 0x992d22 
lighter_grey = 0x95a5a6 
dark_grey = 0x607d8b 
light_grey = 0x979c9f
slate swan
west escarp
#

asdf

cold sonnet
#

do with u

daring olive
#

asdf

cold sonnet
#

British docs

daring olive
#

is it really?

cold sonnet
#

yeah

#

!d discord.Colour.red

unkempt canyonBOT
#

classmethod red()```
A factory method that returns a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour") with a value of `0xe74c3c`.
west escarp
#

!d discord.Colour.red

unkempt canyonBOT
#

classmethod red()```
A factory method that returns a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour") with a value of `0xe74c3c`.
west escarp
#

wooooow

slate swan
#

aliases

#

Is it possible to make the value of the variable be saved, and after restarting the bot, it will have the same value that was before the restart? Sql databases

slate swan
vapid anchor
slate swan
cold sonnet
slate swan
cold sonnet
#

ofc

vapid anchor
#

wdym "adds the prefix 0x", that's literally just a way to represent a hexadecimal number

#

it has nothing to do with discord

slate swan
glacial kernel
#

Do you have some ticket-bot code?

slate swan
#

Is it possible to make the value of the variable be saved, and after restarting the bot, it will have the same value that was before the restart?

cold sonnet
vapid anchor
#

you don't have to

#

but you should everywhere, not just dpy

slate swan
#

New Conversation Topic: How are you still sane after using py-cord?

#

Okimii we need answers

#

never used pycord

slate swan
#

🗿

vapid anchor
#

it's really just a python feature, literally not a single thing to do with discord.py

vapid anchor
#

wdym how so. Literally just doesn't. idk what specifically is the thing that you would associate it with

slate swan
vapid anchor
#

idk

slate swan
#

maybe so it knows its a hexcode idk

vapid anchor
#

yeah that's what I'm saying, it's used to represent a hexadecimal integer

slate swan
#

yeah makes sense

vapid anchor
#

0x for hexadecimal, 0b for binary and 0o for octal

slate swan
vapid anchor
#

yeah wtf why is decimal such a shitty base

#

I'm wondering the exact same thing