#discord-bots

1 messages Β· Page 587 of 1

loud junco
#

or can i skip that

#

i just copy past manually

maiden fable
#

Repo means a repository

loud junco
#

what does that mean? backup?

maiden fable
#

😐

loud junco
#

a central location in which data is stored and managed. i googled this

maiden fable
boreal ravine
#

advertising

loud junco
#

so i copy paste my code in here?

boreal ravine
#

ban!!

loud junco
#

for me

boreal ravine
#

/j

loud junco
#

idk

#

im going to eat now i will go this later

maiden fable
maiden fable
boreal ravine
#

go this

#

🀧

solemn grove
#

Can I get some help?

maiden fable
#

@solemn grove

#

Do u have members intent?

tawdry perch
#

stolen message

maiden fable
#

Yea

#

Ik

tawdry perch
#

.topic

lament depotBOT
#
**Do you think there's a way in which Discord could handle bots better?**

Suggest more topics here!

tawdry perch
boreal ravine
#

!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").
shadow wraith
#

hey how in the world do you change a bot's presence status

#

here's my sample code of a bot.event on_ready thing:

@bot.event
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print('------')
    await bot.change_presence(game=discord.Game(name='!help'))
    print("Bot ready")```
#

this is my error

#

TypeError: change_presence() got an unexpected keyword argument 'game'

#

!d discord.Game

zealous gulch
slate swan
zealous gulch
#

What is the best library as for now? ;)

loud junco
#

im back

loud junco
shadow wraith
loud junco
#

;-;

slate swan
loud junco
#

how do i make a git repo

slate swan
#

as in like bot.change_presence(status=discord.Status.online, activity=discord.ActivityType.playing(name="!help"))

#

oh wait no

shadow wraith
loud junco
#

are u doing this for the 247?

slate swan
#

thats what it is

shadow wraith
#

lmao

slate swan
#

lmfao

shadow wraith
#

i forgot abt await

#

why are we all stupid

loud junco
#

oof

slate swan
#

for u its bot.change_presence

boreal ravine
shadow wraith
#

137 characters of code only to summon a presence in your discord bot, speechless...

slate swan
#

lol

loud junco
#

imma just skip this step

boreal ravine
#

πŸ‘

loud junco
#

:)

boreal ravine
shadow wraith
#

ye th ecode works thanks for hlrping killby

loud junco
#

changing from replit to heroku

loud junco
boreal ravine
loud junco
#

they say replit db noob

boreal ravine
loud junco
#

lol

#

thats why im switching

boreal ravine
#

does heroku have a db?

#

🀨

loud junco
#

idk

boreal ravine
#

so why are you changing then

loud junco
#

they say there is

boreal ravine
#

ah ok then

haughty sedge
#

how do i create a vc channel in a certain category with certain member limit and permissions

loud junco
#

i trust them 🀣

haughty sedge
loud junco
#

just do it with hand >:)

haughty sedge
#

bruh

#

im tryna create a feature

loud junco
#

lol

haughty sedge
#

ig I'll google lol

loud junco
#

true

#

stackoverflow

#

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

#

where is the python buildpack

#

alright i found it

slate swan
#

For their free plan

slate swan
slate swan
loud junco
#

where do i edit codes

loud junco
slate swan
#

Feeling useful 😌

loud junco
#

:)

slate swan
loud junco
#

=.=

slate swan
#

When ur done upload the code to github, then heroku will automatically pull the latest changes

loud junco
#

oo

#

but idk how to upload ;-; more google

#

:(

slate swan
#

??

loud junco
#

idk how to repo

#

what i do

#

import code?

haughty sedge
#

i googled couldnt find

#

just tell me how to create inside a category

#

and member limit

loud junco
#

idk

slate swan
#

\\\\\\

loud junco
#

i can edit codes in github right?

#

although it looks weird

boreal ravine
slate swan
#

Would very not recommend it tho

boreal ravine
loud junco
#

commit new file means save?

#

or save as a new file

boreal ravine
loud junco
#

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

tawdry perch
loud junco
#

idk

#

im asking

slate swan
#

Create a file, name it Procfile, and inside it should have worker: python main.py, you can change main.py to bot.py or whatever your main file that runs your got is

boreal ravine
#

@slate swan u use heroku right 🀨

loud junco
slate swan
boreal ravine
loud junco
#

what root =.=

slate swan
boreal ravine
loud junco
haughty sedge
#

is there something like client.get_category() ?

loud junco
#

add file?

boreal ravine
slate swan
#

Click Add file

tawdry perch
slate swan
#

And go look at some yt tutorials about it please

loud junco
boreal ravine
unkempt canyonBOT
haughty sedge
slate swan
boreal ravine
loud junco
#

i type worker: python main.py in there?

haughty sedge
slate swan
boreal ravine
slate swan
#

Is there a list of Discord.Color.***()

loud junco
#

like this?

haughty sedge
#

are you sure if i do client.get_channel() and enter id of a category it will work since category and channels are clearly different

loud junco
#

or here

sullen shoal
loud junco
boreal ravine
haughty sedge
haughty sedge
#

alright ty imma try

boreal ravine
#

Im certain

slate swan
sullen shoal
boreal ravine
#

a

slate swan
sullen shoal
#

ignore the ones starting with _

slate swan
#

alright :)

boreal ravine
#

dunder methods

loud junco
#

here or

boreal ravine
#

second one

loud junco
#

ok

boreal ravine
#

first one is for giving details about commits

dusk dust
#

"@commands.Cog.listener()" <- what's cog on this command line (im studying still)

mortal dove
#

Can I have some help with mute channel permission changes? This current line does nothing

mortal dove
#
await ctx.channel.set_permissions(target=ctx.guild.default_role, send_messages=False)
boreal ravine
loud junco
#

a requirements.txt where you have your requirements listed in newlines

unkempt canyonBOT
#

class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.

A cog is a collection of commands, listeners, and optional state to help group commands together. More information on them can be found on the [Cogs](https://discordpy.readthedocs.io/en/master/ext/commands/cogs.html#ext-commands-cogs) page.

When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta") are equally valid here.
loud junco
#

whats requirements.txt

dusk dust
boreal ravine
boreal ravine
slate swan
#

how do ping role with role id

boreal ravine
loud junco
#

isit ok if i use heroku even i dun open my laptop often

slate swan
#

where id is role id?

sullen shoal
#

ofc

loud junco
loud junco
#

a requirements.txt where you have your requirements listed in newlines

mortal dove
boreal ravine
boreal ravine
loud junco
#

how

boreal ravine
#

how?

loud junco
#

how to do it

#

create a new one?

boreal ravine
#

Just create it

#

🀨 🀧

mortal dove
loud junco
#

like how i create the other one?

slate swan
#

like this?

boreal ravine
loud junco
#

yes

slate swan
#

error

loud junco
#

when u hit enter it will change

boreal ravine
slate swan
loud junco
#

lol

#

dont do that

#

<@ + number + >

boreal ravine
boreal ravine
slate swan
#

right sorry

loud junco
mortal dove
boreal ravine
slate swan
boreal ravine
#

@mortal dove errors?

boreal ravine
mortal dove
#

None

loud junco
slate swan
slate swan
slate swan
#

Something like that yeah, but not that

slate swan
loud junco
#

import?

slate swan
#

Bruh

tawdry perch
#

isn't it great that you get again to go through this?

loud junco
#

=.=

slate swan
#

Nope I'm not helping, not gonna waste my time getting mad at it again πŸšΆβ€β™‚οΈ

loud junco
#

idk what to do

sullen shoal
# loud junco import?

lets say you have two modules, x and y are their names. so your file would look something like this:

x
y```
loud junco
#

