#discord-bots

1 messages · Page 491 of 1

reef mica
#

u cant make a thread or smthng?

jade jolt
#

while True is blocking

reef mica
#

how could I go around that then

#

beause I would like to be able to control from python console

jade jolt
#

why tho lol

reef mica
#

ultimate goal is to make an UI

#

but im far away from that

#

with my skills

#

im trying to learn

bitter perch
hasty iron
#

ui?

reef mica
#

GUI

hasty iron
#

yes i know

reef shell
#

I got a weird problem in vscode. It just keeps saying this after this line...

#

I'm indenting properly yet it shows error.

river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message
https://github.com/AA1999/Disthon

GitHub

Discord API wrapper for Python built from scratch. Contribute to AA1999/Disthon development by creating an account on GitHub.

reef shell
#

...

proud sierra
icy seal
#

@proud sierra please use range(lower_bound, upper_bound_excluded) instead of that lis

#

lower_bound is included and defaults to zero if only one arg is provided

#

seriously, that's a hate crime. anyways what's the error? it doesn't look like you've done import asyncio

boreal ravine
reef shell
#

it's gone

#

weird vscode

boreal ravine
#

hm

icy seal
#

So I've noticed that @unkempt canyon 's !d documentation refers to the master branch, whereas the latest update I get through pip is the stable branch - and there are breaking differences. Which should I be using? I thought development on discordpy had halted?

boreal ravine
#

!d discord.ext.commands.Bot

#

hm

icy seal
#

Yeah check the link, it refers to /en/master

hasty iron
#

yes it is

#

there are breaking changes

icy seal
#

Ah so the master branch is v2

hasty iron
#

yes

icy seal
#

Was that never officially released, since it's not a part of pip?

hasty iron
#

part of pip? its not released on pypi

icy seal
#

uh yeah pypi i meant

#

is it like a trusted and widely used fork? how come the documentation refers to it?

hasty iron
#

what fork?

#

0*

#

its on the master branch of the github

#

i dont get what you mean

icy seal
#

If the latest pypi release is 1.7.x, and development has halted, then surely 2 is never going to be released? Why is it the default for the bot's documentation? I just find that strange, but there may not be any definite answer

#

Like, does anyone use 2?

hasty iron
#

yes?

#

the bot's docs got changed just a few days ago

#

and i dont see an issue with it

#

you can still install 2.0

#

pip install git+<github url>

#

i dont see the issue here

icy seal
#

Maybe best to wait for someone who understands what I mean then.

hasty iron
#

i mean, yes 2.0 is probably never going to be released to pypi

quasi pawn
#

Hello, I'm trying to make a temporary text chat when someone joins a specific vc. How do I make it so that the text chat get's deleted when there are no users in the vc?

    async def on_voice_state_update(self, member, before, after):
        if member.bot:
            return

        if after.channel is not None:
            if after.channel.name == "☕・Quarter-05":
                await create_text_channel(after.channel.guild,'☕・Quarter-05 chat'.lower(), category_name='⎯⎯⎯⎯⎯ 🔒・Private  ⎯⎯⎯⎯⎯⎯' )
hasty iron
#

but that doesn't mean you cant install it

icy seal
quasi pawn
icy seal
#

should return from create_text_channel

#

(Wagiya)

slate swan
#

You can use db for store channels ids.

velvet crest
#

how can i get a list of unloaded cogs ?
apparently doin [cog for cog in bot.cogs]
return a list of loaded ones i need a list of unloaded ones

#

ping me with answer

maiden fable
hasty iron
#

you can subclass Bot and keep track of unloaded cogs yourself

#

for example have a list, append to it when unload_extension is called, remove from it when load_extension is called

lament mesa
#

if you have a list of all the extensions there is a way

#
all_cogs = ...
unloaded_cogs = set(bot.cogs.values()) | set(all_cogs)```
empty bolt
#

Hey Something's wrong here, when I send {prefix}youtube the bot isn't responding at all


async def youtube(ctx, *, search):
    await ctx.message.delete()
    query_string = parse.urlencode({'search_query': search})
    html_content = request.urlopen('http://www.youtube.com/results?' + query_string)
    search_results = re.findall('href=\"\\/watch\\?v=(.{11})', html_content.read().decode())
    await ctx.send('https://www.youtube.com/watch?v=' + search_results[0])```
#

still new

valid niche
flat solstice
#

How do I convert message.created_at to it's epoch version (I think that's why my issue lies) because this py plain = f"Sent <t:{int(message.created_at)}:R> by {message.author} in {message.channel.mention}\n\n>>>{message.content}\n\n[Jump to message]({message.jump_url})"keeps sayingpy TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'and my logs file is sayingpy ERROR:cogs.error_handler:TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime' (In quote) Traceback: File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/modmail/cogs/general.py", line 190, in quote plain = f"Sent <t:{int(message.created_at)}:R> by {message.author} in {message.channel.mention}\n\n>>>{message.content}\n\n[Jump to message]({message.jump_url})"

hasty iron
#

its message.created_at.timestamp()

flat solstice
#

ahhh

hasty iron
#

!d datetime.datetime.timestamp

unkempt canyonBOT
#

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

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

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

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

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

thanks blanket

floral raptor
#

guys, how can i know the MissingPermissions is for the bot or for the ctx.author?

flat solstice
flat solstice
valid niche
floral raptor
# flat solstice what error is the bot giving? can you copy paste it here
Ignoring exception in command kick:
Traceback (most recent call last):
  File "C:\Users\moon\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\moon\OneDrive\Coding\Python\dis-bot\cogs\commands\kick.py", line 15, in kick
    await user.kick(reason=reason)
  File "C:\Users\moon\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\member.py", line 568, in kick
    await self.guild.kick(self, reason=reason)
  File "C:\Users\moon\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\guild.py", line 1997, in kick
    await self._state.http.kick(user.id, self.id, reason=reason)
  File "C:\Users\moon\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
  File "C:\Users\moon\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\moon\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\moon\AppData\Local\Programs\Python\Python39-32\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: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
#

this is the full traceback

#

!traceback

valid niche
flat solstice
#

well hopefully sebkuip's answer helped

floral raptor
#

its

#

Missing Permissions

valid niche
#

which is bot missing permissions

floral raptor
floral raptor
#

?

valid niche
floral raptor
#

i tried this

#

its except all errors

valid niche
#
try:
  # stuff you don't have permission for
except discord.Forbidden:
  # you don't have permission
flat solstice
#

why does py <t:{message.created_at.timestamp()}:R>render as <t:1631821395.943:R>in the bots msg and not as a timestamp

flat solstice
#

it's odd, bc from what I understand it should work

#

oh maybe i'm missing some ( )

spring flax
#
<t:{int(message.created_at.timestamp())}:R>
flat solstice
# spring flax make the timestamp an int

