#discord-bots

1 messages ยท Page 683 of 1

slate swan
#

!e py def fun(): return print('works') fun()

unkempt canyonBOT
#

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

works
upbeat otter
#

why not?

valid barn
slate swan
#

you dont have name as a key in the dictionary

maiden fable
#

hmm, cz I had to do await (await bot.fetch_channel(...)).send once on something similar

upbeat otter
maiden fable
#

@slate swan

slate swan
#

ah i c

upbeat otter
maiden fable
#

Nvm ignore me

slate swan
#

would this work

exec("@bot.event\nasync def on_ready():\n    await bot.get_channel(int).send('msg')")

?

#

๐Ÿ˜ this no doubt work

upbeat otter
slate swan
valid barn
#
shopp = [
  {"name":"something","price":3000},{"name": "some other thing", "price":2000}]``` @upbeat otter @slate swan
slate swan
#

fetch isnt async so you would need 2 awaits

slate swan
#

so hunter you are correct

#

index the list first

maiden fable
upbeat otter
#

anyways, imma keep quite

slate swan
#

i will now learn a bit more about sqls syntax later

maiden fable
#

Did I just... scrape google's homepage ๐Ÿ˜

slate swan
slate swan
valid barn
#
item = shopp[i]```
```py
name = item["name"]``` isnt it the same?
quaint epoch
slate swan
maiden fable
#

yea my console is filled with some garbage HTML now

valid barn
upbeat otter
quaint epoch
maiden fable
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

slate swan
craggy cloak
#

I always install pip install -U git+https://github.com/Rapptz/discord.py to use buttons but
When i restart my bot i always get the error module discord has no attribute ui

upbeat otter
#

@slate swan command idea

valid barn
slate swan
quaint epoch
upbeat otter
maiden fable
# slate swan wtf

it is a popular bot on discord with which I have had some.... horrible experiences in the past

#

soo uhhhh will be better not to make something like that

maiden fable
#

Was much more than that ๐Ÿคทโ€โ™‚๏ธ

#

Long story short, that bot sucks

slate swan
#

she took the kids..............

upbeat otter
quaint epoch
maiden fable
slate swan
#

ill make it better trust

quaint epoch
#

this is getting derailing pretty fast

upbeat otter
#

anyways

#

!ot

unkempt canyonBOT
maiden fable
slate swan
upbeat otter
quaint epoch
upbeat otter
#

I gave you multiple command ideas at once

slate swan
maiden fable
slate swan
#

ill be honest tho

quaint epoch
#

careful i had around 3-6 sets full of swear words for the bot to detect

slate swan
upbeat otter
maiden fable
#

Okay okay let's get back on topic

#