i dun understand

loud junco
#

is this what i write

sullen shoal
#

not built-in ones

slate swan
sullen shoal
#

external libs

loud junco
#

import discord
import discord.ext.commands
import os
import random

i only have these in my code

tawdry perch
#

oh that sucks, have a break and focus on something completely else

slate swan
#

I don't generally help anyone who's new to coding at all anyways, it's just a big waste of my time and nerves

sullen shoal
#

put omly discord there

loud junco
#

ok

loud junco
slate swan
#

Β―\_(ツ)_/Β―

loud junco
#

where is the pencil lmao

#

am i blind or what

sullen shoal
#

no Procfile

loud junco
#

how do i reload the thing

#

so the new files will be detected

#

its a nightmare ;-; @maiden fable

tawdry perch
#

Go to deploy -> Enable automatic Deploys (scroll down the page)

loud junco
#

alright

maiden fable
#

Sorry dude, I can't really help anyone rn since I am getting a headache whenever I am seeing something in light mode ;-;

tawdry perch
#

good excuse

loud junco
#

light mode is very bad

loud junco
#

change it to dark mode then >:)

maiden fable
boreal ravine
#

:eyes:

tawdry perch
loud junco
#

nope

#

still not there

#

i enabled it

slate swan
#

Refresh the page

loud junco
#

i refreshed it

slate swan
#

Sometimes you have to refresh for it to appear

#

Did you deploy?

loud junco
slate swan
#

After enabling automatic deploys make sure you also click the deploy button

loud junco
#

ok

slate swan
#

Scroll a bit down and click deploy

loud junco
#

oo

#

still not there

tawdry perch
#

sounds like situation I had

loud junco
#

πŸ˜ƒ πŸ’₯ πŸ”« πŸ–οΈ

tawdry perch
#

pithink .

loud junco
#

yes

#

its there

#

how do i start the bot with heroku

#

deploy = start?

#

but heroku looks weird

#

replit is better =.=

spring obsidian
#

!pypi discord-ext-ipc

unkempt canyonBOT
tawdry perch
loud junco
#

im using back replit

#

heroku weird

spring obsidian
#

Yeah heroku is kinda weird

boreal ravine
#

its only weird if you dont know how to use it

#

Β―_(ツ)_/Β―

tawdry perch
#

this .

spring obsidian
#

!d discord.ext.commands.group

boreal ravine
#

!d discord.ext.commands.Group <=

unkempt canyonBOT
#