yeah it's not liking thatpy TypeError: 'datetime.datetime' object is not callable py plain = f"Sent <t:{int(message.created_at().timestamp())}:R> by {message.author} in {message.channel.mention}\n\n>>>{message.content}\n\n[Jump to message]({message.jump_url})"

spring flax
#

this is on_message event right

flat solstice
#

ah I still have some ( ) in mine, guess i'll remove em

flat solstice
spring flax
flat solstice
#

okay they gone and it works

hoary gust
#

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

urban sphinx
#
@client.command()
@commands.has_permissions(manage_messages = True)
async def remove(ctx, *content):
    
    with open('links.json', 'r') as f:
        links = json.load(f)

    links[str(ctx.guild.id)] - content

    with open('links.json', 'w') as f:
        json.dump(links, f, indent=4)

i am very new to python, so i have little to no knowledge over python so im sorry for asking help on such a simple thing

#

i want to remove the content provided from the .json file

#

but i do not know how

lament mesa
#

open('links.json', 'w').close()

slate swan
#

does discord bot run multiple funtctions at once or 1per

lament mesa
#

1 at a time

#

thats how concurrency works

hasty iron
#

1 at the time is concurrency?

lament mesa
#

but while 1 function is executing other functions can execute

lament mesa
flat solstice
#

Does d.py support bot proxies so one bot can log into and act as another bot? I was reading some slask and Reddit posts that said that it had been possible but that it was no longer possible due to d.pys pocie system not being compatible with aiohttp and that it requires Https connections or something

leaden anvil
#

Ok I want to format my button like this here is the code: py await ctx.channel.send(embed=report,components=[Button(style=ButtonStyle.red, label="No", custom_id="n"), Button(style=ButtonStyle.green, label="Yes", custom_id="y")])

urban sphinx
#

is that

#

dank memer

leaden anvil
#

the output of the code is this

leaden anvil
# urban sphinx dank memer

yes but although I want the format of the buttons to be like it but its for a completely different purpose

river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message
https://github.com/AA1999/Disthon

GitHub

Discord API wrapper for Python built from scratch. Contribute to AA1999/Disthon development by creating an account on GitHub.

boreal ravine
#

Why isn't this working?

for roles in ctx.guild.roles:
  rola = []
  rola.append(roles)
  await ctx.send(", ".join(rola))
lament mesa
#

roles is not defined

spring flax
#

there are other ways

#

to do that

#

like

lament mesa
#

you can just do py await ctx.send(", ".join(r.name for r in ctx.guild.roles))

spring flax
#

yep

spring flax
#

though it is, at least for me, better if you make an embed, and send the role mentions

lament mesa
#

and also there is allowed_mentions

boreal ravine
#

also it pinged @everyone 😔

lament mesa
#

lol rip

spring flax
#

this is to remove the @everyone.

boreal ravine
#

hm ok

boreal ravine
ionic wadi
spring flax
#

oops

boreal ravine
#

owo

spring flax
#

!e
roles = ['a', 'b', 'c']
print(roles[1:])

unkempt canyonBOT
#

@spring flax :white_check_mark: Your eval job has completed with return code 0.

['b', 'c']
boreal ravine
#

thanks!!

ionic wadi
#

I mean cog*

river walrus
grim oar
#

typethon

river walrus
grim oar
#

Typethon

waxen granite
#
    guild = self.bot.get_guild(int(key))
ValueError: invalid literal for int() with base 10: 'member_count'```
what does this mean?
river walrus
grim oar
#

you are passing 'member_count' to int()

#

pass a valid ID to int() (if it's not integer)

cloud dawn
#

!e int('member_count')

unkempt canyonBOT
#

@cloud dawn :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | ValueError: invalid literal for int() with base 10: 'member_count'
cloud dawn
#

Most likely this is a dict so you'd need to get the value

waxen granite
#

this is my json content

#

guild key is 8243...

cloud dawn
#

That are a lot of members

grim oar
#

Your naming is bad

waxen granite
#

ye ik and thats a channel id not members

cloud dawn
grim oar
waxen granite
cloud dawn
grim oar
#

Can you show your key variable @waxen granite

waxen granite
#
    async def statscounter(self):
        for key in self.serverstats.keys():
            guild = self.bot.get_guild(int(key))
            print(key)
        try:
            server_stats = self.serverstats[str(guild.id)]
        except KeyError:
            server_stats = {}
        category = discord.utils.get(guild.categories, name="STATS")
        botcount = 0
        membercount = 0
        members = guild.members
        textchannelscount = len(guild.text_channels)
        voicechannelscount = len(guild.voice_channels)
        for member in members:
            if member.bot == True:
                botcount += 1
            else:
                membercount += 1
        users_text = f"Users: {membercount}"
        bots_text = f"Bots: {botcount}"
        channels_text = f"Text Channels: {textchannelscount}"
        channels_voice = f"Voice Channels: {voicechannelscount}"
        tier = f"Premium Tier: Level {guild.premium_tier}"
        uc = guild.get_channel(server_stats['member_count'])
        bc = guild.get_channel(server_stats['bot_count'])
        tc = guild.get_channel(server_stats['text_count'])
        vc = guild.get_channel(server_stats['voice_count'])
        pt = guild.get_channel(server_stats['tier'])```
#

it prints the key

#

when i am running it on my pc

#

but on host it gives that error :3

grim oar
#

serverstats is probably the guild Id

waxen granite
#

ye

grim oar
#

it's wrong then, you are iterating over the inner dict

waxen granite
#

hm

slate swan
#

How can I install all modules in 1 time?

valid niche
#

could you elaborate on your question?

slate swan
#

uhh

#

sec

#

Hello help pls...

I found out how to change a permision to False or True in a Role but how to set a permission to default?

#

.dpy

slate swan
# valid niche uh?

like this
import discord
How do I install that and all other? Whats the command for that to install in 1 time

#

I know

proud sierra
slate swan
#

import module1 abc hhh

#

Just whitespace

slate swan
#

ty

proud sierra
brazen raft
#

or maybe actually use PyCord with pip install -U py-cord
it's a fork so everything looks the same as in discord.py for now

boreal ravine
#

hm

slate swan
#

guys, if i host my bot on my computer, does it return back my c disk space after stopping it?

valid niche
#

and that's just sitting there

#

it doesn't care if it's running or not

slate swan
#

yes, but when its running

valid niche
#

that's not how storage works

slate swan
#

it slowly drains my c drives disk space

#

so im asking if it returns the disk space after stopping it

brazen raft
slate swan
brazen raft
#

Other than that, shit happens using your computer's RAM.

slate swan
#

oh wait

#

virtual ram

#

oh crap then

#

how much virtual ram should i have

brazen raft
#

RAM is not where files are saved.

slate swan
#

i only have 4gb ram

brazen raft
#

That's fine.

#