Better would be to delete this message, thanks (:

quaint epoch
maiden fable
#

before a mod sees it

quaint epoch
#

programmer humor

slate swan
#

๐Ÿšถ

maiden fable
#

Tried those, still sucked so uhhh

quaint epoch
slate swan
#

@quaint epoch what is this

client = discord.ext.commands.Bot(command_prefix='>>>', intents=intents)
slate swan
#

๐Ÿงโ€โ™‚๏ธ

maiden fable
#

LMAO

quaint epoch
#

I saw that on a tutorial

#

maybe i got it wrong lemme check again

maiden fable
#

Youtube?

quaint epoch
upbeat otter
slate swan
#

@quaint epoch wtf are those imports?

import random
import ctx
import disnake as discord
import Functions
import datetime
import subprocess
from datetime import datetime
import requests
import sys
import profanity
from profanity import profanity
import tracemalloc
import ctypes
from disnake.ext import commands
from datetime import datetime
maiden fable
#

And B A D

slate swan
#

ctx?

slate swan
maiden fable
quaint epoch
slate swan
#

its not lucas code for sure

sullen shoal
quaint epoch
sullen shoal
#

also that tutorial is bad and outdated

maiden fable
#

Ah I thought that was another Myxi

slate swan
quaint epoch
upbeat otter
# slate swan <@!879807617260716143> wtf are those imports? ```py import random import ctx imp...
import dpy
import pip
import asyncio
import general
import levelling
import imagecmds
import configfile
import mod
import server
import discord
from discord.ext import commands
import json
from googlesearch import search
from discord.ext import tasks
import os
from discord_components import Button, DiscordComponents, ButtonStyle
import random
import requests
import discordSuperUtils
from discord.utils import get
quaint epoch
#

i was playing around with pastebin api and stuff and didn't delete the imports afterword

upbeat otter
#

my imports

slate swan
slate swan
maiden fable
sullen shoal
quaint epoch
upbeat otter
quaint epoch
#

i never use them, ever

slate swan
#

mine

# all imports
import datetime
import disnake
import buttons
from disnake.ext import commands
from disnake import Intents
from disnake.ext.commands.cooldowns import BucketType
from googlesearch import search
import random
import filter
upbeat otter
slate swan
#

lol

#

also dont tell me you import your cogs and call the setup function manually

quaint epoch
#

then

slate swan
#
from disnake.ext.commands import Bot  , when_mentioned_or 
from disnake import (
    Message , 
    Intents ,
    AllowedMentions
)
from aiosqlite import connect 
from os import getenv 
```meh
upbeat otter
slate swan
slate swan
quaint epoch
#

i used datetime and the functions module here idk why they don't show up

upbeat otter
quaint epoch
slate swan
#
import disnake as discord

๐Ÿšถ

quaint epoch
upbeat otter
#

why would I import cogs

quaint epoch
#

i literally cannot go through all that effort again

slate swan
quaint epoch
upbeat otter
slate swan
quaint epoch
slate swan
#

i import cogs lmfao

upbeat otter
slate swan
#

cause my bots never find the cogs path

quaint epoch
#

shit my teacher was talking about Algae-BRUH and i wasn't paying attention

slate swan
#

so i import them

slate swan
sullen shoal
#
import discord as disnake```
slate swan
#

its wrong

#

i did that lol

quaint epoch
slate swan
quaint epoch
#

hahahahaha lmao funneh import go brrr

slate swan
#

just do

from os import *
upbeat otter
quick gust
slate swan
quaint epoch
quick gust
#

but faster...?

quaint epoch
#

search and replace = py import disnake as discord

quick gust
#

and with less effort

quick gust
quaint epoch
upbeat otter
quick gust
#

uh brainfart moment

quick gust
quaint epoch
quick gust
#

...

#

how come you not understand

maiden fable
#

what is even happening here

quick gust
#

0 iq stuff

quaint epoch
quick gust
#

lmfao

maiden fable
#

!ot exists for all these talks

unkempt canyonBOT
quaint epoch
west shuttle
#
await self.db.execute("Update thxcounter set thanks = thanks + 1 where user_id = ? and guild_id = ?", (member.id, ctx.guild.id))
await self.db.commit()

All good but the thanks set to 0

quaint epoch
#

k back to topic

upbeat otter
slate swan
#

I KEEP GETTING CONFUSED WITH SQL

quick gust
slate swan
#

asc decs is confusing ๐Ÿšถ

maiden fable
quick gust
quaint epoch
maiden fable
quick gust
slate swan
quick gust
#

yes now THIS is ot

quaint epoch
quick gust
#

!ot

unkempt canyonBOT
upbeat otter
#

and I have a question

quaint epoch
upbeat otter
#

if your talks are over

quaint epoch
slate swan
#

go already

maiden fable
slate swan
#

go guys help

#

๐Ÿงโ€โ™‚๏ธ

upbeat otter
#

How do I reconnect my bot like disconnect it and connect it again

maiden fable
#

automatically within seconds

quaint epoch
upbeat otter
upbeat otter
maiden fable
#

if

slate swan
maiden fable
slate swan
#

idrk

upbeat otter
#

nvm, i'll figure out myself

slate swan
#

yeah better idea

maiden fable
#

why u wanna hard reset it yourself tho

quaint epoch
#

what does client.connect() do?

upbeat otter
slate swan
#

why yes

slate swan
quaint epoch
#

i tried to that myself

maiden fable
#

If I were to hard reset my bot myself, I would waste more than 2 hours per day ;-;

upbeat otter
quaint epoch
#

i just settled on sys.exit() to close the bot, then maybe execute another file that waits a few second before sys.exit(), then run the bot file

maiden fable
slate swan
quaint epoch
#
async def restart_bot(ctx):
  exec('restart.py')
  sys.exit()
slate swan
#

not a bad idea

quaint epoch
#

then in restart.py: import asyncio async def restart(): await asyncio.sleep(10) exec('bot.py') print('restarted bot.py') sys.exit()

quaint epoch
boreal ravine
#

are you making a restart command or something?

quaint epoch
#

i suggested it for @upbeat otter , idk if it works

upbeat otter
#

yeah?

boreal ravine
#
import os

async def restart(ctx):
  await bot.close()
  os.system('python main.py')
``` easy
slate swan
#

=uptime

boreal ravine
#

Ghost ping

boreal ravine
#

im not sure if it'll work though

#

brb

#

uh the close thing works but the bot doesnt go back online ๐Ÿค”

tough lance
#

The bot closed but the script didn't

quaint epoch
#

i just tried the method i made, but it gives me this error-Traceback (most recent call last): File "C:\Users\shake\AppData\Local\Programs\Python\restart.py", line 11, in <module> exec(open('bot.py').read()) File "<string>", line 3, in <module> File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\__init__.py", line 23, in <module> from .client import * File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\client.py", line 25, in <module> from __future__ import annotations File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 945, in _find_spec File "<frozen importlib._bootstrap_external>", line 1430, in find_spec File "<frozen importlib._bootstrap_external>", line 1402, in _get_spec File "<frozen importlib._bootstrap_external>", line 1535, in find_spec File "<frozen importlib._bootstrap_external>", line 147, in _path_stat KeyboardInterrupt

#

i didn't do ctrl+c or anything

#

it decided to give me an error

slate swan
#

why does isinstance(member,discord.ClientUser) return False even if the member given is a ClientUser?

tawdry perch
#

you sure it is client user?

quaint epoch
simple gulch
#

I'm using this code on replit

from threading import Thread

app = Flask('')

@app.route('/')
def index():
  return render_template("filli.html")
  return render_template("index.html")


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

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

I want it to be able to allow the user to view a couple different html files, but I can only get it to show one. Is there any way for that or no?

upbeat otter
#
await ctx.send("Provide me with a title!", ephemeral=True)

why the heck does ephemeral gets rendered invalid ,-,

quaint epoch
#

wow question kamikaze

quaint epoch
tawdry perch
slate swan
slate swan
# tawdry perch you sure it is client user?

well yeah, after the check there's some code that requires the member to NOT be a ClientUser, and my code throws an error saying ClientUser object has no attribute "create_dm", even though the object has passed the check

simple gulch
slate swan
upbeat otter
slate swan
#

When a interaction is done

upbeat otter
slate swan
tawdry perch
slate swan
quaint epoch
slate swan
quaint epoch
upbeat otter
tawdry perch
#

bot.run()
bot2.run() ?

upbeat otter
tawdry perch
#

Hmm

upbeat otter
#

it will only trigger the first run

quaint epoch
#

i don't think so

upbeat otter
#

NO

slate swan
slate swan
#

member is bot object

quaint epoch
#

right?

quaint epoch
#

welp i have Algae-BRUH and imma carry my classmates

slate swan
slate swan
slate swan
#

not for me since I'm building something

#

and it makes more sense in the context

quaint epoch
#

you didn't show us how you got the user object so we would assume 'member' is a member object

upbeat otter
# slate swan why

single script for multiple bots has more downsides than ............smh nvm

slate swan
quaint epoch
upbeat otter
#

lol, why you guys fighting?

quaint epoch
upbeat otter
quaint epoch
slate swan
upbeat otter
quaint epoch
slate swan
slate swan
upbeat otter
quaint epoch
slate swan
maiden fable
upbeat otter
quaint epoch
upbeat otter
quaint epoch
#

brute force, just keep spamming different commands 'til you find a command that isn't defensively programmed

maiden fable
#

Bruh

slate swan
quaint epoch
#

tl;dr, running multiple bots at once isn't really good, but you could ahead and do that

upbeat otter
slate swan
upbeat otter
quaint epoch
maiden fable
#

Okay so what is even happening here? @slate swan what do u need help with?

slate swan
quaint epoch
slate swan
maiden fable
slate swan
slate swan
#

lol

slate swan
quaint epoch
maiden fable
#

continue kills the current iteration and starts the next iteration

quaint epoch
slate swan
jovial plover
#

Is it possible to have 2 rows and 2 columns with 4 fields?

maiden fable
#

!e

for num in range(0, 5):
    if num == 3:
        continue
    print(num)
unkempt canyonBOT
#

@maiden fable :white_check_mark: Your eval job has completed with return code 0.

001 | 0
002 | 1
003 | 2
004 | 4
maiden fable
#

See

maiden fable
jovial plover
#

I'm using that.

maiden fable
#

!d discord.Embed.add_field

unkempt canyonBOT
#

add_field(*, name, value, inline=True)```
Adds a field to the embed object.

This function returns the class instance to allow for fluent-style chaining.
jovial plover
#
        embedA = Embed(color=discord.Color.purple(),title=f"{ctx.author} - Payment Details")
        embedA.set_thumbnail(url=ctx.author.avatar_url)
        embedA.add_field(name="RSN",value="ok",inline=True)
        embedA.add_field(name="F2P World",value="ok",inline=True)
        embedA.add_field(name="Location",value="ok",inline=False)
        embedA.add_field(name="Combat Level",value="ok",inline=True)
      
        embedA.set_footer(text="We don't cover any transaction fees")
        
        await ctx.channel.send(embed=embedA)```
#

I want the last 2 embed field in the same "inline"

maiden fable
#

Seems like a discord issue tbh. it happens when fields don't fit together in a single line

tawdry perch
#

how is this possible to be done?

#

when clicked, this pops up

slate swan
maiden fable
#

in the OAuth2 Tab

tawdry perch
#

uu

slate swan
#

Not their just general

maiden fable
#

In App Modal or smth idr

tawdry perch
#

sadly my bot is not public but nice feature

maiden fable
#

Yea

quaint epoch
tawdry perch
#

sad, I know

#

I definitely wanted a bot to read me that

tawdry perch
maiden fable
#

yea

quaint epoch
tawdry perch
#

Just noticed that

maiden fable
hardy token
#

lol

quaint epoch
hardy token
#

huh

maiden fable
quaint epoch
#

what does the sloc thing mean?

tawdry perch
#

light mode on github?!

quaint epoch
#

btw it's browser even tho i have the desktop im just really lazy

maiden fable
#

source lines of code @quaint epoch

tawdry perch
quaint epoch
maiden fable
#

total lines including comments and todo's and stuff

tacit horizon
#

ah

slate swan
#

my bot wont reply to my commands anyone help?

sick birch
#

Do you have an on_message?

slate swan
slate swan
#

would that not work?

sick birch
#

This is Python

slate swan
tacit horizon
#
 await client.process_commands(message)    

put this ?

sick birch
#

Not JavaScript

tacit horizon
#

its java rip

slate swan
sick birch
tacit horizon
#

idk java

sick birch
#

Itโ€™s not Java

tacit horizon
#

javas

sick birch
crimson mural
tacit horizon
crimson mural
#

Anyone with ideas on what i have done wrong?

sick birch
#

Typescript?

tacit horizon
#

JavaScript

#

ahh u made me type ๐Ÿ˜ฃ

sick birch
#

Typescript is also JavaScript

slate swan
#

the id*

sick birch
#

Just strongly typed

crimson mural
#

that is the role id tho

slate swan
#

it must be an int?

#

!d discord.Guild.get_role

unkempt canyonBOT
sick birch
#

It has to be an int

slate swan
#

!ydtl

sick birch
#

We donโ€™t help with ytdl, it violates TOS

slate swan
#

my bad

craggy cloak
#

ok

slate swan
#

how do I fix redgifs not loading

slate swan
#

how do I count total members of all guilds combined

#

TypeError: list indices must be integers or slices, not str

#

show code

tawdry perch
#

Is the Cog loaded

cloud dawn
#

Morning yall

cloud dawn
cloud dawn
#

Have your debugged the command? Put in a print to see if it gets executed?

slate swan
cloud dawn
cloud dawn
#

Means it isn't used.

#

You are not allowed to ask this here please remove your message.

#

Nope you actually need ctx for the syntax

#

No where we don't allow anyone here to ask for paid work of any kind.

#

So, if you could delete it :3

cloud dawn
#

That's what we recommend.

cloud dawn
jovial plover
#

How to access roles of a user in on_raw_reaction_add event?

cloud dawn
jovial plover
#

Thanks

cloud dawn
#

DM for example will crash it.

jovial plover
#

What will crash?

cloud dawn
jovial plover
#

i see

cloud dawn
#

Disallow the cmd in DM or add a check for it.

velvet tinsel
#

pandabweer โค๏ธ

cloud dawn
daring olive
#

@slate swanhello, as other users stated, asking of offering paid work is against our #rules

velvet tinsel
#

mina being a moderator

cloud dawn
#

No mina is a human being.

daring olive
#

what's in that space

cloud dawn
#

This man invented a new kind of spoiler

velvet tinsel
velvet tinsel
daring olive
#

!raw 920763077392236554

unkempt canyonBOT
#
== Raw message ==

inside the spoiler there's a                                                                         lot of spaces
daring olive
#

o

#

i thought smth fancy

velvet tinsel
#

whats raw

daring olive
#

so for example

velvet tinsel
#

!raw 568276116062863405

unkempt canyonBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

daring olive
unkempt canyonBOT
daring olive
#

!raw 920763316362698794

unkempt canyonBOT
#
== Raw embeds (1/1) ==

description: [link](https://www.google.com/)
       type: rich
daring olive
#

ta-da

velvet tinsel
#

wow

sullen shoal
#

why does it take forever tho

velvet tinsel
#

amazing

daring olive
#

that idk. we've had some hiccups with bot this morning but idk if this is related.

velvet tinsel
#

mm

cloud dawn
sullen shoal
#

they gotta put that untrusted domain prompt

velvet tinsel
#

Log4j ๐Ÿ˜ณ

#

would be funny if discord actually used it

cloud dawn
velvet tinsel
#

wait, do they?

daring olive
velvet tinsel
#

that'll be cool

#

you'll have commands like !test id=123456789

sullen shoal
velvet tinsel
#

or !embed ["some text"](https://example/com)

#

then
eval ๐Ÿ˜ณ

cloud dawn
#

Small detail, but quite powerfull.

velvet tinsel
#

mwahahaha

sullen shoal
#

whats that shit

velvet tinsel
#

do you really need a """Sends a wonderful welcome message"""

#

you could just do # sends a wonderful welcome message

sullen shoal
#

what even is listeners

velvet tinsel
#

I was gonna ask the same thing

cloud dawn
velvet tinsel
sullen shoal
#

if its a third party extension, its in the right place

west shuttle
#

All works... but it doesnt show the number, any idea?

velvet tinsel
#

code

west shuttle
sullen shoal
velvet tinsel
#

hehe

#

I'm in danger

cloud dawn
west shuttle
# velvet tinsel code
thanks = await self.db.execute("SELECT thanks from thxcounter where user_id = ?",(member.id,))
        counter = await thanks.fetchall()
velvet tinsel
#

full code please

#

not just a segment

cloud dawn
velvet tinsel
#

tbf I wouldn't even have added any comments apart from listeners.Cog.listener() but ig thats uneeded

velvet tinsel
cloud dawn
velvet tinsel
#

wtf does db.execute do

west shuttle
velvet tinsel
velvet tinsel
cloud dawn
west shuttle
cloud dawn
west shuttle
cloud dawn
velvet tinsel
#

mongodb?

west shuttle
velvet tinsel
#

then which

cloud dawn
west shuttle
#

sqlite i guess

velvet tinsel
cloud dawn
west shuttle
#

ignore that

cloud dawn
#

Oh okay i guess

west shuttle
#

Lmao

velvet tinsel
#

lmao I guess

cloud dawn
west shuttle
velvet tinsel
#

maybe showing the full database

west shuttle
velvet tinsel
#

ok

#

so you got 1 thanks

west shuttle
#

yes

velvet tinsel
#

ok

#

do you have user_id somewhere

#

or maybe that's uneeded

west shuttle
cloud dawn
west shuttle
#

D:

cloud dawn
#

Well i know but we need to get some data first.

velvet tinsel
#

getting your ID gets your thanks afaik

#

also

#

I was gonna code a similar thing

#

but no db

#

๐Ÿ˜

#

JSON's my db

west shuttle
#

Same, Output []

cloud dawn
velvet tinsel
#

nar I dont need help

#

I havent had an error for a month

#

mom's gonna be so proud

cloud dawn
#

What datatype is user_id?

west shuttle
velvet tinsel
#

int

#

is user_id also an int

cloud dawn
west shuttle
#

well... igtg

#

sad

velvet tinsel
#

bye~

cloud dawn
velvet tinsel
#

how sweet and touching

cloud dawn
velvet tinsel
#

metaphorically

#

not physically.

cloud dawn
#

Oh okay

velvet tinsel
#

dont be dirty minded

cloud dawn
velvet tinsel
#

have a beer then

cloud dawn
kindred epoch
#

why does it show that int object is not subscriptable on this?

if cardcoins[0]['balance'] >= amount*100000:
#

anyone?

velvet tinsel
#

Hello

#

Show balance

#

In your thing

kindred epoch
slate swan
#

Ngl sql is very simple and goodpithink

spring hamlet
#

Can anyone help me code a bot ? Plesse dm me

slate swan
spring hamlet
#

I just need someone to code a bot for me

#

I find it to hard

slate swan
#

Not really hard

daring olive
slate swan
#

All you got to learn is asynchronous programming oop and basic python which we can deliver for you

daring olive
#

this server is for learning/teaching, not offering or asking for jobs

spring hamlet
slate swan
daring olive
#

!rule 9 it's one of our rules and we will enforce it

unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

spring hamlet
#

Who said itโ€™s paid lol

slate swan
#

Still not right

daring olive
#

ah yeah i'm referencing the other user in pygen that offered to do it for pay

spring hamlet
#

Okay sorry

daring olive
#

np!

slate swan
#

Is there a way to pull the source image from an emoji?

manic wing
#

not really

slate swan
#

yes u can

#

atleast on pc

manic wing
#

you cant pull the 'source image' per se

#

you can however get the url

#

which you can save as an image

#

!d discord.Emoji.url

unkempt canyonBOT
#

Sorry, an unexpected error occurred. Please let us know!

RedisSessionClosed: attempting to access connections pool after it has been closed.

manic wing
#

lol

#

!d discord.Emoji.url

unkempt canyonBOT
#

Sorry, an unexpected error occurred. Please let us know!

RedisSessionClosed: attempting to access connections pool after it has been closed.

final iron
#

Seems like something broke

manic wing
#

really? o.O

final iron
slate swan
#

in tryna make a discord bot

#

but it says this error

slate swan
#
    embed=discord.Embed(title="Shop", url="https://google.com", description="TEST", color=discord.Color.blue()())
TypeError: 'Colour' object is not callable

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Colour' object is not callable```
velvet tinsel
#

eh, that woks

velvet tinsel
unkempt canyonBOT
#

Sorry, an unexpected error occurred. Please let us know!

RedisSessionClosed: attempting to access connections pool after it has been closed.

velvet tinsel
#

lmao

velvet tinsel
#

๐Ÿ˜ญ

#

I'm blind

velvet tinsel
#

or use hex

slate swan
#

oh

#

Xd

#

also how do u format discord messages

#

like this

manic wing
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
#

Guys

#

I use asyncpraw

#

and only images load

#

videos not

#

how to fix it?

final iron
#

Do they have a support server?

#

Ah shit a special weather advisory in my area

vast gale
#
if TYPE_CHECKING:
    from enum import Enum
else:

    class Enum(metaclass=EnumMeta):
        @classmethod
        def try_value(cls, value):
            try:
                return cls._enum_value_map_[value]
            except (KeyError, TypeError):
                return value
#

WHY are you defining your own enum class

slate swan
#

ah

#

Yep

slate swan
slate swan
smoky olive
#
sync def picture(ctx):
    embed = discord.Embed(description="Picture")  # ,color=Hex code
    embed.add_image(url="https://imgur.com/a/6JdtJVd")
    return await ctx.send(embed=embed)

Sorry but why doesn't this work? I get an error, I just want a picture shown in an embed

manic wing
#

!d discord.Embed.set_image || set_image not add_image

unkempt canyonBOT
#

set_image(*, url)```
Sets the image 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 image.
smoky olive
#

gotcha, thanks

manic wing
#

almost needed an error there :o

smoky olive
#

It doesn't work ๐Ÿ˜ฆ I don't get an error but the picture just loads and loads

slate swan
smoky olive
#

like it doesnt depict the picture

slate swan
#

Yes it stays loading in preview try touching the image

#

So it will be full

smoky olive
#

thats what I typed

smoky olive
slate swan
smoky olive
smoky olive
manic wing
#

if you send it here and it doesnt auto convert to an image it wont work

smoky olive
#

I used a link which doesn't work lol so you wont see the picture

manic wing
#

you need to find a different image

smoky olive
#

soff image?

#

okay wait a sec

manic wing
#

you can test it - if you send it here and it converts to image it should work fine

smoky olive
manic wing
#

i think that would work

smoky olive
#

It works here but if I use it in my discord it will be in an infinite lopo

manic wing
smoky olive
#
@bot.command()
async def picture(ctx):
    embed = discord.Embed(title="New Moderator")
    embed.set_image(url="https://imgur.com/a/zV2FjsZ")
    return await ctx.send(embed=embed)
manic wing
#

idk

smoky olive
#

weird

kindred epoch
#

why does it show that int object is not subscriptable on this?

if cardcoins[0]['balance'] >= amount*100000:
smoky olive
#

I don't get it, this works for me:

sync def picture(ctx):
    embed = discord.Embed(title="Neuer Post!",    
description=str(medias[0].caption_text)).set_image(url=medias[0].thumbnail_url)
    await channel.send("@everyone\n", embed=embed)

but the other piece of code doesn't work

smoky olive
#

I figured it out

#

Can I center the title of an embed?

winged falcon
#

i have a question can dpy make bot advanced economy system like:
when the player use !transfer (the user)(the amount) the bot checks if he has the amount if he has enough the bot go to a roblox group (my roblox group) then transfer (the amount) to (the user) automatically and take a picture and put it in claim channel?

jade tartan
#

Hi is there any module thats for import error?

#
async def reload(ctx, *, msg ):
    if ctx.message.author.id == 506940530333057025:
        await ctx.message.delete()
        try:
            if os.path.exists("custom_cogs/{}py".format(msg)):
                client.reload_extention("custom_cogs.{}".format(msg))
            elif os.path.exists("cogs/{}py".format(msg)):
                client.reload_extention("cogs.{}".format(msg))
            else:
                raise importError("No module named '{}'".format(msg))
        except Exception as e:
            await ctx.send('Failed to reload module: `{}.py`'.format(msg))
            await ctx.send('{}: {}'.format(type(e).__name__, e))
        else:
            await ctx.send('Dev only')
sick birch
#

please code block this

#

Also no need to spam ping a random person

jade tartan
#

Hello

sick birch
#

Service depends on how well you ask a question, right now you're not doing a good job of it

jade tartan
#

he needs help fixing the rror @sick birch

#

error'

sick birch
#

Your issue is that you used discord.Client() rather than discord.ext.commands.Bot()

#

discord.Client() does not work with commands

#

That's discord.ext.commands.Bot()'s job

verbal cairn
#

anyone know bots with drop down menus

sick birch
#

Yes

#

Select menus are a special type of component similar to buttons

#

They're part of the bot UI kit

verbal cairn
#

well ik I have the github example rn

jade tartan
#

Hello someone plz

#

like bro

verbal cairn
#

but im trying to figure out how if I can edit the original message that has the dropdown menu on it

sick birch
sick birch
sick birch
#

It was my first and last contribution to the library before it shut down lemon_angrysad

verbal cairn
sick birch
#

oh yeah you gotta defer it first

sick birch
verbal cairn
#

in the command, or in the class

jade tartan
#
async def reload(ctx, *, msg ):
    if ctx.message.author.id == 506940530333057025:
        await ctx.message.delete()
        try:
            if os.path.exists("custom_cogs/{}py".format(msg)):
                client.reload_extention("custom_cogs.{}".format(msg))
            elif os.path.exists("cogs/{}py".format(msg)):
                client.reload_extention("cogs.{}".format(msg))
            else:
                raise importError("No module named '{}'".format(msg))
        except Exception as e:
            await ctx.send('Failed to reload module: `{}.py`'.format(msg))
            await ctx.send('{}: {}'.format(type(e).__name__, e))
        else:
            await ctx.send('Dev only')```
verbal cairn
#

what are u trying to do

sick birch
#

What's the problem

verbal cairn
#

ok but what are u expecting as a response

jade tartan
verbal cairn
#

whats ur client

#

copy paste the code its easier to read

#

client = commands.Bot(command_prefix="b!")

sick birch
#

and import commands

verbal cairn
#

make sure u also have from disnake.ext import commands

sick birch
#

from discord.ext import commands

verbal cairn
#

or whatever library

#

well are u using disnake or discord

#

then do robins

sick birch
#

it improves readability tenfold

verbal cairn
#

u can do bot.owner also instead of ur ID

#

client.owner for u ig

#

how to defer hm

sick birch
#

Can we see the full code?

verbal cairn
sick birch
#

Preferably with syntax highlighting and proper codeblocks

#

Like i said syntax highlighting and code blocks

verbal cairn
#
Code here...
jade tartan
#
async def reload(ctx, *, msg ):
    if ctx.message.author.id == 506940530333057025:
        await ctx.message.delete()
        try:
            if os.path.exists("custom_cogs/{}py".format(msg)):
                client.reload_extention("custom_cogs.{}".format(msg))
            elif os.path.exists("cogs/{}py".format(msg)):
                client.reload_extention("cogs.{}".format(msg))
            else:
                raise importError("No module named '{}'".format(msg))
        except Exception as e:
            await ctx.send("Failed to reload module: `{}.py`".format(msg))
            await ctx.send("{}: {}'".format(type(e).__name__, e))
        else:
            await ctx.send(f"Dev only")```
sick birch
#
import os
import discord
from discord.ext import commands
import csv
import random



client = commands.Bot(command_prefix="b!")


@client.event
async def on_ready():
    print(f"{client.user} logged in now!")




@client.command()
async def prefix(ctx):
    await ctx.send("the prefix for me is b!")



my_secret = os.environ['TOKEN']
client.run(my_secret)
#

Done it for you

#

name the variable bot instead of client

#

code LGTM, maybe the token isn't working properly

#

also pass in intents

#

then it's probably intents

jade tartan
#

So?

sick birch
#

Then include intents

sick birch
#

Also consider using f-strings

jade tartan
#

never i got in available channel someone there helped me out

sick birch
#

Gotcha

verbal cairn
#
@client.command()
async def reload(ctx, *, msg ):
    if ctx.message.author.id == client.owner.id:
        await ctx.message.delete()
        try:
            if os.path.exists(f"custom_cogs/{msg}py"):
                client.reload_extention(f"custom_cogs.{msg}")
            elif os.path.exists(f"cogs/{msg}py"):
                client.reload_extention(f"cogs.{msg}")
            else:
                raise importError(f"No module named '{msg}'")
        except Exception as e:
            await ctx.send(f"Failed to reload module: `{msg}.py`")
            await ctx.send(f"{type(e).__name__}: {e}'")
        else:
            await ctx.send(f"Dev only")
#

f strings easier to read

sick birch
#

Also less prone to you making mistakes

verbal cairn
#
    async def callback(self, inter: disnake.MessageInteraction):
        await inter.defer()
        await inter.edit_original_message(content="test")
#

nvm thats wrong

#

docs confuse me idk why

jade tartan
sick birch
#

you don't include the .py at the end

#

it's just the file name

winged falcon
#

i have a question can dpy make bot advanced economy system like:
when the player use !transfer (the user)(the amount) the bot checks if he has the amount if he has enough the bot go to a roblox group (my roblox group) then transfer (the amount) to (the user) automatically and take a picture and put it in claim channel?

sick birch
#

sure but you'd need to interact with the roblox api

#

which we don't support here

verbal cairn
#
    async def callback(self, inter: disnake.MessageInteraction):
        await inter.response.defer()
        await inter.edit_original_message(content="test")
sick birch
#

but on the discord side, yes you can

final iron
verbal cairn
#

woohoo, now I gotta screw shit up

winged falcon
winged falcon
jade tartan
sick birch
#

does the module have a setup() function?

jade tartan
#

WHat setup()function?

sick birch
#

All modules need a setup() function

#

It can't load it without it

verbal cairn
#

something like

def setup(bot: CustomBot):
    bot.add_cog(TasksCog(bot))
slate swan
#

Does anyone have codes for a standard bot with cogs, without any commands? Iโ€™m on a phone rn, takes too long time to write it.

jade tartan
#

Like this?

sick birch
#

right

verbal cairn
#

define ur bot smh

sick birch
#

typecasting it?

#

causes circular import so i wouldn't

#

main file imports cog file when you load it, cog file imports main file to typehint to bot class, circular imports = bad

verbal cairn
sick birch
#

you don't need it

rain olive
#

u leaked ur token?

sick birch
#

circular import is a python problem, not with the libraries

jade tartan
rain olive
jade tartan
#

So?

jade tartan
sick birch
#

writing code on mobile?

slate swan
sick birch
#

yikes

slate swan
#

Yes ik, works for test bots

small igloo
#

morning :3

#

uh, so why the frig it says that my coin is "[]"

small igloo
small igloo
slate swan
slate swan
#

I have a computer, but I use my phone

small igloo
#

then use it :l

slate swan
#

Because im in bed

#

Repl is easy quick and go service too, so really nice for night coding lol

small igloo
small igloo
slate swan
small igloo
slate swan
small igloo
slate swan
#

Okay

small igloo
jade tartan
#

Hey i need help with this

small igloo
jade tartan
slate swan
small igloo
jade tartan
#

not too sure

small igloo
#

also why CustomBot not used there

jade tartan
#

the person did the video didnt say

small igloo
jade tartan
#

My discord server โ–บ https://discord.gg/BN6WaDs
(If you have any questions or just want to have a chat with us)

(Some Cool Stuff)
Nertivia โ–บ https://nertivia.supertiger.tk/
My server in Nertivia โ–บ https://nertivia.supertiger.tk/invites/B4tMwO

Install discord.py โ–บ pip install discord.py or py -3 pip install discord.py
Discord.py documentation โ–บ...

โ–ถ Play video
jade tartan
small igloo
jade tartan
#

I dont know i am just trying to do a reload cmd so what i dont have to close vs code and restart it again

#

it could just get passed through a cmd

slate swan
#

You can remove custombot @jade tartan

#

And i doubt you have cogs in your main, so you do not need to add it to cogs, due to the main file being the source of cogs

jade tartan
slate swan
#

Yes, no need to use that in main

#

Only if you make another file outside main

jade tartan
#

Ohh so you make a cog like this hold upo

#

Like this?

slate swan
#

Yes

#

Do you not have a cog?

jade tartan
#

Nope lol

small igloo
slate swan
#

Then you do not need to add it to a cog that does not exist

jade tartan
#

OK ill add it then to the cog

#

when i do make it

small igloo
#

also someone know about mah prob

#

?

slate swan
slate swan
small igloo
#

bhre @visual island where r u

visual island
#

sleep..

small igloo
#

oh lol, ok ok sorry

#

~~ @upbeat otter maybe-~~

slate swan
#

is it possible to make a bot change a server name using discord.py?

slate swan
# small igloo there, result and code

Iโ€™m pretty sure the code you made is used to get options from a list that is not there, but I canโ€™t figure out how to solve this from only seeing this part of the code.

#

Canโ€™t say if iโ€™m right or not.

pliant gulch
#

!d discord.Guild.edit

unkempt canyonBOT
#
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., region=..., afk_channel=..., owner=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the guild.

You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission to edit the guild.

Changed in version 1.4: The rules\_channel and public\_updates\_channel keyword-only parameters were added.

Changed in version 2.0: The discovery\_splash and community keyword-only parameters were added.

Changed in version 2.0: The newly updated guild is returned.
slate swan
# small igloo waht

Okay so what I mean is that cur.fetchall() is suppost to get information from a list, but you donโ€™t have a list that the command can take from, then it will not show anything in the results.

#

That is what I think is happening with the code. I have no clue if Iโ€™m right or not, so Iโ€™m not the right one to help you.

slate swan
pliant gulch
#

You'd do name=...

#

And make sure to await it as it is a coroutine

slate swan
#

alright thanks

slate swan
#

With fetchall you are going to get every row in your db, but I assume you want to do only one of them, which is the person you want to know the coins of.

#

You might know that already, but just making sure.

slate swan
small igloo
slate swan
#

If you see here, you can see how this person did it.

#

Wait nvm

#

That one can make errors I see

#

so now that i have my code i cant get into the discord dev portal anymore like every time i login it takes me to browser discord anyone know how to fix?

slate swan
#

Here you see a example

pliant gulch
#

If you logged in before it shouldn't even prompt you to authorise

small igloo
# slate swan

so basically fetchall just for test exist or no????

slate swan
#

ah now it worked thanks

pliant gulch
slate swan
pliant gulch
slate swan
#

Yes it is

#

this is his code

#

oh nvm

pliant gulch
#

And are they sure they store NAME as USER#DISCRIM?

#

Because casting a User to str returns in that format, not just USERNAME

slate swan
#

So the whole code basically just wipes it self each time?

pliant gulch
#

I don't see the part where they wipe it each time

#

Although there is an un-needed commit in the code

#

As you are only doing a query to find stuff, not inserting stuff

slate swan
#

Not my code btw

#

@small igloo

small igloo
small igloo
pliant gulch
#

You sent the code of a command profile

pliant gulch
# small igloo what what

Like I said earlier, the query you do is only to find data, not to modify nor insert any data. Thus you have an un-needed commit

slate swan
#

so now the bot does everything but changes the name i put name= then a name it runs properly except for that

pliant gulch
#

And perhaps a traceback provided if there is one

slate swan
slate swan
slate swan
slate swan
pliant gulch
slate swan
#

@small igloo, try to bring the code to a expert that is in the server.

pliant gulch
# small igloo

How are you storing the NAME of the user? E.g what format is it inserted as

#

NAME#DISCRIM? NAME?

small igloo
#

uh

#

name#discrim

pliant gulch
# small igloo name#discrim

Can you try to do SELECT * FROM USERS_DATA and see if the name corresponding to the user is actually there?

#

Perhaps you didn't insert correctly, or inserted the wrong data

small igloo
pliant gulch
#

No, ctx.author is a User instance or a Member instance

#

But you cast ctx.author to str

pliant gulch
#

Which returns NAME#DISCRIM

small igloo
pliant gulch
#

No, you are already doing that in your code

#

If you don't believe me, print user inside of check_coin

small igloo
#

but when i add username, i not using str xd

pliant gulch
#

So when you are adding a new user to USERS_DATA you save the name not as a string??

small igloo
#

maybe that's my fault

pliant gulch
#

Can you show the code where you are actually inserting data into USERS_DATA

#

So that I can see what query you did

small igloo
#

k, wait

#

eh wait, i use str...?

#

will this help

pliant gulch
pale zenith
pliant gulch
#

iirc, and I'm not a huge expert, but column names are case-sensitive unlike many other things in the SQL Lang

pale zenith
#

hi

pliant gulch
#

Try selecting from users_data instead of USERS_DATA

#

Or otherwise, change the insert to insert into USERS_DATA, rather than the lowercased

small igloo
#

k, thanks

magic ore
magic ore
#

IDs don't get changed, usernames/discriminators can

pliant gulch
small igloo
#

wait, why still empty

pliant gulch
#

In general CBA to know all the inconsistencies, at least with case-sensitivity in SQL