class discord.ext.commands.Group(*args, **kwargs)```
A class that implements a grouping protocol for commands to be executed as subcommands.

This class is a subclass of [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") and thus all options valid in [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") are valid in here as well.
dense swallow
#

anyone familiar with discord.ext.commands.HelpCommand ?

boreal ravine
#

yes

heavy folio
#

in what situations would HTTPException be raised for try excepts?

dense swallow
# boreal ravine yes

how do i unfilter a cog, part of my code:

        for cog, commands in mapping.items():
            if filtered_commands := await self.filter_commands(commands):
                amt_cmds = len(filtered_commands)
                usable += amt_cmds
                if cog:
                    name = cog.qualified_name
                    description = cog.description or "No description"
                else:
                    pass
dense swallow
#

yeah like show it on the actual help

boreal ravine
#

set the help command to that?

dense swallow
#

now it doesnt show that cog to whoever that doesnt have perms

boreal ravine
#

huh

#

I dont think it works like that

dense swallow
#

example:
im the owner/mod of server, so i can see the mod commands...

but regular users, cant see that cog

dense swallow
#

!d discord.errors.HTTPException

unkempt canyonBOT
#

exception discord.HTTPException(response, message)```
Exception that’s raised when an HTTP request operation fails.
boreal ravine
boreal ravine
#

check your code maybe u did smth wrong

dense swallow
boreal ravine
dense swallow
#

i'll send the whole one, irdk what i did wrong

boreal ravine
#

🀨 ..

dense swallow
#
    async def send_bot_help(self, mapping):
        ctx = self.context
        em = discord.Embed(
            title=f"{ctx.me.display_name} Help Menu",
            timestamp=ctx.message.created_at,
            color=bot.color
        )
        em.set_thumbnail(url=ctx.me.avatar_url)
        usable = 0

        for cog, commands in mapping.items():
            if filtered_commands := await self.filter_commands(commands):
                amt_cmds = len(filtered_commands)
                usable += amt_cmds
                if cog:
                    name = cog.qualified_name
                    description = cog.description or "No description"
                else:
                    pass
                em.add_field(name=f"{name} [{amt_cmds}]", value=description, inline=False)
        em.description = f"""{len(ctx.bot.commands)} commands | {usable} usable\n\nUse "help [command | module]" for more info\n`<>` required | `[]` optional"""
        await self.send(embed=em)
boreal ravine
#

well I dont know whats wrong

dense swallow
#

me too

boreal ravine
#

Β―_(ツ)_/Β―

dense swallow
#

it should show those cogs normally?

boreal ravine
#

yes ig

dense swallow
#

my friend also uses HelpCommand but he hard-coded those cogs

#

he typed out all the names of the cog.. im doing like this bcz i dont want to update it everytime when i make a new cog

dense swallow
#

yeah

rose shale
#

hii,i was tryin to make buttons for discordbot but i saw that Interaction type is removed from discord component, so what can i do to make buttons?

#

can anyone help

dapper cobalt
unkempt canyonBOT
rose shale
#

oh thanks

loud junco
#

what code do i write to get id from user

#
    if message.content.startswith('rpm hunt'):
        await show_hunt(message)
#

can someone add it in here?

brittle jay
#

message.author.id

boreal ravine
#

!d discord.Message.author use id attr

unkempt canyonBOT
loud junco
#
    if message.content.startswith('rpm hunt'):
        await show_hunt(message) 
        userid = message.author.id
boreal ravine
#

yes

loud junco
#

isit like this?

boreal ravine
#

yes

loud junco
#

where do i write that

boreal ravine
#

where you want

loud junco
#

idk where i need to write

#

i wanna make it an universal variable

stark bobcat
#

hi

loud junco
#

hi

stark bobcat
loud junco
#

πŸ’₯ πŸ”« lemon_cop

boreal ravine
unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

loud junco
#

add it above where

#

below import?

dapper cobalt
loud junco
#
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
#

will it work if i write like this

hasty loom
#

is ramnode a good vps?

boreal ravine
#

maybe

dapper cobalt
#

You used bot before defining it.

boreal ravine
#

he prolly had it?

loud junco
#

so u can still use it even its defined after it?

boreal ravine
#

wdym

dapper cobalt
#

It will not work, he defined bot at the end.

boreal ravine
#

oh

loud junco
#

i define bot at the last line of code

boreal ravine
#

didnt see;

boreal ravine
dapper cobalt
#

!e

print(name)
name = "Seif Wessam"
unkempt canyonBOT
#

@dapper cobalt :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'name' is not defined
waxen granite
#

how to convert datetime obj to str?

loud junco
#

newdatetime = str(datetime)
i guess

boreal ravine
ornate lichen
#

hi im using ms vs code

#

and its says that there is not module named discord

#

but i tried pip install discord

#

and it says requirement already satisfied

boreal osprey
#

did you do import discord

ornate lichen
#

yes

boreal ravine
ornate lichen
ornate lichen
ornate lichen
boreal ravine
#

press >

#

search python linter or smth

#

and click that

ornate lichen
boreal ravine
#

click the other python thigny

boreal ravine
ornate lichen
#

this?

boreal ravine
ornate lichen
#

ok

mild token
boreal ravine
#

^

mild token
#