It will probably never need more than 100 megabytes of RAM.

river walrus
grim oar
#

Typethon

slate swan
#

hey guys, how many ram does a bot take to run itself?
for me, the bot is light
i only have 4gb ram so i wanna have the exact amount to adjust my virtual ram amount to run it on my computer, it is not really convenience to just copy pasting code into repl.it because its really annoying
thanks!

pliant gulch
#

4gb ram is def overkill

#

for at least a light bot, depends on the member cache size I'd say

valid niche
#

depending on your size of bot, max like a few gigabyte

slate swan
#

ah

#

i have 6.5mb virtual ram

#

along with vscode, firefox and discord

#

those apps only will take 4gb+

waxen granite
#

can we add 2 or more perms as True in .has_guild_permissions?

river walrus
slate swan
timber lark
#

hello i have a problem with a levelling bot

#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed: Embed size exceeds maximum size of 6000
valid niche
#

your embed is too big

#

there's too many characters

timber lark
#

i know but look the code

#
    @commands.command()
    async def rank(self, ctx):
        if ctx.channel.id == bot_channel:
            stats = leveling.find_one({"id" : ctx.author.id})
            if stats is None:
                embed = discord.Embed(description="Tu n'as pas encore de level !")
                await ctx.channel.send(embed=embed)
            else:
                XP = stats["XP"]
                lvl = 0
                rank = 0
                while True:
                    if XP < ((50*(lvl**2))+(50*lvl)):
                        break
                    lvl += 1
                XP -= ((50**((lvl-1)**2))+(50*(lvl-1)))
                boxes = int((XP/(200*((1/2) * lvl)))*20)
                rankings = leveling.find().sort("XP",-1)
                for x in rankings:
                    rank += 1
                    if stats["id"] == x["id"]:
                        break
                embed = discord.Embed(title="{} level stats".format(ctx.author.name))
                embed.add_field(name="pseudo", value=ctx.author.mention, inline=True)
                embed.add_field(name="XP", value=f"{XP}/{int(200*((1/2)*lvl))}", inline=True)
                embed.add_field(name="Rank", value=f"{rank}/{ctx.guild.member_count}", inline=True)
                embed.add_field(name="Progression", value=boxes * ":blue_square:" + (20-boxes) * ":white_large_square:", inline=True)
                embed.set_thumbnail(url=ctx.author.avatar_url)
                await ctx.channel.send(embed=embed)
valid niche
#

so many emoji's ohno

timber lark
#

Where ?

valid niche
#

you know that emoji's take up a TON of characters?

timber lark
#

this is a bar progress

valid niche
#

ye

#

and that's quite a few emoji's

#

and emoji's take up a LOT of characters

timber lark
#

owww okay I see

#

i deleted and saw that my xp is negative and it is too big

summer flume
#

how can I do that if I choose 10 winners, to not pick the same user?

grim oar
#

Make a list, add the user to list if that user is not in the list

#

That's a general idea, do however you like

summer flume
#

ok thanks

gritty flame
#

would this work

hasty iron
#

tias