Type python intreprer

ornate lichen
mild token
#

And select your python

boreal ravine
mild token
boreal ravine
#

what

#

hm

mild token
#

Linter is flake8

boreal ravine
#

ah

ornate lichen
#

yup done

boreal ravine
#

yeah @ornate lichen search interpreter or smth

ornate lichen
#

i select 3.1.10

boreal ravine
#

hm

ornate lichen
#

or smth like that

#

the reco one

mild token
#

Select 3.5 + one

ornate lichen
#

oh

mild token
mild token
ornate lichen
#

but i need one that is supported by heroku

mild token
boreal ravine
#

heroku doesnt support 3.8.9?

mild token
#

I think it does

ornate lichen
mild token
#

I recommend to focus on completing bot first then worry for its homeπŸ™‚

ornate lichen
mild token
ornate lichen
#

probably because i downloaded the 3.10 thingy python

mild token
#

It's restoring data from cache

ornate lichen
#

mhm

#

are there any free ways to host a bot

mild token
#

No unless u have friend who gives u hosting or host it for u

#

I recommend to not use heroku

ornate lichen
#

oh ok

#

what about aws

mild token
#

Yeh it will work

ornate lichen
#

1 year free i think

mild token
#

Yep

ebon plank
#

lol

#

yep it

ornate lichen
#

need help with one more thing

#

how do i solve this

boreal ravine
ornate lichen
#
def get_mean():

  url = "https://mashape-community-urban-dictionary.p.rapidapi.com/define"

  querystring = {"term":"wat"}

  headers = {
    'x-rapidapi-host': "mashape-community-urban-dictionary.p.rapidapi.com",
    'x-rapidapi-key': ""
    }

  response = requests.request("GET", url, headers=headers, params=querystring)
  json_data=json.loads(response.text)
  mean=json_data
  return(response.text)
boreal ravine
#

just use error param

mild token
#

Request will block your code

boreal ravine
ornate lichen
#
@client.command()
async def define(ctx,term):
  mean=get_mean
  await ctx.send(mean)```
ornate lichen
#

i did

#

i want to define somthing

boreal ravine
#

you didnt

#

yeah, call the function

mild token
#

Try response.content

#

Instead of text

boreal ravine
#

that isnt the problem though

#

he isnt calling the function

mild token
#

Yes

ornate lichen
mild token
#

He is printing the function

#

Instead of calling

boreal ravine
#

^

#

you need to call it

mild token
#

!e
def a():
print("b")
a()

covert palm
#

i m getting a rsponse from an API in [{},{}] form

unkempt canyonBOT
#

@mild token :white_check_mark: Your eval job has completed with return code 0.

b
covert palm
#

how can I parse that into a list ?

boreal ravine
ornate lichen
covert palm
ornate lichen
#

do i print the data?

boreal ravine
boreal ravine
ornate lichen
boreal ravine
mild token
covert palm
slate swan
covert palm
#

I do response.content

boreal ravine
#

!e

print(type([{}]))
unkempt canyonBOT
#

@boreal ravine :white_check_mark: Your eval job has completed with return code 0.

<class 'list'>
boreal ravine
#

already a list

ebon plank
#

yo

boreal ravine
#

yo

ebon plank
#

!e

unkempt canyonBOT
#
Command Help

!eval [code]
Can also use: e

*Run Python code and get the results.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*

ebon plank
#

pls help me

boreal ravine
#

your using on_command_error right?

mild token
#

I think he is trying to access data inside the list and then make it list

ornate lichen
ebon plank
#

!e Pythorn

unkempt canyonBOT
#

@ebon plank :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'Pythorn' is not defined
boreal ravine
#

well on_command_error takes 2 parameters (ctx, error) use error to get the missing permission idk if it works with missing perms though

ebon plank
#

hey can anyone help?

#

i am an newbie

boreal ravine
#

sure I guess

mild token
boreal ravine
mild token
ornate lichen
#
    ret = await coro(*args, **kwargs)
  File "/Users/aarav/Documents/GitHub/awaffle_bot/main.py", line 139, in define
    await ctx.send(mean)
  File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/abc.py", line 1065, in send
    data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
  File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/http.py", line 254, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 4000 or fewer in length.

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

Traceback (most recent call last):
  File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 4000 or fewer in length.```
#

im getting this noe

#

now

ebon plank
#

lol

ebon plank
#

anyone help me?

boreal ravine
mild token
ebon plank
#

dude

#

theres a error wait

mild token
#

He is sending more than 4000 char

ebon plank
#

let me show

boreal ravine
ornate lichen
ebon plank
#

i am a newbie who don't know pythorn

boreal ravine
#

response.text sends the website content iirc

mild token
ebon plank
#

but it shows like this

ornate lichen
boreal ravine
boreal ravine
mild token
boreal ravine
unkempt canyonBOT
#

Hey @ornate lichen!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

β€’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

β€’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

ornate lichen
#

yup i printed the data

mild token
boreal ravine
#

it isnt an async function innit?

boreal ravine
mild token
#

Ahh fair

ornate lichen
#