waxen granite
#
    @tasks.loop(minutes= 30)
    async def statscounter(self):
        for key in self.serverstats.keys():
            guild = key
        try:
            server_stats = self.serverstats[str(guild)]
        except KeyError:
            server_stats = {}
        category = discord.utils.get(guild.categories, name="STATS")
        botcount = 0```
in `category = discord.utils.get(guild.categories, name="STATS")` says str obj has no attribute categories. how should i get the categories then ?
unkempt canyonBOT
#

random.choices(population, weights=None, *, cum_weights=None, k=1)```
Return a *k* sized list of elements chosen from the *population* with replacement. If the *population* is empty, raises [`IndexError`](https://docs.python.org/3.10/library/exceptions.html#IndexError "IndexError").

If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum\_weights* sequence is given, the selections are made according to the cumulative weights (perhaps computed using [`itertools.accumulate()`](https://docs.python.org/3.10/library/itertools.html#itertools.accumulate "itertools.accumulate")). For example, the relative weights `[10, 5, 30, 5]` are equivalent to the cumulative weights `[10, 15, 45, 50]`. Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work.
waxen granite
maiden fable
#

Ah, I was finding that

maiden fable
waxen granite
maiden fable
#

?

slate swan
valid niche
maiden fable
#

I never read anything

waxen granite
maiden fable
summer flume
maiden fable
summer flume
#

yes, I know the random.choice thing

maiden fable
#

random.choices*

waxen granite
summer flume
waxen granite
#
    async def statscounter(self):
        for key in self.serverstats.keys():
            guild = self.bot.get_guild(int(key))
        try:
            server_stats = self.serverstats[str(guild)]
            print(server_stats)
        except KeyError:
            server_stats = {}
        category = discord.utils.get(guild.categories, name="STATS")
        uc = guild.get_channel(server_stats['member_count'])```
gives keyerror 'member_count' but i have it here
slate swan
#

bc your try/except got a KeyError exception and made an empty dict for server_stats

waxen granite
#

but it printed server_stats

slate swan
#

maybe worked for the first few ones but what about the rest

#

what exactly is self.serverstats defined as

waxen granite
#

with open("./botFiles/stats.json", "r") as f: self.serverstats = json.load(f)

slate swan
#

and what do u have in that stats json

waxen granite
#

the pic i sent above

#

ty

#

fixed it

lyric moat
#

how i make a embed create command?

gritty flame
#

why wont this check work.

lyric moat
#

like this

gritty flame
#

yeh use wait_for function

#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
lament mesa
gritty flame
#

can anyone hel[

lyric moat
#

how i make a Embed creator command?

gritty flame
#

i just showed u

crimson tendon
#

does anyone works on the future of discord.py or is it "dead" ?

lyric moat
gritty flame
#

yes

gritty flame
slate swan
#

hey, how do i make the emoji stealing command?

#

import datetime

#
from discord.ext import commands
import aiohttp
import os
import random

class ImageSearch2(commands.Cog):
  
    def __init__(self,client):
      self.client = client

      self.client.ses=aiohttp.ClientSession()

    @commands.command()
    async def image(self,ctx,*,search):
      search = search.replace(' ','')
      url =f'https://api.unspalsh.com/photos/random/?query={search}&orietation=squarish&content_filter=low&client_id={unsplash}'
      async with client.ses.get{url} as r:
        if r.status in range(200,299):
          data = await r.json
          mbed = discord.Embed(
            title = 'Here is your image'
          ).set_image(url=url)

        else:
          await ctx.send(f'Error when making reuest.{r.status}')
def setup(client):
  client.add_cog(Chatbot(client))``` I am receiving syntax error pls help
boreal ravine
#

@potent jetty Its datetime.datetime

slate swan
unkempt canyonBOT
#

await create_custom_emoji(*, name, image, roles=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

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

There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.

You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
slate swan
slate swan
#

Must be py datetime.datetime.now()

#

Or utcnow() as you use

lament mesa
#

do datetime.datetime.utcnow()

boreal ravine
#

try using the var u made?

lament mesa
slate swan
#

!epy import datetime print(datetime.datetime.now())

reef shell
#

Syntax error

slate swan
#

yeah but idk what to do

grim oar
#

my bad

reef shell
grim oar
#

Yes

reef shell
#

Idk what lib r u using

slate swan
boreal ravine
#

aiohttp I guess

reef shell
#

No prolly

slate swan
grim oar
#

that's not valid in any case

reef shell
#

ClientSession as ses

slate swan
reef shell
#

Smthng like this

boreal ravine
#

🧐

slate swan
boreal ravine
#

Manually in the shell

slate swan
#

can i have the command please :3?

#

i mean the console thingy

boreal ravine
#

I forgot how but you can google "How to update to nodejs 16 on replit"

slate swan
reef shell
#

Node js for what

boreal ravine
hasty iron
#

ah yes the classic, nodejs help in a python server

reef shell
#

Same q

boreal ravine
slate swan
#

hey have someone here a mute command src?

hasty iron
#

are you using 2.0?

reef shell
boreal ravine
#

try x - joindate?

slate swan
hasty iron
#

if so use utils.utcnow() or something like that

#

!d discord.utils.utcnow

unkempt canyonBOT
#

discord.utils.utcnow()```
A helper function to return an aware UTC datetime representing the current time.

This should be preferred to [`datetime.datetime.utcnow()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow "(in Python v3.9)") since it is an aware datetime, compared to the naive datetime in the standard library.

New in version 2.0.
boreal ravine
#

@potent jetty also its .url lol

hasty iron
#

yep use that

slate swan
boreal ravine
#

what error

#

@slate swan try node -v in the shell

#

what version is it?

royal zenith
slate swan
#

its v16.9

#

ion know why its not working

royal zenith
#

does anyone know how to fix this

boreal ravine
#

nope

slate swan
boreal ravine
royal zenith
slate swan
boreal ravine
boreal ravine
hasty iron
slate swan
hasty iron
#

use the actual api

hasty iron
#

dm kayle or something

slate swan
river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message
https://github.com/AA1999/Disthon

GitHub

Discord API wrapper for Python built from scratch. Contribute to AA1999/Disthon development by creating an account on GitHub.

reef shell
#

How many times will you send this

boreal ravine
#

well he needs members

#

dont blame him lol

gritty flame
#

yeh but its self promoting

#

yeh

royal zenith
royal zenith
hasty iron
#

the actual api

boreal ravine
#

he isnt

#

he said a mod said it was ok if I recall

royal zenith
#

i may or may not have forgotten what api i use

boreal ravine
#

👍

marsh depot
#

Hi anyone know how to use the library discord_components?

im trying to fix my code but i dont know where is the bug

high flame
#

read their docs

high flame
#

.

icy seal
#

Wolfmoon, don’t worry about asking if you can ask - just send the code you think could be relevant and explain/post the error

marsh depot
river walrus
#

I got permission

river walrus
reef shell
#

i didn't say it either

river walrus
#

Thanks homie

marsh depot
waxen granite
#

nvm

craggy cloak
#

Who can help me?

icy seal
#

@waxen granite don't need help anymore?

bitter depot
waxen granite
#

@icy sealno , the server went down so it was returning none :3

#

geez

icy seal
#

gotcha

craggy cloak
trail breach
#

can 1 bot give commands to another

#

by default or theres a function to check for it

leaden anvil
#

why did this error occur TypeError: event() missing 1 required positional argument: 'coro' the error starts from this code: py @client.event() async def on_button_click(ctx, *,interaction): sent=discord.Embed(color=0x51ed87) sent.add_field(name='Action Confirmed', value='Report successfully sent', inline=True) if interaction.component.label.startswith("Send"): await ctx.interaction.message.edit(embed=sent) also I have three client events and i am
trying to edit an embed when a button is pressed.

pliant gulch
#

client.event not client.event()

cloud dawn
trail breach
slate swan
#
# JOIN =================================================================================================================
@client.command()
async def join(ctx):
    channel = ctx.author.voice.channel
    await channel.connect()


# LEAVE ================================================================================================================
@client.command()
async def leave(ctx):
    await ctx.voice_client.disconnect()
leaden anvil
# trail breach ??

99% of bots are hardcoded to ignore any message types flagged as a bot sender so sadly no. You could, however, do it with a self-bot but that would break discord TOS and would result in an account ban.

slate swan
#

The bot isnt joining 👀 maybe someone can help?

leaden anvil
slate swan
#

wu?

river walrus
cloud dawn
#

Your last commit was 15 days ago

leaden anvil
slate swan
#

okay

river walrus
#

Haven't commited them

slate swan
#

I only marked bot 💀

outer violet
#

How do I set the authors pfp in the author?


embed.set_author(name=message.author.display_name + " " + "(" + str(message.author) + ")")
leaden anvil
slate swan
#

i did lmao

#

then admini

leaden anvil
#

ok

cloud dawn
#

and applications.commands

river walrus
#

He's definietly doing me a lot of favors, but I can screenshot my stuff and send it to you

leaden anvil
slate swan
#

i have

#

ik these

#

-.-

leaden anvil
#

what does it say

drifting arrow
cloud dawn
slate swan
#

but it isnt working

river walrus
river walrus
leaden anvil
cloud dawn
slate swan
#

...

cloud dawn
outer violet
#

What would I do if it’s sent from a a private channel?

gritty flame
#

its still message.author.avatar_url

outer violet
#

embed.set_author(name=message.author.display_name + " " + "(" + str(message.author) + ")", url=message.author.avatar_url) is this right?

gritty flame
gritty flame
outer violet
#

Ohh

slate swan
# leaden anvil do
Traceback (most recent call last):
  File "C:\Users\juu\OneDrive\bot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:/Users/juu/OneDrive/bot/music.py", line 58, in join
    await channel.connect()
  File "C:\Users\juu\OneDrive\bot\venv\lib\site-packages\discord\abc.py", line 1277, in connect
    voice = cls(client, self)
  File "C:\Users\juu\OneDrive\bot\venv\lib\site-packages\discord\voice_client.py", line 199, in __init__
    raise RuntimeError("PyNaCl library needed in order to use voice")
RuntimeError: PyNaCl library needed in order to use voice

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

Traceback (most recent call last):
  File "C:\Users\juu\OneDrive\bot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\juu\OneDrive\bot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\juu\OneDrive\bot\venv\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: RuntimeError: PyNaCl library needed in order to use voice
#
# JOIN =================================================================================================================
@client.command()
async def join(ctx):
    channel = ctx.author.voice.channel
    await channel.connect()


# LEAVE ================================================================================================================
@client.command()
async def leave(ctx):
    await ctx.voice_client.disconnect()
drifting arrow
#

@slate swan RuntimeError: PyNaCl library needed in order to use voice

dapper cobalt
dapper cobalt
#

ctx.author doesn't have voice attribute.

#

!d discord.ext.commands.Context.author

unkempt canyonBOT
drifting arrow
drifting arrow
#

About the only bit of organization my code has

dapper cobalt
#

ctx.author returns a discord.Member object, which doesn't have voice.channel.

#

!d discord.Member

unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

hash(x) Returns the member’s hash.

str(x) Returns the member’s name with the discriminator.
cloud dawn
#

When coding a program you need to atleast recode it 2 more times before it is organized and readable.

reef shell
#

more

unkempt canyonBOT
#

property voice: Optional[discord.member.VoiceState]```
Returns the member’s current voice state.
slate swan
#

and voicestate has a channel property

dapper cobalt
#

It has voice, not voice.channel.

slate swan
#

!d discord.VoiceState.channel

unkempt canyonBOT
#

The voice channel that the user is currently connected to. None if the user is not currently in a voice channel.

slate swan
#

Here u go

dapper cobalt
#

Ah, I'm pretty un-experienced with the voice part. My bad.

cloud dawn
#

voice is pretty doable

slate swan
#

True , I never really did something with voice channels

#

@-@

drifting arrow
dapper cobalt
hasty iron
#

are you guys talking about the raw things or the stuff that dpy gives

drifting arrow
#

At best you can probably create some sort of bot that joins a voice chat and auto-mutes anybody who mic spams for more than x seconds

outer violet
#

Is it possible to see put videos in embeds?

hasty iron
#

because handling voice is a pain in the ass

tough mesa
#

yoyo

#

can discord bots have custom status'

drifting arrow
#

Yes

tough mesa
#

like instead of saying "watching"

slate swan
unkempt canyonBOT
#

property video: _EmbedVideoProxy```
Returns an `EmbedProxy` denoting the video contents.

Possible attributes include:

• `url` for the video URL.

• `height` for the video height.

• `width` for the video width...
slate swan
#

It's readable only ig

slate swan
hasty iron
#

hm

drifting arrow
#

So

#

Wonder how long until my bot breaks today 🤔

slate swan
#

my bot won't break , since I ain't adding anything new to it

#

ducky_dave Meanwhile rewriting it in hikari

drifting arrow
#

I created a reddit thing to grab my reddit notifications and display on discord and atm I am still testing it to find all the bugs

#

and there's this one bug that pops up and I cant seem to figure it out

slate swan
#

Using some api library?

drifting arrow
#

the ASYNCPRAW thing

slate swan
#

One like praw

#

ah

drifting arrow
#

i cbf learning aiohttp lol

#

oh. wait. now i got 2 bugs.

leaden jasper
#

why cant I delete a message

#
    await self.bot.get_channel(890646800019640380).fetch_message(890646834152894485).delete()
AttributeError: 'coroutine' object has no attribute 'delete'
drifting arrow
#

oh

leaden jasper
#

thanks panda hehe

cloud dawn
#

that worked?

leaden jasper
#

um no

cloud dawn
#

i deleted it since i tought it was bogus lol

#

you can only do that method in an if statement

cloud dawn
hasty iron
#

you called delete on it before it could be awaited

leaden jasper
#

oh

#
await (await self.bot.get_channel(890646800019640380).fetch_message(890646834152894485)).delete()
#

is that gonna work

drifting arrow
#

why do you have to be complicated

drifting arrow
#
channel = await self.bot.get_channe(890646800019640380)
msg = await channel.fetch_message(890646834152894485)
msg.delete(delay=86400)
leaden jasper
#

because if u put everything on one line it makes it do it faster

hasty iron
#

what

cloud dawn
drifting arrow
hasty iron
#

1 line bots are going to the moon

leaden jasper
#

i guess im wrong sorry

cloud dawn
#

if you want it to be speed use a compiled language.

drifting arrow
#

I like programming because you can do something several different ways

cloud dawn
#

often 1 line can be pretty unreadable so i'd recommend doing it in 2/3 lines even if you can do it in 1

drifting arrow
#

Plus, multi-lines have the benefit of allowing you to use other features.

#

Like, now that we have the channel variable. we can now do shit like get all the messages in that channel. change its name.
fuck around with it or something.

#

or now that we have the msg variable. Coz we know we're gonna delete it anyway. Fuck about a bit 😉
msg.edit("Haha nobody gonna see this shit.") followed by a msg.delete(delay=1) xD

cloud dawn
drifting arrow
#

also @leaden jasper where you getting the channel/message ids from?

cloud dawn
#

lol

drifting arrow
cloud dawn
leaden jasper
cloud dawn
#

Almost on every .send()/ .edit()

valid niche
cloud dawn
leaden jasper
#

It's a task loop that runs every hour

#

updates a graph by deleting the old message and sending a new message in a channel

cloud dawn
drifting arrow
valid niche
leaden jasper
valid niche
#

and well we already have a good connection to discord

#

just we've got a lot ahead still

fleet oracle
#

anyone know how to use mongoDB?

leaden jasper
cloud dawn
drifting arrow
leaden jasper
#

how different is it from mine!!

drifting arrow
#

They actually take their shit seriously

leaden jasper
#

sql statements are scary

#

i only know basic insert and take out statements

drifting arrow
#

I went in there for like 10 minutes and got yelled at immediately.

valid niche
cloud dawn
#

it's mongo so there is no sql queries

#

that why i don't like it lol

drifting arrow
#

Going strong. no errors yet!

valid niche
#

for the user it will look a lot like dpy probably, but underlying there will be some major changes. Main thing @river walrus wanted to change was the cache and how it worked

fleet oracle
cloud dawn
valid niche
valid niche
drifting arrow
#

I use aiosqlite3 for my db

valid niche
#

it's also kinda what interested me, so i understood it from the core up

drifting arrow
#

also this reminds me that I should update my code lol

#

Parts of my code use CSV as its database.. another part uses json..

#

and the rest uses a db

slate swan
#

what

#

why

drifting arrow
#

COZ WHY NOT

#

you got an issue with that?

cloud dawn
slate swan
#

afaik they are not as fast as sql, and they are mostly used to manage static data

#

also, its a pain filtering it

drifting arrow
#

very muchso. yep yep yep.

slate swan
#

then why

cloud dawn
#

sql is just better in every way when using python.

drifting arrow
#

he says as the part that changes frequently is the statistics using csv

valid niche
cloud dawn
#

I get when using java you'd use mongo

leaden jasper
drifting arrow
#

wait no. my statistics uses json

#

Funfacts uses csv!

#

\o/

valid niche
slate swan
#

lol what you should just refactor everything and switch to sql

drifting arrow
slate swan
#

good

drifting arrow
#

eventually

leaden jasper
cloud dawn
hasty iron
#

dude it’s still in development and you already want to run it

cloud dawn
#

debug it

#

poor word choice

hasty iron
#

clone the repo

valid niche
leaden jasper
#

cool is it open to the public or private?

valid niche
#

right now you need to use the setup.py and python -m build to install it locally

slate swan
#

if it was public the guy wouldnt be advertising everywhere he goes

#

private

valid niche
leaden jasper
#

oh nice nice can you do me a favor and mail me the thing in dms?

valid niche
#

mail it?

#

you sure?

leaden jasper
#

im trying to think of a more discrete synonym for send

drifting arrow
cloud dawn
river walrus
valid niche
cloud dawn
valid niche
#

oh i just ran an auto formatter on it

#

and i guess it saw that the line is too long

#

done it a few times here and there

cloud dawn
hasty iron
#

okay try reading the source code then

drifting arrow
#

am concern.
it's getting slower..

valid niche
#

i tried to look in dpy's source to see how the gateway and login is done

drifting arrow
#

it started at .541169 now it's at .707297

valid niche
#

it took me 2 days to get a basic grip of just that

drifting arrow
#

.728049

valid niche
drifting arrow
#

letting my bot run until I get the error I got earlier

#

so I can debug it.

cloud dawn
#

understandable

hasty iron
#

ah yes now it’s understandable

valid niche
#

hmmm this is curious

#

so i tried implementing built in dotenv support

#

but load_dotenv takes the .env from the location of where site-packages is it seems

#

since it's unable to load the .env

hasty iron
#

dotenv is something the user should do not the lib

valid niche
#

i mean it would've been a nice feature to help the user along

#

your first argument isn't just message it's context

#

so it's generally called "ctx"

#

and then just do ctx.send

spring flax
#

I mean it'd still work but using ctx is most used

#

What is the error

#

@hollow iron

drifting arrow
#

change message to be ctx.
await ctx.send(arg1)

#

thats error.

#

just not logged. anything that doesnt perform as intended is error

valid niche
#

do you have any other commands?

spring flax
#

You have an error handler?

drifting arrow
#

or bug or unintended feature

spring flax
#

on_message event?

valid niche
pliant gulch
#

Keep in mind now that since message content will become intents you want to setup slash commands impl

#

And it should be on an HTTP server

#

rather then done over websocket events

drifting arrow
#

again. remove channel

spring flax
spring flax
drifting arrow
spring flax
#

Both can work

drifting arrow
#

psh

#

if he wants to be inefficient fine. who am I to tell him.

#

let him continue to write the 8 extra characters.

spring flax
#

Uh...

drifting arrow
#

.>

spring flax
#

That has nothing to do with you telling him it is his error in code

drifting arrow
#

but there's no other thing wrong

spring flax
#

Nothing wrong in the command itself yes

valid niche
#

also slash commands will come yes

#

just we want to get regular bot features first

#

since slash commands are a horrible pain in the back

pliant gulch
#

Referencing discord.py code is fine imo, but one of your wrapper ideas is that discord.py code is bad, apparently from what your maintainer says

cloud dawn
#

i'd recommend doing slash only bot since prefixes are going to get nerfed anyways

drifting arrow
#

Then you got issues elsewhere.

pliant gulch
#

I'd just make sure to read the actual docs sometimes rather then referencing everything

#

Keep in mind for your slash commands impl discord wants it to be done on an HTTP server

pliant gulch
#

rather then over a websocket dispatch

valid niche
#

like i use the docs to learn how it works and if i cannot figure out how to do a step i look at other libraries to see how they did it for an idea

valid niche
pliant gulch
#

Not really

#

its easy, just need to tunnel the ip so it isn't localhost

#

since discord won't accept http scheme

#

and is there a reason why your wrapper is under GPL 3?

#

Rather then MIT

valid niche
#

at the start we were looking which one seemed good and we decided on GPL3

valid niche
wispy spade
drifting arrow
#

update..

pliant gulch
drifting arrow
#

it's getting slower.. aahh

#

nfi what happens once it ticks over..

#

oh. we're at 98.. 🤔

#

AHH

#

99

#

oh

#

it just ticks over to the next second. well that was anticlimatic.

cloud dawn
#

every 60 seconds 1.01 minutes passes

drifting arrow
#

¯_(ツ)_/¯

#

So my issue isn't time.

#

I'll do further testing tomorrow

valid niche
drifting arrow
#

It's not that huge of a deal tbh

lyric moat
#

how can i add an embed here? py content=f"**Left Guild**\n**Name:** {guild.name}\n**Id:** {guild.id}") webhook.execute()

drifting arrow
#

!d discord.Embed

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

how do i make a command that reacts to a mention?

#
@client.event
async def on_message(message):
    if client.user.mentioned_in(message):
        await message.channel.send("You text in here!")
#

if you mention the bot

#

tysm!

#

o///o

slate swan
valid niche
slate swan
#

Hello, I am having an issue with my code. I am trying to figure out how to "stop" my async function while its in a middle of a for loop

Is this possible?

if roles[num] in ctx.author.roles:
         author_team = roles[num]
         for member in ctx.guild.members:

           if author_team in member.roles:
              teamNum += 1
              if teamNum > supercon['teamCap']:
              await ctx.message.add_reaction(Check2)
              Error = discord.Embed(title="Transaction Error")
              Error.add_field(name="Reason for Failure", value=MaxRosterError)
              await ctx.send(embed=Error)
              break
              return

         if FArole in user.roles:```
#

bruh okay discord, amazing formatting

#

k there, fixed the formatting

lyric moat
#
content=discord.Embed(colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```

could this work
valid niche
#

just leave them out if you aren't going to use them?

lyric moat
#

I am so confused

slate swan
#

interesting code..

#

The heck is type='rich'

valid niche
lyric moat
#

hollon brb lemme try one

valid niche
#

by adding all params even tho you aren't passing anything useful to them

slate swan
#

dude what, why even create a discord embed

#

if ur not gonna add any values

#

mad confused

#

anyways

#

U got any any i can stop a an async function inside of a for loop? @valid niche

#

without disrupting the rest of the code

lyric moat
#

i am fixing it

reef shell
#

Anyone knows how to manually get discord's rate-limits per route?

valid niche
slate swan
# slate swan Hello, I am having an issue with my code. I am trying to figure out how to "stop...

So as u can see

for member in ctx.guild.members:
 if author_team in member.roles:
              teamNum += 1
              if teamNum > supercon['teamCap']:
              await ctx.message.add_reaction(Check2)
              Error = discord.Embed(title="Transaction Error")
              Error.add_field(name="Reason for Failure", value=MaxRosterError)
              await ctx.send(embed=Error)
              break
              return```

i attempt to stop the **WHOLE function** if this `if statement` is true
but it doesnt work so idk what to do

an its in a `for loop` if u check on the toop
valid niche
#

also that bottom return is NEVER reached due to the break above it

slate swan
#

i thought break stop the function from REPEATING not END it

#

interesting..

lyric moat
#

i am so confused how to add an embed to this

content=f"**Left Guild**\n**Name:** {guild.name}\n**Id:** {guild.id}")  
            webhook.execute()```
valid niche
#

break has no effect on functions

#

it's a loop only thing

slate swan
#

okay

#

so then if i just remove break and let it return what happens?

#

im gonna be honest here i never took the time to actually learn was return does

valid niche
#

the entire function stops the moment it reaches return, in this case you have no return value so it returns nothing

slate swan
#

i just know it stops something and returns an end value lol

slate swan
#

thx for the help

lyric moat
#

Like this @valid niche

valid niche
#

that's just 3 inline fields

#

server name and flock anti are a field

#

server membercount and 4 are a field

#

and server owner and that mention is a field

lyric moat
#

Yeah ik but how i add an embed?

valid niche
#

you just make an embed instance

#

add 3 fields

#

and use it in the embed= field in send()

lyric moat
#

like this

#
embed.add_field(name="Field 1 Title", value="1 Des", inline=3)
valid niche
#

inline is a bool;

#

not an int

lyric moat
#

wym

valid niche
#

it's not a number

lyric moat
#

when i add that should it be like this

#
content=embed.add_field(name="Field 1 Title", value="This is the value for field 1. This is NOT an inline field.", inline=False)```
#

?

full lily
#

right

lyric moat
#

when i put it i get this

valid niche
#

also read the error

#

it says invalid syntax

lyric moat
#

how i fix it?

slate swan
#

Why are you adding a variable? I think that might be your problem but I may be wrong

lyric moat
#

i just wanna make a embed its this hard...

slate swan
#

Ok you want to make an embed?

lyric moat
#

yes

valid niche
#

syntax error means you just didn't write correct python

#

it's a grammar issue for programmers

#

tho if you don't have that knowledge, i wonder why you are even doing discord bots...

full lily
#

amen ^

cloud dawn
slate swan
#
embed=discord.Embed(title="A very simple embed", description="this is a description", colour=0xffffff, timestamp=ctx.message.created_at)
embed.add_feild(value="hello")
await ctx.send(embed=embed)

You do need to pass context and I do recommend just doing 1 Google search on how to make an embed

cloud dawn
#

does need an extra ) though at the end

slate swan
slate swan
balmy gate
#

I need help playing sound in higher quality

cloud dawn
balmy gate
#

I'm using python 3.4

#

It's buggy

cloud dawn
balmy gate
#

It skips every few seconds

cloud dawn
#

dpy recommends 3.8 atleast

balmy gate
#

Oh

#

Lemme update

#

K

#

Their

#

NASA wifi ok_handbutflipped

cloud dawn
#

skipping voice audio is the fault of your own local computer not of the code

balmy gate
#

No like

balmy gate
#

The bot stops playing every minute

valid niche
#

did you time travel?

#

because pass_context is not used since like 4 years already

cloud dawn
balmy gate
#

.

#

I use it for movie night

#

So they can hear it better

slate swan
balmy gate
#

And then I just stream the movie

#

But it cuts out every couple minutes

valid niche
#

you....don't pass context anymore

#

that's like 4 years ago man

cloud dawn
#

I don't think this is the appropriate channel for this.

balmy thicket
#

guys im just starting, i want to make kinda of a script to discord, for X to X time it sends a message for a specific channel

#

how can i do that

valid niche
valid niche
#

well it just doesn't exist

#

so i assume that should be clear

#

you're trying to add 1 to a value that doesn't exist

#

also json ehhh

balmy thicket
#

i just "know" how to work with JS

bitter depot
#

!warn 849462626055487489 Not quite sure what made you think that's appropriate here, but it isn't. Please don't be posting memes here.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @balmy gate.

valid niche
#

i think you might want to delete that image before people start abusing that webhook

#

and regenerate that webhook

lyric moat
#

oh yeah

#

thats what ima do

slate swan
#

can you use heroku with the python idle

valid niche
valid niche
#

read this

slate swan
#

Please help.

#

Is it a good idea to host a bot in a raspberry pi

valid niche
slate swan
valid niche
#

202 what?

slate swan
slate swan
valid niche
#

i mean smal or large in terms of guilds

#

how many guilds and users it's serving

slate swan
valid niche
#

and how many users are in all those guilds combined?

slate swan
valid niche
#

so that's small

slate swan
slate swan
clear scaffold
#

Where I can find button documentation?

hasty iron
#

!d discord.ui.View

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.
hasty iron
#

!d discord.ui.button

unkempt canyonBOT
#

discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.

The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View"), the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.ui.Button") being pressed and the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/api.html#discord.Interaction "discord.Interaction") you receive.

Note

Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
hasty iron
#

there are examples inside the repo

slate swan
#
from discord.ext.commands import *
from discord.ext import commands
class Deletechannels(commands.Cog):
    def __init__(self,bot) -> None:
        self.bot = bot
    @commands.has_permissions(manage_channels=True)
    @commands.cooldown(1,5,BucketType.member) 
    @commands.command()
    async def delchannel(self,ctx, channel : int) -> str:
        await channel.delete()
        ctx.send('done deleting',f'<#{channel}>')
    @delchannel.error
    async def delchannel_error(self,ctx,error):
        if isinstance(error,commands.MissingPermissions):
            await ctx.send('you dont have Permission to execute that command')
        elif isinstance(error,commands.MissingRequiredArgument):
            await ctx.send('MissingRequiredArgument')
        elif isinstance(error, CommandOnCooldown):
            await ctx.send(f'you can try again after -> {round(error.retry_after)}s')
        else:
            await ctx.send('there was an error')
def setup(bot):
    bot.add_cog(Deletechannels(bot))``` it doesnt give me any errors , it just goes to the else statement , perhaps i shouldnt delete channels in that way ?
#

you didnt pass that emoji while using the addemoji

reef trail
#

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

reef trail
weary birch
#

how to add CLIENT SECRET to secrets

little ether
slate swan
#
@bot.command(pass_context=True)
async def afk(ctx, *, reason='AFK'):
    current_nick = ctx.author.display_name
    embed = discord.Embed(name="", description=f"{ctx.author.mention} is now AFK - '{reason}'")
    await ctx.send(embed=embed)
    try:
        await ctx.author.edit(nick=f"[AFK] {ctx.author.display_name}")
    except:
        pass
    start = time.time()
    guildID = ctx.guild.id
    collection = dbclient.db.users
    data = await dbclient.get_array(collection, {'id': ctx.author.id})
    if data == None:
        await dbclient.create_doc(
            collection, {
                'id': ctx.author.id,
                'afk': [(start, guildID, current_nick, reason)]
            })
    else:
        try:
            data['afk'].append((start, guildID, current_nick, reason))
        except:
            data['afk'] = [(start, guildID, current_nick, reason)]
        await dbclient.update_array(collection, {'id': ctx.author.id}, data)```
  i get an error for ` start = time.time()`, error: `'str' object has no attribute 'time'`
hasty iron
#

you’re overriding time somewhere

slate swan
#

wdym

hasty iron
#

send your whole code

#

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

my whole bot source?

little ether
hasty iron
#

answer cookie’s question instead

slate swan
#
bot.launch_time = datetime.utcnow()```
#

found this

hasty iron
#

not helpful at all

#

we asked about time

slate swan
#
time = datetime.now().strftime("%H:%M %p")```
weary birch
little ether
hasty iron
slate swan
#

alright ty

slate swan
#
from discord.ext.commands import *
from discord.ext import commands
import discord
class Deletechannels(commands.Cog):
    def __init__(self,bot) -> None:
        self.bot = bot
    @commands.has_permissions(manage_channels=True)
    @commands.cooldown(1,5,BucketType.member) 
    @commands.command()
    async def delete(self,ctx, channel : discord.TextChannel or discord.VoiceChannel ) -> str:
        await channel.delete()
        await ctx.send(f'done deleting <#{channel}>')
    @delete.error
    async def delchannel_error(self,ctx,error):
        if isinstance(error,commands.MissingPermissions):
            await ctx.send('you dont have Permission to execute that command')
        elif isinstance(error,commands.MissingRequiredArgument):
            await ctx.send('MissingRequiredArgument')
        elif isinstance(error, CommandOnCooldown):
            await ctx.send(f'you can try again after -> {round(error.retry_after)}s')
        else:
            await ctx.send('there was an error')
def setup(bot):
    bot.add_cog(Deletechannels(bot))``` a new error ![pepebye](https://cdn.discordapp.com/emojis/778108462830977036.webp?size=128 "pepebye")
#

how do i make my bot log whenever a user joins or leaves a voice channel
using on_voice_state_update()

little ether
slate swan
#
import typing

channel: typing.Union[discord.TextChannel, discord.VoiceChannel]
hasty iron
#

or if you’re using 3.10 you can use TextChannel | VoiceChannel

hasty iron
slate swan
hasty iron
#

yes

little ether
hasty iron
#

!d discord.Guild.create_custom_emoji

unkempt canyonBOT
#

await create_custom_emoji(*, name, image, roles=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

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

There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.

You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
hasty iron
#

image is not a PartialEmoji

#

it takes in bytes

slate swan
#
@bot.command(pass_context=True)
async def afk(ctx, *, reason='AFK'):
    current_nick = ctx.author.display_name
    embed = discord.Embed(name="", description=f"{ctx.author.mention} is now AFK - '{reason}'")
    await ctx.send(embed=embed)
    try:
        await ctx.author.edit(nick=f"[AFK] {ctx.author.display_name}")
    except:
        pass
    start = time.time()
    guildID = ctx.guild.id
    collection = dbclient.db.users
    data = await dbclient.get_array(collection, {'id': ctx.author.id})
    if data == None:
        await dbclient.create_doc(
            collection, {
                'id': ctx.author.id,
                'afk': [(start, guildID, current_nick, reason)]
            })
    else:
        try:
            data['afk'].append((start, guildID, current_nick, reason))
        except:
            data['afk'] = [(start, guildID, current_nick, reason)]
        await dbclient.update_array(collection, {'id': ctx.author.id}, data)```
```    collection = dbclient.db.users
NameError: name 'dbclient' is not defined```
how should i def dbclient? never done something like this
hasty iron
#

by not copying code

slate swan
#

define dbclient to your database

slate swan
little ether
unkempt canyonBOT
#

typing.Union```
Union type; `Union[X, Y]` is equivalent to `X | Y` and means either X or Y.

To define a union, use e.g. `Union[int, str]` or the shorthand `int | str`. Details...
hasty iron
#

it means one of the types

slate swan
#

oh fair enough

#

thanks sir CH_PepeSalute have a wonderful day

hasty iron
#

it has no actual behaviour outside dpy though

#

other than docs and linters

pliant gulch
#

I see the pep as well it says 3.10

slate swan
hasty iron
#

you like it when error

slate swan
#

wdym ?

hasty iron
#

it was a joke

slate swan
#

my humor is broken if it was a joke

#

oh yeah thats what i thought 😔

pliant gulch
#

Think you forgot the verbose flag

#

joking but your error handler should output something helpful

slate swan
#
import typing
from discord.ext.commands import *
from discord.ext import commands
import discord
class Deletechannels(commands.Cog):
    def __init__(self,bot) -> None:
        self.bot = bot
    @commands.has_permissions(manage_channels=True)
    @commands.cooldown(1,5,BucketType.member) 
    @commands.command()
    async def delete(self,ctx,channel : typing.Union[discord.TextChannel, discord.VoiceChannel]) -> None:
        await channel.delete()
        await ctx.send(f'done deleting <#{channel}>')
    @delete.error
    async def delchannel_error(self,ctx,error):
        if isinstance(error,commands.MissingPermissions):
            await ctx.send('you dont have Permission to execute that command')
        elif isinstance(error,commands.MissingRequiredArgument):
            await ctx.send('MissingRequiredArgument')
        elif isinstance(error, CommandOnCooldown):
            await ctx.send(f'you can try again after -> {round(error.retry_after)}s')
        else:
            await ctx.send('there was an error')
def setup(bot):
    bot.add_cog(Deletechannels(bot))``` , code so far ![spiin](https://cdn.discordapp.com/emojis/848919630666924042.webp?size=128 "spiin")
pliant gulch
#

rather then saying there was an error you should raise the error

hasty iron
#

in the else clause you should raise the error

slate swan
#

oh i never knew i can pepe_shrug

slate swan
#

it didnt show the error BUT it got fixed

#

bruh

#

How can I host my bot if I am coding it on vscode?

hasty iron
#

selfhost it or get a vps

#

or buy a raspberry

pliant gulch
#

Imo don't go for a raspberry pi

slate swan
#

a

vast gale
#

Kek Command raised an exception: HTTPException: 413 Payload Too Large (error code: 40005): Request entity too large

#

apparently bots can't attach a file of 8mb

hasty iron
#

they can’t?

#

that’s kind of weird

pliant gulch
#

they should

#

are you sure the file is exactly 8mb or less?

vast gale
#

I'm confident its less than

slate swan
#

someone can javascript here?

vast gale
#

!e print(8 * (2 ** 10) ** 2)

unkempt canyonBOT
#

@vast gale :white_check_mark: Your eval job has completed with return code 0.

8388608