{"list":[{"definition":"The only [proper] [response] to something that makes absolutely [no sense].","permalink":"http://wat.urbanup.com/3322419","thumbs_up":3874,"sound_urls":["http://wav.urbandictionary.com/wat-25563.wav","http://wav.urbandictionary.com/wat-25758.wav","http://wav.urbandictionary.com/wat-32201.wav"],"author":"watwat","word":"wat","defid":3322419,"current_vote":"","written_on":"2008-09-04T02:15:08.000Z","example":"1: If all the animals on the [equator] were capable of [flattery], Halloween and Easter would fall on the same day.\r\n2: wat\r\n\r\n1: Wow your cock is almost as big as my dad's.\r\n2: wat\r\n\r\n1: I accidentially a whole [coke bottle]\r\n2: You accidentially what?\r\n1: A whole coke bottle\r\n2: wat","thumbs_down":439},{"definition":"Slang. Indicates [confusion] or a need for [clarification]. [Statement]/question.","permalink":"http://wat.urbanup.com/1308686","thumbs_up":1206,"sound_urls":["http://wav.urbandictionary.com/wat-25563.wav","http://wav.urbandictionary.com/wat-25758.wav","http://wav.urbandictionary.com/wat-32201.wav"],"author":"stewpidwhytemayun","word":"wat","defid":1308686,"current_vote":"","written_on":"2005-06-08T16:20:56.000Z","example":"1: \"[lolz] Yea sex is great and everything

#

this is some

covert palm
boreal ravine
#

im just helping

slate swan
#

Now you just have to index in some lists and some dicts

ornate lichen
#

oh ok

#

so i need to write down what components i want

#

?

slate swan
#

?

boreal ravine
ornate lichen
#

trivia=str(json_data["number"] )+ " -" + json_data["text"]

#

like this

#

this is another func

boreal ravine
#

why use another func

quaint radish
#

what ya need @boreal ravine

boreal ravine
#

just index the data

boreal ravine
mild token
#

Lol api reponse is funnyπŸ˜‚πŸ˜‚

#

Which api u r requesting

boreal ravine
ornate lichen
mild token
quaint radish
ornate lichen
boreal ravine
mild token
#

It's content is funny i mean

boreal ravine
quaint radish
#

busy rn lol

ornate lichen
#

any documentation on howto index data?

boreal ravine
boreal ravine
unkempt canyonBOT
#
Resources

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

mild token
slate swan
#

hi i have created a music bot but when i type the "join" command i'm getting this error in my console

Ignoring exception in command None:

boreal ravine
mild token
slate swan
mild token
#

But it sended my message after u

ornate lichen
#

how does that output work

#

why is it 3 and 0

slate swan
# boreal ravine show code

import discord
from discord.ext import commands
import DiscordUtils

client = commands.Bot(command_prefix='.', intents = discord.Intents.all())
Music = DiscordUtils.Music()

@client.event
async def on_ready():
print('ready')

@client.command
async def join(ctx):
await ctx.author.voice.channel.connect()
await ctx.send('joined')

@client.command
async def leave(ctx):
await ctx.voice_client.discord.disconnect()
await ctx.send('successfully left the vc')

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)
ornate lichen
slate swan
#

DiscordUtils uses youtube_dl

ornate lichen
#

so why is the output 3

mild token
#

If u read on same website

slate swan
#

It prints the index of where 4 is, such as 3

mild token
#

Index start from 0

slate swan
mild token
#

Then?

ornate lichen
#

oh ok

slate swan
#

The 3 is for the print above, the 0 is for the print below

ornate lichen
#

got it

#

cat is 0

#

on the second one

mild token
#

Bruh@slate swan

slate swan
#

It only outputs the first index found, never all

#

So not "3,0 because both have cat word"

ornate lichen
#

LOL

boreal ravine
#

why not just do normal list indexing

#

?

mild token
#

!e
l= ['a','b','a']
print(l.index('a'))

unkempt canyonBOT
#

@mild token :white_check_mark: Your eval job has completed with return code 0.

0
covert palm
#

timestamp in embed?

mild token
#

Β―_(ツ)_/Β―

covert palm
#

u pass it in the objec arguments//.?

boreal ravine
unkempt canyonBOT
#

@boreal ravine :white_check_mark: Your eval job has completed with return code 0.

c
boreal ravine
#

easier

slate swan
#

It's not the same

boreal ravine
#

saves 5 words 😱

upbeat otter
boreal ravine
slate swan
#

Yours prints the value at index, the example above prints at which index the value is

#

So you end up doing more if you use what you've given

boreal ravine
#

hm

ornate lichen
#

wait so

#
  t=Translator()
  a=t.translate(args,dest=lang)
  await ctx.send(a.text)```
#

i do smth like this

#

this is the translating func

boreal ravine
#

how is this related again

ornate lichen
#

oh wait

#

i need to index

#

not that

rotund nova
#

whats do here

ornate lichen
#

like this?

boreal ravine
boreal ravine
#

why not f"{json_data['word']} {json_data['definition']}" though

ornate lichen
#

i dont understand that

slate swan
#

!f-strings

unkempt canyonBOT
#

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

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

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

ornate lichen
#

oh

#

is it the formating thing in print

#

like that

boreal ravine
#

yes

#

3 ways of formatting strings iirc

#

%, str.format() and f-string's.

ornate lichen
#

its not working lol

#

Traceback (most recent call last):
File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/Users/aarav/Documents/GitHub/awaffle_bot/main.py", line 139, in define
mean=get_mean()
File "/Users/aarav/Documents/GitHub/awaffle_bot/main.py", line 79, in get_mean
mean=str(json_data["definition"])
KeyError: 'definition'

boreal ravine
#

definition doesnt exist

ornate lichen
#

i checked tho

boreal ravine
#

Β―_(ツ)_/Β―

covert palm
#

I need help

boreal ravine
#

sure

covert palm
#

I have this here

ornate lichen
covert palm
#

2021-11-08 14:19:03.801979

boreal ravine
covert palm
#

How do I add it in the footer, timestamp

ornate lichen
covert palm
#

I ve done that, but I get just the date not the time too

boreal ravine
covert palm
#

datetime_object = datetime.strptime(data["last_updated"], '%Y-%d-%m %H:%M:%S.%f')

ornate lichen
boreal ravine
unkempt canyonBOT
#

The timestamp of the embed content. This is an aware datetime. If a naive datetime is passed, it is converted to an aware datetime with the local timezone.

slate swan
covert palm
#

I just get the date

slate swan
#

i have a stupid in my brain

boreal ravine
#

use global

slate swan
#

what

pastel cobalt
#

How to remove an element from an array by index in mongodb with python?

slate swan
#

why global depress

normal folio
cloud dawn
unkempt canyonBOT
#

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

Instead of writing

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

do this instead

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

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

slate swan
cloud dawn
pastel cobalt
#

the databse contains elements from there i had to remove a specific index of the array element

cloud dawn
#

I only use SQL based syntax so i recommend going to #databases

pastel cobalt
#

oh ok thx

rotund nova
#
@bot.command(name='unban')
@commands.has_any_role("π™Šπ™’π™‰π™€π™ πŸ‘‘","πŸ”§β”‚Developer-dc","π™ˆπ™Šπ˜Ώ","π˜Όπ™™π™’π™žπ™£")
async def unban(ctx, *, member: discord.Member):

        bans = await ctx.guild.bans()
        member_name, member_id = member.split('#')
        
        for ban_entry in bans:
            user = ban_entry.user
            if (user.name, user.discriminator) == (member_name, member_id):
                await ctx.guild.unban(user)
                await ctx.send(f"Gracz {user} ZostaΕ‚ odbanowany przez {ctx.author.name}.")
``` its code
#

and i have error dont found user

normal folio
cloud dawn
normal folio
#

he has no brain (like he said)\

pastel cobalt
cloud dawn
#

Then i don't recommend coding a Discord bot.

#

Brain is needed, much priority.

slate swan
#

Hey everyone, I am making a public discord bot and my bot is in some servers im not in so is there a way to figure out what servers my bot is in?

normal folio
rotund nova
slate swan
#

that just prints the names, I would like it to make an invite

#

so i can join them

cloud dawn
cloud dawn
rotund nova
pastel cobalt
slate swan
normal folio
#

what if i just

cloud dawn
pastel cobalt
slate swan
#

do i ping a staff member?

cloud dawn
slate swan
#

πŸ‘

sage otter
rotund nova
#

i want unban using id

neat coral
#

So I made (or tried making) a simple Management bot.
Decided to implement a "warning" system.
Got it somewhat working, but when I check my own history with the command,
all the previous warns of other people show up and if I check their history,
it shows up as they don't have warns, even though they're clearly listed there
and picked up by the warn command

Here are some pictures of what I mean and some of the code:
async def warnings(ctx, Member : discord.Member): if Member is None: return await ctx.send("Please provide a user.") else: with open('warns.txt', 'r') as f: warns = f.read() if str(Member) in warns: await ctx.send(f"Showing warns for {Member.mention} || {warns} ") else: await ctx.send("This user has no warnings.")

cloud dawn
normal folio
neat coral
#

relatively new to this type of this, sorry if the code is horiffic

normal folio
#

lemme test

normal folio
rotund nova
# cloud dawn Paste the errors

File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
await self.prepare(ctx)
File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 706, in _parse_arguments
kwargs[name] = await self.transform(ctx, param)
File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 552, in transform
return await self.do_conversion(ctx, converter, argument, param)
File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 505, in do_conversion
return await self._actual_conversion(ctx, converter, argument, param)
File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 451, in _actual_conversion
ret = await instance.convert(ctx, argument)
File "C:\Python39\lib\site-packages\discord\ext\commands\converter.py", line 195, in convert
raise MemberNotFound(argument)
discord.ext.commands.errors.MemberNotFound: Member "787073733801410560" not found.

sage otter
rotund nova
#

but i want use this command using .unban id player

cloud dawn
rotund nova
#

i use id

slate swan
rotund nova
cloud dawn
#

!d discord.ext.commands.MemberConverter

unkempt canyonBOT
#

class discord.ext.commands.MemberConverter(*args, **kwargs)```
Converts to a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member").

All lookups are via the local guild. If in a DM context, then the lookup is done by the global cache.

The lookup strategy is as follows (in order)...
rotund nova
#

add this?

cloud dawn
rotund nova
slate swan
#

Original KEKL

rotund nova
sage otter
#

I don’t even know what you want anymore tbh. You’re saying you want to unban by I’d right? What I said checks out.

cloud dawn
slate swan
sage otter
#

have them pass in an id as command argument.

cloud dawn
sage otter
cloud dawn
rotund nova
#

im lost

cloud dawn
#

discord.Object is not meant to convert.

sage otter
#

And except a HTTPException and assume if that’s raised that user is invalid.

rotund nova
#

what to do, i got lost

sage otter
naive parcel
#

Hi

sage otter
#

I’m just telling him I’d he wants to unban by id. Than what I said in the most minimalist way to do it.

naive parcel
#

I'm looking for some discord Devs who can work with me ;_;

#

I'm doing a lil startup

#

I want Devs (no money but)

cloud dawn
sage otter
#

What’s the point in iterating over the ban list

rotund nova
#

w-what do

naive parcel
#

Anyone interested pls contact me

sage otter
#

He’s only doing that to match the username and discrim.

naive parcel
#

Bye have a good day

rotund nova
#

@sage otter add this? ctx.guild.unban(discord.Object(idhere))

cloud dawn
naive parcel
#

Where then

sage otter
#

If you want to only unban by id. Which I recommend.

naive parcel
sage otter
#

Then remove all that garbage that’s there and put that in. So yeah.

boreal ravine
#

just use discord.User

rotund nova
boreal ravine
#

🀧 🀧

rotund nova
# sage otter Then remove all that garbage that’s there and put that in. So yeah.
@bot.command(name='unban')
@commands.has_any_role("π™Šπ™’π™‰π™€π™ :crown:",":wrench:β”‚Developer-dc","π™ˆπ™Šπ˜Ώ","π˜Όπ™™π™’π™žπ™£")
async def unban(ctx, *, member: discord.Member):

        bans = await ctx.guild.bans()
        member_name, member_id = member.split('#')
        
        for ban_entry in bans:
            user = ban_entry.user
            if (user.name, user.discriminator) == (member_name, member_id):
                await ctx.guild.unban(discord.Object(idhere))
                await ctx.send(f"Gracz {user} ZostaΕ‚ odbanowany przez {ctx.author.name}.")
rotund nova
pastel torrent
#

Hello! Im running a bot with heroku. But gets certificate ver ify failed: unable to get local issuer certificate

#

how can i solve this?

rotund nova
#

ok\

sage otter
#

typehint member to int

#

And try except the unban

boreal ravine
#

imo its better

rotund nova
sage otter
rotund nova
#

try:
await ctx.guild.unban(discord.Object(idhere))

#

?

sage otter
rotund nova
#

what? int?

cloud dawn
boreal ravine
cloud dawn
rotund nova
boreal ravine
# cloud dawn No?

like if u use discord.Member and pass in an id as the arg it'll find the correct converter to use

rotund nova
#

?

boreal ravine
#

yes

rotund nova
#

And thats working?

sage otter
#

what’s the point of converting it’s just more work for the bot to do. If you have the id. Just unban it. There’s no need to convert

#

If the Guild.unban() raises an HTTPException just assume that id is invalid.

ornate lichen
#

File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'defin

mean=json_data["definition"]
i did this

boreal ravine
#

!resources learn how to index stuff properly

unkempt canyonBOT
#
Resources

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

ornate lichen
#

im using this

#

thrs a definition there

#

so why am i getting taht error

cloud dawn
#

And tbf with MemberConverter you look smarter

#

😌

ebon plank
#

dude

ornate lichen
rotund nova
ornate lichen
#

i switched to vscode

ebon plank
ornate lichen
#

keeps lagging

rotund nova
ornate lichen
#

and sometimes doesnt print the error

ebon plank
#

do you any other site where we can code bots with pythorn?

ebon plank
ornate lichen
ebon plank
#

so i can work on that

slate swan
#

Hey everyone, how do i restrict a command to a role

sage otter
# rotund nova

Remove member: discord.Member. And try and except it like I said.

ebon plank
#

and i am planning on a pythron bissness

rotund nova
#

already

ebon plank
#

but i am a newbie to pythorn

boreal ravine
sage otter
boreal ravine
#

nope

ebon plank
#

ok i'll be back

#

in 5 mins

slate swan
#

Hey, is there a way i can restrict a command permission to a role?

cloud dawn
ornate lichen
#

Ignoring exception in command define:
Traceback (most recent call last):
File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/Users/aarav/Documents/GitHub/awaffle_bot/main.py", line 141, in define
mean=get_mean()
File "/Users/aarav/Documents/GitHub/awaffle_bot/main.py", line 81, in get_mean
mean=json_data[list][0]["definition"]
KeyError: <class 'list'>

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

Traceback (most recent call last):
File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: <class 'list'>

rotund nova
ornate lichen
sage otter
rotund nova
# sage otter Try and except it
@bot.command(name='unban')
@commands.has_any_role("π™Šπ™’π™‰π™€π™ πŸ‘‘","πŸ”§β”‚Developer-dc","π™ˆπ™Šπ˜Ώ","π˜Όπ™™π™’π™žπ™£")
async def unban(ctx, *, arg: int):
    
                await ctx.guild.unban(discord.Object(idhere))
                await ctx.send(f"Gracz {user} ZostaΕ‚ odbanowany przez {ctx.author.name}.")
``` how?
sage otter
rotund nova
#

try:
await

#

?

boreal ravine
rotund nova
sage otter
#

try:
unban method
except HTTPException:
tell them it’s an invalid id

cloud dawn
sage otter
#

not really

#

That’s why I proposed discord.Object

cloud dawn
sage otter
#

because you don’t need the member object

ornate lichen
#

{"list":[{"definition":"The only [proper] [response] to something that makes absolutely [no sense].","permalink":"http://wat.urbanup.com/3322419","thumbs_up":3874,"sound_urls":["http://wav.urbandictionary.com/wat-25563.wav","http://wav.urbandictionary.com/wat-25758.wav","http://wav.urbandictionary.com/wat-32201.wav"],"author":"watwat","word":"wat","defid":3322419,"current_vote":"","written_on":"2008-09-04T02:15:08.000Z","example":"1: If all the animals on the [equator] were capable of [flattery], Halloween and Easter would fall on the same day.\r\n2: wat\r\n\r\n1: Wow your cock is almost as big as my dad's.\r\n2: wat\r\n\r\n1: I accidentially a whole [coke bottle]\r\n2: You accidentially what?\r\n1: A whole coke bottle\r\n2: wat","thumbs_down":439},{"definition":"Slang. Indicates [confusion] or a need for [clarification]. [Statement]/question.","permalink":"http://wat.urbanup.com/1308686","thumbs_u

#

why am is till getting all this

#

this is my code

sage otter
#

discord.HTTPException

#

And change the user name in the f string to arg

rotund nova
waxen granite
#

can embed title icon_url take links ?

boreal ravine
#

yes

rotund nova
waxen granite
# boreal ravine yes

icon_url="https://cdn.discordapp.com/attachments/826871393617969233/907286488469893140/1636384320707.png" this should work right?

boreal ravine
waxen granite
#

but isnt working

boreal ravine
#

hm

rotund nova
sage otter
rotund nova
ornate lichen
#

but im stillgrtting all that

sage otter
#

Jesus Christ

#

Why do you have the exception in the func signature

rotund nova
#

beacause u talk it

sage otter
#

no I didn’t bruh

sage otter
#

except discord.HTTPException

rotund nova
rotund nova
boreal ravine
rotund nova
#

okey

boreal ravine
#

remove the * from the command its useless

tame marsh
boreal ravine
#

stopped devlopment*

rotund nova
boreal ravine
rotund nova
ebon plank
#

hey anyone help me as guide? so i can code a bot in a site and btw pls say a site where i code pls @boreal ravine i think you can help me out?

boreal ravine
# rotund nova

print something at except to know that the id isnt a user

#

like "user does not exist" or something

ebon plank
#

pls say

#

your like my headmaster

boreal ravine
rotund nova
tame marsh
rotund nova
#

@boreal ravine good?

boreal ravine
boreal ravine
ebon plank
#

thx @boreal ravine

boreal ravine
#

it isnt banned or anything

rotund nova
boreal ravine
tame marsh
#

i thought it will be unusable after december... lol

ebon plank
boreal ravine
rotund nova
boreal ravine
tame marsh
#

ah

ebon plank
rotund nova
#

kekw, sorry

tame marsh
#

i dont want to get banned what which discord bot API would u recommend? For complicated stuff

rotund nova
#

@boreal ravine :/

slate swan
boreal ravine
rotund nova
#

its lines

ebon plank
#

is this video ok @boreal ravine? https://youtu.be/T5moR5gBlbM

In this video, we will create a Discord Bot with discord.py v1.7.3 in 2021. This is an updated version of the video where I showed how to do the same thing last year.

If you have any suggestions for future videos/doubts, leave it in the comments below. I might not be able to answer everyone but you can join my discord server for help: https://d...

β–Ά Play video
boreal ravine
ebon plank
#

ig means?

rotund nova
#

@boreal ravine what can i do?

boreal ravine
tame marsh
ebon plank
tame marsh
#

more then basic commands etc

tame marsh
#

but it should be able to performe complicated bot commands/events

boreal ravine
rotund nova
#

where?

boreal ravine
unkempt canyonBOT
boreal ravine
#

wtf

#

!npm

#

uh just google djs

boreal ravine
rotund nova
#

okay

tame marsh
#

i wanna do a complicated bot which will be a big project (im thinking of 1 or 2 thousend lines of code(or more))

ebon plank
tame marsh
#

which API should i use for that?

tame marsh
boreal ravine
tame marsh
#

which lib for the discord api

ornate lichen
ebon plank
tame marsh
ebon plank
#

so you can say me by share screen

#

-?

boreal ravine
ebon plank
#

-/?

boreal ravine
rotund nova
#

@boreal ravine working but dont send embed

ornate lichen