#discord-bots

1 messages · Page 816 of 1

slate swan
#

if you're checking the member's current roles/permissions, they may not be up to date for that reason

slate swan
#

@bitter perch my pc got the blue screen uh oh

sick birch
#

Windows smh

#

but it happens, usually not a big deal just restart and you're good to go

pliant gulch
#

Windows 🟦

slate swan
slate swan
#

@sick birch

sick birch
slate swan
#

Hi

#

Hmm so what is h2

#

Http 2

#

Like I know it’s a http version but there a module called

sick birch
#

never heard of it myself, can only assume it's normal http

slate swan
#

H2.connection or something

slate swan
sick birch
#

its probably a http library

slate swan
#

Yep

#

Ok so what is sendall I’m in bed on iOS so I’m slower

sick birch
#

they were using sockets instead of websockets, so it's probably the same as websocket's send

slate swan
#

O ok

#

this is such discord-bots related stuff

#

Well in sockets it’s .send as well I’ve used sockets to send http requests so ik a bit

sick birch
#

yeah afir point

#

lets open up a help channel

slate swan
#

okay

dreamy sluice
#

I think I have been living under a rock

slate swan
#

@sick birch do you know fix for this btw?

sick birch
#

is nekosbest on pypi?

slate swan
sick birch
#

double check that it is, and you've spelling it right

slate swan
#

this is what requires it but i can’t seem to you know download it’s requirement

sick birch
#

hmm thats odd

#

requirements only say aiohttp

slate swan
#

i’ve downloaded it before than my python broke so i had to reinstall every version

sick birch
#
pip install -U nekosbest
``` installs all requirements
slate swan
#

okay

#

i’ve tried that before and it didn’t work but i’ll try again

regal pulsar
#
@bot.command()
async def encrypt(message, encode_text):
    encrypt_output = encoder.encryptfunc(encode_text)
    message.channel.send(f"Your encrypted text is {encrypt_output}")
#
def encryptfunc(encrypt_text):
    output1 = ''
    encrypt = {
        'a': '>',
        'b': '?',
        'c': '*',
        'd': '-',
        'e': '+',
        'f': '^',
        'g': '%',
        'h': '@',
        'i': '!',
        'j': '$',
        'k': '_',
        'l': '`',
        'm': '~',
        'n': 'c',
        'o': '|',
        'p': '}',
        'q': '[',
        'r': ')',
        's': '{',
        't': ']',
        'u': '(',
        'v': '=',
        'w': ';',
        'x': ':',
        'y': ',',
        'z': '.',
        '1': '"',
        '2': 'j',
        '3': 't',
        '4': 'k',
        '5': 'b',
        '6': 'd',
        '7': 'l',
        '8': 's',
        '9': 'a',
        ' ': ' ',
        '.': '.',
        ',': ','
    }
    for item in encrypt_text.lower():
        output1 += encrypt[item]
    return output1
regal pulsar
#

and i get this error

#
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'h'```
#

why am i getting the keyerror

#

oh and

#
    output2 += decrypt[item]
KeyError: 'h'```
slate swan
#

why encrypt the content of a msg?

regal pulsar
slate swan
#

thats cool ig but im not sure if thats the best way to encrypt something

regal pulsar
#

hmm

#

theres probably a module i could use

#

but

#

why wont this work

slate swan
#

encryption is always different which has its own key

#

to decrypt it

regal pulsar
slate swan
#

afaik

regal pulsar
#

just for me and some friends

slate swan
#

cool project ig

#

just use .replace for encryption and decryption

regal pulsar
#

hmm

#

can you send a syntax example

slate swan
#

its probably gonna be to much so nvm theres probably a better way which is what youre doing

regal pulsar
#

k

regal pulsar
#

the encrypter works seperately

#

but not with the import

#

ah wait

#

i made a mistake

#

i had encrypt_output = encoder.encryptfunc(encrypt_text)

#

instead of encrypt_output = encoder.encryptfunc()

slate swan
#

seems like h isnt found

#

!e

d = {"a": "1"}
print(d[0])
unkempt canyonBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | KeyError: 0
slate swan
#

@sick birch

regal pulsar
slate swan
regal pulsar
#

hmm

#

i found another problem

slate swan
#

hence the keyerror

regal pulsar
#

i need to have

#

encrypt_output = encoder.encryptfunc()

#

but i also need a positional argument encrypt_text

#

so

#

def encryptfunc(encrypt_text): in the module

slate swan
#

anyone know how to fix this :(

regal pulsar
#

how do i access the encoded text

slate swan
#

if you want a sentence make it a kwarg so it will eat all text after the command and argument naming btw

tacit storm
#

just use aiohttp

tacit storm
#

are you fucking serious?

regal pulsar
tacit storm
#

when did you start learning python?

regal pulsar
#

like 3 weeks ago

slate swan
tacit storm
regal pulsar
#

but id taken a week break for exams

#

so more like 2 weeks

slate swan
regal pulsar
tacit storm
slate swan
#

you sure?

#

!pypi nekosbest

unkempt canyonBOT
tacit storm
#

it's working

slate swan
#

mhmmm

#

did you installed it? @slate swan

#

it doesn’t work for me i tried everything and i get this

#

try

py pip install -m install nekosbest
tacit storm
#

it works for me.

tacit storm
#

i did "pip install -U nekosbest"

#

it installed prefectly fine for me

slate swan
#

weird

tacit storm
slate swan
#

@tacit storm what version of python you using?

tacit storm
#

python3

#

well more 3.9 exactly.

slate swan
#

seff whats your python version?

#

it should be 3.8 above as the package says

tacit storm
#

honestly, just in case of problems like a module not installing, i just use the open endpoints with aiohttp.

slate swan
tacit storm
#

weird

#

ask in their server @slate swan

#

i think thhis might be a problem with the module

slate swan
#

i see no reason why to request from bare endpoints when theirs wrappers for the api?

tacit storm
slate swan
#

a whole api btw

#

depending on the api it could have so many

ashen locust
#

how to make bot delete a message

slate swan
unkempt canyonBOT
#

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

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
ashen locust
#

thanks

slate swan
#

ash slow

slate swan
slate swan
slate swan
unkempt canyonBOT
slate swan
#

Huh

slate swan
ashen locust
#

have i written anything wrong? this isnt working

regal pulsar
slate swan
#

did you mean ctx.message?

regal pulsar
#

or vice versa

ashen locust
#

my error is message has no attribute content

#

okay ill try that thanks

slate swan
regal pulsar
#

change ctx to message

slate swan
ashen locust
#

oh okay

slate swan
regal pulsar
ashen locust
#

yea i tried it isnt working

slate swan
#

use ctx.message bruh

ashen locust
#

i did

slate swan
#

show your code

ashen locust
slate swan
#

you should also learn how to read tracebacks. often, they alone contain all the data you need to fix the issue yourself

slate swan
ashen locust
#

oh ok

#

and message.delete also?

slate swan
#

just learn python, stop attempting to create a discord bot with no knowledge. it's hard and often fruitless

ashen locust
#

i do know python i have done it for 1yr but havent done it in ages and forgot the basics so please stop assuming before saying anything

slate swan
#

well, you're calling a string, i don't know what to tell you

slate swan
ashen locust
#

thats why i said i have forgotten the basics

slate swan
#

so relearn it?

ashen locust
#

i am?

slate swan
#

my god these people

ashen locust
#

cant u just stop giving ur "advice" and just try to help

slate swan
slate swan
# ashen locust cant u just stop giving ur "advice" and just try to help

sure, ctx represents a command's execution context. it has certain attributes like message, which represents a Discord message. message.content is a string, there's no point to calling it, message.delete() is a coroutine method. documentation links can be found in the channel description

ashen locust
#

Thank You.

slate swan
#

are you using the master branch?

ashen locust
#

what is that?

#

oh yes i am

slate swan
# ashen locust what is that?

basically discord.py v2.0 was going to be put out and it would have had full support for Discord's interactions api. except that the core library maintainer quit for some personal reasons and 2.0 was never a thing. so people use the master branch on github and yea

#

it's incomplete

ashen locust
#

yea im using the main one

slate swan
#

not sure what that means

ashen locust
#

i meant that im using the original master branch and none of the forks i think u call them

nimble plume
#
@commands.guild_only()
@commands.command(name="kick")
@has_permissions(kick_members=True)
async def kick(ctx, user: discord.Member=None, * , reason=None):
     if ctx.me.guild_permissions.kick_members is not True:
       s = discord.Embed(description="I dont have kick perms",color=red,timestamp=datetime.utcnow())
       await ctx.reply(embed=s)
     elif user is None:
        s = discord.Embed(title="Define the member",color=red,timestamp=datetime.utcnow())
        await ctx.reply(embed=s)
     elif ctx.author.top_role <= user.top_role:
           s = discord.Embed(description=f"{user} |  Is Mod/Admin cannot kick",color=red,timestamp=datetime.utcnow())
           await ctx.reply(embed=s)
     elif user.top_role >= ctx.me.top_role or user.guild_permissions.administrator:
           s = discord.Embed(description="The user has bigger role than me cannot kick",color=red,timestamp=datetime.utcnow())
           await ctx.reply(embed=s)
     else:
          lol = discord.Embed(title=f"You are Kicked from {ctx.message.guild.name}", description=f"**Reason**: {reason}", color=aqua,timestamp=datetime.utcnow())
          await user.send(embed=lol)
          await user.kick(reason=reason)
          kick = discord.Embed(title=f"Kicked {user}", description=f"**Reason**: {reason}", color=green,timestamp=datetime.utcnow())
          kick.set_footer(text=f"Requested by {ctx.author}", icon_url=f"{ctx.author.avatar_url}")
          await ctx.reply(embed=kick)
``` is this a perfect clean code .
#

if not what is the fault

#

its working fine i have checked just want to know is it clean code or not

slate swan
#

i write my code a particular way, and would change things in there because i am nitpicky and absolutely pathetic. don't worry about it, your code is good (if you're asking about clean code)

dreamy sluice
#

Anyone know how to setup a persistent view for dropdowns?

nimble plume
slate swan
#

use cogs if you want to

nimble plume
#

i cant understand what cogs bassicaly are i read all articles but didnt understand

dreamy sluice
nimble plume
#

subclasses?

dreamy sluice
#

For example, I can create a separate Cog for Economy commands

nimble plume
#

say in simple english

dreamy sluice
nimble plume
#

ok

dreamy sluice
#

I am not sure what subclasses are too

nimble plume
#

where cogs are used?

dreamy sluice
#

To organise all commands

#

Without cogs, all the commands will be in 1 file.

nimble plume
#

organise in the sense?

dreamy sluice
#

Using cogs, you can organise them into separate files.

nimble plume
dreamy sluice
#

So you can put the server commands in one file, etc

#

afk brb

slate swan
#

ever made a secret language as a child well i suppose its like that

#

ig

#

fun and games yk

timid wagon
slate swan
#

how do i get the bot to edit a voice channel?

#

channel.edit()?

slate swan
#

?

#

so um do you have the voice channel?

#
channel = bot.get_channel(x)  # get the channel, x is the channel ID

await channel.edit(...)
nimble plume
#

how to use vc.play with pyttsx3

slate swan
vale wing
#

Just provide it to executor param

maiden fable
unkempt canyonBOT
#

class discord.AudioSource```
Represents an audio stream.

The audio stream can be Opus encoded or not, however if the audio stream is not Opus encoded then the audio format must be 16-bit 48KHz stereo PCM.

Warning

The audio source reads are done in a separate thread.
maiden fable
#

!d discord.VoiceClient.play

unkempt canyonBOT
#

play(source, *, after=None)```
Plays an [`AudioSource`](https://discordpy.readthedocs.io/en/master/api.html#discord.AudioSource "discord.AudioSource").

The finalizer, `after` is called after the source has been exhausted or an error occurred.

If an error happens while the audio player is running, the exception is caught and the audio player is then stopped. If no after callback is passed, any caught exception will be displayed as if it were raised.
maiden fable
#

U need to save the MP3 file

shadow wraith
#

i havent coded stuff in discord bots for a while so i did this by memory but does anyone know why it errors at inter.send("You are already verified!", ephemeral=True)

class VerifyButton(disnake.ui.View):
    @disnake.ui.button(label="Verify", style=disnake.ButtonStyle.green)
    async def on_click(self, btn: disnake.Button, inter: disnake.Interaction):
        if "Not Verified" in inter.author.roles:
            inter.author.add_roles("Member")
            inter.author.remove_roles("Not Verified")
            inter.send("You've successfully been verified!", ephemeral=True)
        else:
            inter.send("You are already verified!", ephemeral=True)
#

i get this

#

Warning: coroutine 'Interaction.send' was never awaited
inter.send("You are already verified!", ephemeral=True)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

there is no traceback :[

slate swan
#

await all those coros

shadow wraith
#

oh

#

im so stupid

slate swan
#

.send is a coro

#

Warning: coroutine 'Interaction.send' was never awaited

#

and btw that else isnt needed

warm forum
#

Hey guys

#

When my bot give any link these icon show up

#

How to remove them?

slate swan
#

i think your client isnt ok

#

it seems broken

#

are you saying im wrong or its the bot i cant tell

maiden fable
#

Nvm it was a joke

slate swan
vocal snow
slate swan
slate swan
warm forum
#

hey guys how can i use hyper link in my bot?

slate swan
# slate swan yes

Use guild.channels.resolve(ID of the channel) resolve it and then use setName method to change it's name

slate swan
#

Oop i thought I forgot to mention u on that , pls ignore that free ping pithink

warm forum
placid skiff
#

To change embed description i just need to do embed.description = description or something else?

slate swan
#

yea that would work

#
import discord
from discord.ext import commands

import asyncio
import random
import praw
import os
import requests
import asyncpraw

from discord.ext import commands

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

client = commands.Bot(command_prefix = "-", intents=intents)

@client.event
async def on_ready():
    print("Bot is ready")
    print("-------------------------------------")

reddit = praw.Reddit(client_id='T-OdEbfZQFXYLfRzxOz7Hw',
                     client_secret='W0F30XopqXJ1MQAcsAfvYC97qR21Ag',
                     username = "JosephMemestar",
                     password = "ep1ctr0ler@#Xx",
                     user_agent='cumzone',
                     check_for_async=False)
                     
@client.command()
async def meme(ctx):
    check_for_async=False 
    subreddit = reddit.subreddit("izlam")
    all_subs = []
    top = subreddit.hot(limit=50)
    for submission in top:
        all_subs.append(submission)
    random_sub = random.choice(all_subs)
    name = random_sub.title
    url = random_sub.url
    em = discord.Embed(title=name, url=url, color=0xE0AE69)
    em.set_image(url=url)
    await ctx.send(embed=em)

# Purge Command
@client.command(aliases= ['purge','delete'])
@commands.has_permissions(manage_messages=True)
async def clear(ctx, amount : int):
   if amount == None:
       await ctx.channel.purge(limit=1000000)
       await ctx.send(f"{941087269673119816} Messages are being sent to the afterlife!")
       await asyncio.sleep(1)
       await ctx.send(f"{amount} messages have been deleted!")
   else:
       await ctx.channel.purge(limit=amount)
       await ctx.send(f"{941087269673119816} Messages are being sent to the afterlife!")
       await asyncio.sleep(1)
       await ctx.send(f"{amount} messages have been deleted!")

client.run('token')```
slate swan
slate swan
#

does the bot not start?

#

well, it returns this

#

Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

#

read this?

#

Wait

#

its finally working

#

thanks 😭

warm forum
#

Hey guys how can i color the hyper link?

maiden fable
#

U can't

warm forum
#

How about the text?

quick gust
#

uh not unless you use the ansi colour codes

#

and that won't work with hyperlinks, only normal text

boreal ravine
hoary rose
#

Hi! Can I make discord bot accept inputs from chat member and send it directly to linux console like if user was typing it into console?

halcyon bison
#

that is very unsafe

hoary rose
#

Why?

#

Chat is private, invite only

halcyon bison
#

..

hoary rose
#

And available inputs are filtered

#

By bot

#

I.e. i want to send inputs to py script from discord instead of console as a temporary solution

brisk brook
#

how do i structure an inventory if i use aiosqlite as my database?

velvet tinsel
warm forum
#

hey guys how can my bot send a color text?

velvet tinsel
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**...
velvet tinsel
warm forum
#

yes

velvet tinsel
#

!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.
quick gust
hoary rose
velvet tinsel
#

bot.wait_for("message", check=...)

#

leave timeout kwarg empty if you want it to last forever

velvet tinsel
velvet tinsel
low marlin
pure tartan
#

Just a general question. im making a audit log for my bot. how to check who was the moderator that banned the user on on_member_ban

upper shuttle
#

!d nextcord.Embed

unkempt canyonBOT
#

class nextcord.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.10)") 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://nextcord.readthedocs.io/en/latest/api.html#nextcord.Embed.Empty "nextcord.Embed.Empty").

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

Does any library right now have modals and are stable?

boreal ravine
boreal ravine
upper shuttle
gaunt ice
#

i want to get the message id of the replied message

#

howd i do dat

boreal ravine
unkempt canyonBOT
#

The message that this reference resolved to. If this is None then the original message was not fetched either due to the Discord API not attempting to resolve it or it not being available at the time of creation. If the message was resolved at a prior point but has since been deleted then this will be of type DeletedReferencedMessage.

Currently, this is mainly the replied to message when a user replies to a message.

New in version 1.6.

boreal ravine
#

👍

slate swan
#

if you want to send it as a link in normal text you would have to use a webhook, in an embed it works directly

"[Blue hyperlinked text](url)"
light violet
#

how to use httpx besids aiohttps

brittle axle
#

I am building a timed poll feature where I make a poll within a certain amount of time but i also want to show which option had the most votes and also show the amount of votes that option had here is the code

unkempt canyonBOT
flat solstice
#

yep i do

brittle axle
#

here is the code

flat solstice
#

No I'm not checking their roles, I'm checking if the msg content is in either my db bad words list or in my config.py files bad words list

gusty hatch
#

how to use jsk with heroku?

#

Jishaku

gaunt ice
slate swan
#

guys, how to add commands in this code?

from discord.ext import commands
import asyncio
import discord
import random


"""A SIMPLE DISCORD BOT USING DISCORD.PY"""



bot=commands.Bot(command_prefix='s.') #command prefix

@bot.event
async def on_ready():
    """Print the bot's name when the bot is ready'"""
    print(bot.user.name)
    
    
    
@bot.command(pass_context=True)
async def say(con,*,msg):
    """Repeats what the user says"""
    await bot.say(msg)
    

@bot.command(pass_context=True)
async def dice(con,x=1,y=6):
    await bot.say(random.randint(x,y))


bot.run('insert bot token') #
slate swan
#

this code is working perfectly fine

slate swan
gaunt ice
slate swan
#

i said

#

add commands, like "say command"

#

like "ban command"

gaunt ice
#

hmm

slate swan
#

how😴

#

🤡

#

🤔 🤔 🤔 🖕

#

This code is extremely outdated

#

are you sure about that

gaunt ice
#

ye lol

slate swan
#

im new to python 🏃🏃🏃💨💨💨💨💨

#

it's 2.5+ years old ,yes.

slate swan
pliant gulch
#

More like 5 or 6 years

slate swan
pliant gulch
#

pass_context and bot.say was like wayyy back

slate swan
#

i got it. from sololearn

pliant gulch
#

Both of which are deprecated

slate swan
gaunt ice
#

ye

boreal ravine
slim ibex
#

I remember pass_context 🗿

slate swan
#

If you want code ideas, use GitHub
Not these sites

boreal ravine
gaunt ice
#

like the replied message

boreal ravine
#

yeah

slate swan
#

/kill

#

does roblox use python

gaunt ice
slate swan
#

dows roblox use lua?

boreal ravine
unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

slim ibex
#

Lua for making games

gaunt ice
slate swan
#

does roblox use html?

boreal ravine
#

..

#

stop spamming

slate swan
#

does roblox use html?

gaunt ice
boreal ravine
slate swan
slate swan
#

i already know whats lua

boreal ravine
#

??

slim ibex
#

are you like 2

slate swan
#

C++ along with lua

gaunt ice
slate swan
#

im html user

slim ibex
#

HTML isn’t a programming language fyi

slate swan
#
<p> ez 🥶 </p>
boreal ravine
#

..

slate swan
slim ibex
#

It’s a markup language

slate swan
#

ik

#

i just said that

#

nub

#
console.log('uwu')
light violet
#
Logged into RunZ~13 | 940204270492463134
/home/runner/losoclientsdsdsds/events/AntiNuke.py:65: RuntimeWarning: coroutine 'AsyncClient.put' was never awaited
  async with session.put("https://discord.com/api/v9/guilds/%s/bans/%s" % (guild.id, user), json={"reason": reason}) as r:
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Ignoring exception in on_member_ban
Traceback (most recent call last):
  File "/home/runner/losoclientsdsdsds/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/losoclientsdsdsds/events/AntiNuke.py", line 65, in on_member_ban
    async with session.put("https://discord.com/api/v9/guilds/%s/bans/%s" % (guild.id, user), json={"reason": reason}) as r:
AttributeError: __aexit__```
slate swan
light violet
#

what to do

slate swan
#

use JavaScript

boreal ravine
light violet
slate swan
#

i mean java not JavaScript

slate swan
light violet
slate swan
#

and py is never update?😔

light violet
#

py is easier

slate swan
#

in ur opinion

#

and ur brain🥶

light violet
#

yep

#

btw cant u fix my error

slate swan
#

i use JavaScript/node.js and html

gaunt ice
#

@boreal ravine sry for annoying can u give asample on how to use it

slate swan
#

node.js is the same with javascript

light violet
#

hm

gaunt ice
#

im really sry

boreal ravine
shadow wraith
#

@slate swan roblox studio uses lua as it's scripting language for games jeez.

slate swan
#

roblox is better than lua

slate swan
# slate swan and py is never update?😔

that's definately not true, python gets regular update ( no way less than js/java) and is faster than you understanding the fact that this channel is related to discord bots.

slate swan
#

!ot

unkempt canyonBOT
gaunt ice
#

i tried this

#

but aint working

light violet
# slate swan !ot
Logged into RunZ~13 | 940204270492463134
/home/runner/losoclientsdsdsds/events/AntiNuke.py:65: RuntimeWarning: coroutine 'AsyncClient.put' was never awaited
  async with session.put("https://discord.com/api/v9/guilds/%s/bans/%s" % (guild.id, user), json={"reason": reason}) as r:
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Ignoring exception in on_member_ban
Traceback (most recent call last):
  File "/home/runner/losoclientsdsdsds/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/losoclientsdsdsds/events/AntiNuke.py", line 65, in on_member_ban
    async with session.put("https://discord.com/api/v9/guilds/%s/bans/%s" % (guild.id, user), json={"reason": reason}) as r:
AttributeError: __aexit__```
pls help fixing this
slate swan
#

its messagereply

gaunt ice
#

):

boreal ravine
slate swan
#

not messagerepy

light violet
light violet
slate swan
#

Oh you need to await AsyncClient.put@light violet

shadow wraith
#

im so dead rn

slate swan
gaunt ice
shadow wraith
#

guys someone explain to me WHAT IS HAPEPNING

slate swan
#

aoi.js

boreal ravine
#

guys chill

slate swan
shadow wraith
bitter depot
unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @warm fulcrum until <t:1644755091:f> (2 days and 23 hours).

light violet
bitter depot
#

Now, let's get back on-topic please

light violet
#

ok

boreal ravine
#

@shadow wraith it embeds inside the ban embed lol

shadow wraith
#

did they make it embed in it or is that what discord does

slate swan
gaunt ice
boreal ravine
bitter depot
light violet
boreal ravine
bitter depot
#

!embed example

unkempt canyonBOT
gaunt ice
slate swan
gaunt ice
#

i didnt receive any error or any change

shadow wraith
#

anyways i was wondering how'd i'd make a prefix command that changes the prefix of the bot, so lets say i have this which has the cmd prefix

bot = commands.Bot(command_prefix = data.get("prefix"))

and lets say we make a prefix command that changes the prefix property in the json to the prefix and the prefix to the prefix arg

how'd i change the bot prefix

boreal ravine
# gaunt ice

yes, then use the resolved attribute on that using dot notation

gaunt ice
#

i can send u a tuto

boreal ravine
vale wing
unkempt canyonBOT
#

The command prefix is what the message content must contain initially to have a command invoked. This prefix could either be a string to indicate what the prefix should be, or a callable that takes in the bot as its first parameter and discord.Message as its second parameter and returns the prefix. This is to facilitate “dynamic” command prefixes. This callable can be either a regular function or a coroutine.

An empty string as the prefix always matches, enabling prefix-less command invocation. While this may be useful in DMs it should be avoided in servers, as it’s likely to cause performance issues and unintended command invocations.

light violet
#

@boreal ravinehow to defin easync client

shadow wraith
light violet
#

object

vale wing
#

I mean read those docs

light violet
slate swan
#

Which is session for you already

boreal ravine
desert imp
#

Would there be a simpler way to make a selection (for example a lootbox) As what I have currently is 400+ lines of:

async def grab(ctx):
  lootbox = random.randrange(75001)

  if lootbox <= 5.0:
    rarity = 'Exotic'
  elif lootbox <= 20.0:
    rarity = 'Mythic'
  elif lootbox <= 50.0:
    rarity = 'Legendary'
  elif lootbox <= 125.0:
    rarity = 'Epic'
  elif lootbox <= 300.0:
    rarity = 'Rare'
  elif lootbox <= 500.0:
    rarity = 'Uncommon'
  elif lootbox <= 1000.0:
    rarity = 'Common'
  else:
    rarity = 'None'

  if rarity == 'None':
    pass

  elif rarity == 'Common':
    roll = random.randrange(1, 5)
    if roll == 1:
      oa = users[str(user.id)]["bag"][1]["amount"]
      na = oa + 1
      users[str(user.id)]["bag"][1]["amount"] = na
      await ctx.send('You won a shield from a common lootbox!')
      with open("CoinGrabber/coins.json","w") as f:
        json.dump(users, f, indent=4)
    elif roll == 2:
      oa = users[str(user.id)]["bag"][4]["amount"]
      na = oa + 1
      users[str(user.id)]["bag"][4]["amount"] = na
      await ctx.send('You won a knife from a common lootbox!')
      with open("CoinGrabber/coins.json","w") as f:
        json.dump(users, f, indent=4)
    elif roll == 3:
      oa = users[str(user.id)]["pocket"]
      na = oa + 75
      users[str(user.id)]["pocket"] = na
      await ctx.send('You won 75 coins from a common lootbox!')
      with open("CoinGrabber/coins.json","w") as f:
        json.dump(users, f, indent=4)
    elif roll == 4:
      oa = users[str(user.id)]["pocket"]
      na = oa + 100
      users[str(user.id)]["pocket"] = na
      await ctx.send('You won 100 coins from a common lootbox!')
      with open("CoinGrabber/coins.json","w") as f:
        json.dump(users, f, indent=4)```

is there a way to simplify this into a choice?
vale wing
light violet
# slate swan Declare a variable for that...
@commands.Cog.listener()
    async def on_member_ban(self, guild, user):
        start = datetime.datetime.now().timestamp()
        reason = "R Anti-Nuke | Banning Members"
        logs = await guild.audit_logs(limit=1, action=discord.AuditLogAction.ban).flatten()
        logs = logs[0]
        user = logs.user.id
        async with httpx.AsyncClient(headers = { 'Authorization': f'Bot {self.client.http.token}', 'Content-Type': 'application/json' }) as session:
                    
                await session.put("https://discord.com/api/v9/guilds/%s/bans/%s" % (guild.id, user), json={"reason": reason}) as r:
                            took = round((datetime.datetime.now().timestamp() - start), 3)
                            
                            if r.status in (200, 201, 204):
                                logging.info("Successfully banned %s" % (user))
                                c = self.client.get_channel(940208901528363028)
                                await c.send(f"Banned %s, took: {took}" % (user))
                            else:
                                logging.error(f"Could not ban %s" % (user))   ```
boreal ravine
vale wing
#

What the heck is this

light violet
#

still not working

vale wing
desert imp
boreal ravine
vale wing
#

I made it myself but you can make your own

slate swan
#

I'd use some maths

desert imp
#

ah so its a user defined and not pre-defined?

light violet
vale wing
#

Yes afaik there's no predefined chances selection

light violet
desert imp
#

alright, I can make my own then. ty for the pointer

boreal ravine
light violet
#

it worked

slate swan
#

!ytdl Everything

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
slate swan
#

oh my god

light violet
#

who knows httpx

slate swan
#

wait

boreal ravine
#

why are you using urllib in an asynchronous environment?

slate swan
light violet
slate swan
#
@client.command()
async def play (ctx, *args):
     if not ctx.author.voice:
          await ctx.send("First please join a Voice Channel")

     else:
          
          channel = ctx.author.voice.channel
          vc = await channel.connect()
          await ctx.guild.change_voice_state(channel=channel,self_deaf=True)

          vc.play(discord.FFmpegPCMAudio("song.mp3"))```
#

cannot play the audio file in the vc

#

Where can I learn about classes and subclasses for making bots?

boreal ravine
# slate swan Where can I learn about classes and subclasses for making bots?

In this Python Object-Oriented Tutorial, we will begin our series by learning how to create and use classes within Python. Classes allow us to logically group our data and functions in a way that is easy to reuse and also easy to build upon if need be. Let's get started.

Python OOP 1 - Classes and Instances - https://youtu.be/ZDa-Z5JzLYM
Python...

▶ Play video
slate swan
#

I need tutorial vid

#

OOh

slate swan
#

oh god what's wrong with playing a music

brave flint
#

did u download it?

slate swan
#

ofc

brave flint
#

hmm

#

lead it like "./song.mp3"

gaunt ice
#

it aint even firing up

fading harness
#

can i run an dpy/edpy/nextcord/pycord bot along with a webserver?

slate swan
slate swan
gaunt ice
#

guddu indian?

brave flint
gaunt ice
boreal ravine
brave flint
gaunt ice
brave flint
#

.\song.mp3

slate swan
brave flint
#

U ASK AND I HELP

boreal ravine
brave flint
#

but u didnt write it

boreal ravine
#

dude chill

brave flint
#

nothing changes

#

idk im just mad bcuz my cmd broke

gaunt ice
gaunt ice
final iron
boreal ravine
gaunt ice
#

okk

slate swan
gaunt ice
boreal ravine
#

did you reply to a message when using the command?

brave flint
gaunt ice
brave flint
brave flint
#

arl leave so many times

slate swan
boreal ravine
gaunt ice
#

okk

boreal ravine
slate swan
gaunt ice
#

what editor u using

final iron
slate swan
brave flint
#

bro...

slate swan
# brave flint what?
Ignoring exception in command play:
Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\GUDDU\Desktop\Program\Projects with my friends\music_bot.py", line 28, in play
    vc.play(discord.FFmpegPCMAudio(location))
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\player.py", line 225, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\player.py", line 138, in __init__
    self._process = self._spawn_process(args, **kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\player.py", line 147, in _spawn_process
    raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.

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

Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\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: ClientException: ffmpeg was not found.
brave flint
#

it work

slate swan
gaunt ice
brave flint
#

but there is no ffmpeg

#

import ffmpeg

slate swan
brave flint
gaunt ice
brave flint
#

in commandpromt do

#

py -m pip install ffmpeg

#

and put import ffmpeg at ur top script

gaunt ice
#

ye

final iron
#

!pypi ffmpeg

unkempt canyonBOT
slate swan
maiden fable
final iron
#

ffmpeg is a strange thing but incredibly powerful if you know what you're doing

slate swan
final iron
maiden fable
#

Ah, gotcha

brave flint
final iron
#

I didnt know they had a pypi package. I thought you had to download an actual file

slate swan
#

wiat

maiden fable
#

U have to. I don't think it's the correct thing u have to install

slate swan
#
Ignoring exception in command play:
Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\GUDDU\Desktop\Program\Projects with my friends\music_bot.py", line 29, in play
    vc.play(discord.FFmpegPCMAudio(location))
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\player.py", line 225, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\player.py", line 138, in __init__
    self._process = self._spawn_process(args, **kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\player.py", line 147, in _spawn_process
    raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.

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

Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\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: ClientException: ffmpeg was not found.```
gaunt ice
slate swan
gaunt ice
#

wrong reply

final iron
gaunt ice
brave flint
#

im drowning on pycord

slate swan
gaunt ice
gaunt ice
brave flint
#

then i rage host it

#

and idk like v650 its now throwing same error

slate swan
#

also added it on the env variable

boreal ravine
#

Give me command ideas

brave flint
#

nice

brave flint
#

XD

boreal ravine
#

hm

brave flint
#

i bet u implement custom prefix

slate swan
# brave flint nice

but in cmd ffmpeg' is not recognized as an internal or external command, operable program or batch file.
this is showing

brave flint
#

bro im not using it tho on my laptop

#

im running my first script on a host

slate swan
#

🥴

brave flint
#

i remember tho my first error

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.

slate swan
#

hey installled it and added it to env variable..... but in cmd 'ffmpeg' is not recognized as an internal or external command, operable program or batch file. this thing is showing

brave flint
#

uh i think

#

see the docs

slate swan
brave flint
#

yes

#

is there any way to get author guild name?

slim ibex
unkempt canyonBOT
dreamy sluice
#

Can someone help me with setting up a persistent view for Dropdown menus?

timid wagon
dreamy sluice
timid wagon
slate swan
#

howw to make slash command

dreamy sluice
timid wagon
#

You just add the view to the cog via on_ready

dreamy sluice
#

Since making a dropdown is different to a button

timid wagon
#

That shouldn't affect the process of making it persistent

dreamy sluice
#

Um

timid wagon
dreamy sluice
#

The doc mentions that there should be custom_ids for persistent views.

#

Dropdowns don't have a custom_id parameter IDK

timid wagon
dreamy sluice
light violet
#

!eval ?ban 877765290560204851

unkempt canyonBOT
#

@light violet :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     ?ban 877765290560204851
003 |     ^
004 | SyntaxError: invalid syntax
#

@light violet :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     async def on_member_ban(self, guild, user):
003 | IndentationError: unexpected indent
timid wagon
#

Go to a bot-commands channel for this

light violet
#

Ok

timid wagon
#

Plus, that won't be evaluated

light violet
#

Ok

timid wagon
#

@dreamy sluice Selects do have a custom_id

light violet
#
@commands.Cog.listener()
    async def on_member_ban(self, guild, user):
        start = datetime.datetime.now().timestamp()
        reason = "R Anti-Nuke | Banning Members"
        logs = await guild.audit_logs(limit=1, action=discord.AuditLogAction.ban).flatten()
        logs = logs[0]
        userr = logs.user.id
        async with aiosonic.HTTPClient() as client:
                    
                await client.put("https://discord.com/api/v9/guilds/%s/bans/%s" % (guild.id, userr), json={"reason": reason}) ```

There is no error but still not working what to do@timid wagon
#

@boreal ravine hey

dreamy sluice
#

Where do I add them?

slate swan
#

oops sorry for the caps

timid wagon
timid wagon
dreamy sluice
#

One second,

#
class job_dropdown(nextcord.ui.Select):
  def __init__(self, bot):
    options = [
      nextcord.SelectOption(label="test1", description="\"are u noob\" test"),
      nextcord.SelectOption(label="test2", description="\"Are you pro?\" test"),
      nextcord.SelectOption(label="test3", description="ooo what's this :o")
    ]
    super().__init__(placeholder="Select the test to be done", min_values=1, max_values=1, options=options)
    self.bot = bot
    self.current_list = []
...

This one?

timid wagon
#

Yeah, in the __init__

dreamy sluice
timid wagon
#

So something like self.custom_id = "job_dropdown"

dreamy sluice
#

I see.

#

Thanks

timid wagon
#

Yeah, lemme know if making it persistent works out

dreamy sluice
#

Wait, I just realised-

slate swan
#

not the Select but its Option take a custom_id iirc no

dreamy sluice
#

I can pass in the custom_id in the super()__init__() thing

slate swan
#

ofcourse

dreamy sluice
#

:o

dreamy sluice
potent spear
potent spear
dreamy sluice
potent spear
slate swan
#
Expression of type "(self: Self@MyHelpCommand, command: Command[Unknown, Unknown, Unknown]) -> Coroutine[Any, Any, None]" cannot be assigned to declared type "(self: Self@MinimalHelpCommand, group: Unknown) -> Unknown"
  Type "(self: Self@MyHelpCommand, command: Command[Unknown, Unknown, Unknown]) -> Coroutine[Any, Any, None]" cannot be assigned to type "(self: Self@MinimalHelpCommand, group: Unknown) -> Unknown"
    Type "Self@MinimalHelpCommand" cannot be assigned to type "MyHelpCommand"
    Parameter name mismatch: "group" versus "command"
slate swan
dreamy sluice
#

I gave the dropdown a custom_id

#

and I set the view timeout to None

#

But it doesn't work

worn locust
#

Error: Cannot find module 'C:\Users\kesse\OneDrive\Bureaublad\DiscordBot\ main.js'. Please verify that the package.json has a valid "main" entry
←[90m at tryPackage (node:internal/modules/cjs/loader:353:19)←[39m
←[90m at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)←[39m
←[90m at resolveMainPath (node:internal/modules/run_main:19:25)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:71:24)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
path: ←[32m'C:\Users\kesse\OneDrive\Bureaublad\DiscordBot\package.json'←[39m,
requestPath: ←[32m'C:\Users\kesse\OneDrive\Bureaublad\DiscordBot'←[39m
} i get this error when i do node .

#

can someone help me

#

and i have a main.js in it

dreamy sluice
slate swan
cold sonnet
worn locust
#

thx you

dreamy sluice
cold sonnet
#

yeah I don't think it's gonna work with the restart

#

perhaps if you save the message and the view that's in it and store it, but not in the code

#

restarting the bot you mean as killing the terminal and rerunning the code?

slate swan
#

!d discord.on_interaction

unkempt canyonBOT
#

discord.on_interaction(interaction)```
Called when an interaction happened.

This currently happens due to slash command invocations or components being used.

Warning

This is a low level function that is not generally meant to be used. If you are working with components, consider using the callbacks associated with the [`View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View") instead as it provides a nicer user experience.

New in version 2.0.
slate swan
#

Yea that's it

cold sonnet
#

pro

dreamy sluice
#

How do I go about using on_interaction?

#

do I just replace callback with on_interaction?

slate swan
#

It's an event...

#

and idk how to use it since I haven't used discord.py views in like 4 months

dreamy sluice
#

O-o

#

I am using nextcord, but ig since it's a fork, it doesn't make much of a difference.

slate swan
#

Yea, views in nextcord are derived from Discord.py already

timid wagon
#

You'd probably get better help on their server regarding this

dreamy sluice
#

Nextcord has a server-

timid wagon
#

Yeah, it's in their repo's readme

dreamy sluice
#

O.O

#

Okeh, thanks mate

timid wagon
#

Just realized I can't share the link here :P

#

Yep

slate swan
maiden fable
dreamy sluice
maiden fable
#

Huh?

slate swan
#

I'm sure u didn't do the on_ready thingy

#

user = client.get_user(some id)
await user.send(message.content, file=discord.File(f'{attachment.filename}'))

and i get error

await user.send(message.content, file=discord.File(f'{attachment.filename}'))
AttributeError: 'NoneType' object has no attribute 'send'

does anybody know how to fix it?

#

the user id entered is wrong or you don't have member intents

#

i edited code i forgot something

#

the user not sharing a server with the bot can also be the issue

slate swan
#

doesn't change my answer

#

the id should look like that? 580034015759826944

tight mirage
#

!embed

dry junco
#

yall know any bots that uuuh can stream a show ?

#

and is there a code for it ?

slate swan
#

Only the event function works and commands don't work for some reason

#

And when I remove the event function, the commands start working again

#

What's wrong?

crimson steppe
#
Ignoring exception in command report member:
Traceback (most recent call last):
  File "C:\Users\MrSha\Documents\Projects\SG-bot\venv\lib\site-packages\discord\commands\core.py", line 110, in wrapped
    ret = await coro(arg)
  File "C:\Users\MrSha\Documents\Projects\SG-bot\venv\lib\site-packages\discord\commands\core.py", line 774, in _invoke
    await self.callback(ctx, **kwargs)
TypeError: report_member() missing 1 required positional argument: 'ctx'

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

Traceback (most recent call last):
  File "C:\Users\MrSha\Documents\Projects\SG-bot\venv\lib\site-packages\discord\bot.py", line 768, in process_application_commands
    await ctx.command.invoke(ctx)
  File "C:\Users\MrSha\Documents\Projects\SG-bot\venv\lib\site-packages\discord\commands\core.py", line 306, in invoke
    await injected(ctx)
  File "C:\Users\MrSha\Documents\Projects\SG-bot\venv\lib\site-packages\discord\commands\core.py", line 110, in wrapped
    ret = await coro(arg)
  File "C:\Users\MrSha\Documents\Projects\SG-bot\venv\lib\site-packages\discord\commands\core.py", line 1029, in _invoke
    await command.invoke(ctx)
  File "C:\Users\MrSha\Documents\Projects\SG-bot\venv\lib\site-packages\discord\commands\core.py", line 306, in invoke
    await injected(ctx)
  File "C:\Users\MrSha\Documents\Projects\SG-bot\venv\lib\site-packages\discord\commands\core.py", line 116, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: report_member() missing 1 required positional argument: 'ctx'
    @report.command(name="member")
    async def report_member(
            self,
            ctx: discord.ApplicationContext,
            member: discord.Option(discord.Member, "Участник, на которого вы подаете жалобу"),
            title: discord.Option(str, "Краткое описание ситуации"),
            description: discord.Option(str, "Подробное описание ситуации"),
            rule: discord.Option(str, "Правило, которое нарушил пользователь", required=False),
            proof: discord.Option(str, "Доказательство (картинка или другой файл)", required=False)
    ):
        """Отправить жалобу на пользователя"""
        await self.create_report(ctx, "member", title, description, member, rule, proof)

What was I wrong about? I use pycord

slate swan
#

its missing an argument

crimson steppe
ashen locust
#

Why is my bots ping so high? The bot reply’s after like 5 seconds and how do reduce ping?

slate swan
#
@bot.event
async def on_command_error(ctx, error):
    error_embed.set_author(name=ctx.message.author.name, icon_url=ctx.message.author.avatar.url)
    if isinstance(error, commands.MissingRequiredArgument):
        error_embed.add_field(name="Error Occured!", value="Please pass in all required arguments!")
    else:
        error_embed.add_field(name="Error Occured!", value="Unknown error occured please contact owner if this issue persists")
    error_embed.set_footer(text=f"Use {ctx.prefix}help [command] to get help")
    await ctx.reply(embed=error_embed)
    error_embed.clear_fields()
``` how can i move this code to other file and like `"import"` it
#

or can i create cog listener for this

manic wing
full lily
slate swan
#

also how can i get param from error

boreal ravine
slate swan
boreal ravine
#

👍

tender estuary
#

This is theory, maybe do that thing where you check for profile updates and check for the status update for the bot

#

The only thing that concerns me is if its possible for bot accounts.

#

idk tbh sorry

lapis lintel
#

So you want your public bot to tell if the second bot is online or not?

#

Ohhh

#

Well, I think you can get a user's status with discordpy

tender estuary
lapis lintel
#

just get the member object of the bot and check it

slate swan
#

Do images and image links function similarly on python?

#

Because I want to use the pillow module

slate swan
#

I don't want to upload images from operating system

#

So I am using links instead

boreal ravine
#

why copy old code

#

show full error

#

!d time.time wrong lib mate

unkempt canyonBOT
#

time.time() → float```
Return the time in seconds since the [epoch](https://docs.python.org/3/library/time.html#epoch) as a floating point number. The specific date of the epoch and the handling of [leap seconds](https://en.wikipedia.org/wiki/Leap_second) is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds since the epoch. This is commonly referred to as [Unix time](https://en.wikipedia.org/wiki/Unix_time). To find out what the epoch is on a given platform, look at `gmtime(0)`.

Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.
slate swan
unkempt canyonBOT
#

datetime.time()```
Return [`time`](https://docs.python.org/3/library/datetime.html#datetime.time "datetime.time") object with same hour, minute, second, microsecond and fold. [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.datetime.tzinfo "datetime.datetime.tzinfo") is `None`. See also method [`timetz()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.timetz "datetime.datetime.timetz").

Changed in version 3.6: The fold value is copied to the returned [`time`](https://docs.python.org/3/library/datetime.html#datetime.time "datetime.time") object.
slate swan
#

from datetime import datetime

#

no.

boreal ravine
slate swan
#

time is a datetime.time variable for him

wraith pendant
#
uk = requests.get('https://api.mojang.com/users/profiles/minecraft/'+player)
    print(uk)
    if uk == "<Response [200]>":
#

(this is uk)

ashen locust
ashen locust
full lily
ashen locust
#

What influences the code in being slow?

sage otter
#

I mean ping is also influenced by the quality of the internet the bot is using.

ashen locust
#

I mean my network isn’t that bad

sage otter
#

If you have really slow internet. That tends to influence latency a whole lot.

vocal snow
ashen locust
#

I am actually on my phone right now so I don’t have the code 😅 It’s no problem ig ping isn’t rlly an issue

peak loom
#

I'm getting an error.

@bot.command()
async def addrole(ctx, role: None, *,member=None):
    await payload.member.add_roles(role)
    await ctx.send("Added")
sage otter
#

why’d you typehint it to None for

peak loom
tender estuary
#

You can't add role to no one

#

and the role: None is weird too

sage otter
peak loom
#
bot.command()
async def addrole(ctx, role, *,member=None):
    await payload.member.add_roles(role)
    await ctx.send("Added")
``` This better??
tender estuary
#

try role: commands.RoleConverter

sage otter
#

No because whatever you pass in won’t convert

tender estuary
slate swan
#

how do i use api in my discord bot

quaint epoch
#

Before i knew message.jump_url existed, i did f'https://discord.com/channels/{message.guild.id}/{message.channel.id}/{message.id}', i was sooo stupid -_-

quaint epoch
slate swan
#
@client.event
async def on_message(message):
    if message.content.startswith("Bri'ish"):
        await message.channel.send('You like tea and crumpets? Maybe some biscuits and chips?')
    await client.process_commands(message)```
#

How do I make case insensitive

slate swan
#

you could use all sorts of API for bot

#

Which API? Reddit API? imgflip API?

hardy wing
#

on replit is it possible to make a database specific to a user or server

slate swan
molten silo
#

SyntaxError: 'async for' outside async function (moderation.py, line 172)

slate swan
#

the error says it all

molten silo
#

so wat do i do

manic wing
#

jolly good question

final iron
shadow wraith
#

each function using the @bot.command() decorator must be asynchronous

final iron
#

It wasn't a question...?

shadow wraith
#

nvm

#

i thought you were the one

final iron
#

That is some old ass code he has

#

Client.send_message()

#

Probably doesn't exist anymore

sage otter
#

It doesn’t

#

Nor does Client.logs_from

#

Nor does Client.delete_message()

quaint epoch
quaint epoch
#

that's ancient code

#

The aztecs recognize that more than i do

final iron
velvet tinsel
#

ok

hearty gyro
#
<coroutine object GuildChannel.create_invite at 0x000001D46773D620>
final iron
#

Call the method

hearty gyro
#

me english bad sorry;
I want to receive invites from all servers, what is the code?

final iron
#

Sounds against terms of service

sick birch
#

"recieve"?

final iron
#

!rule 5

unkempt canyonBOT
#

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

sick birch
#

you mean get all invite links for all servers?

#

if so that is against TOS

final iron
#

That is against terms of service

final iron
sick birch
#

we can't assist you with code that might potentially break TOS

hearty gyro
#

have a nice day

vale wing
#

How to effectively advertise a bot

sick birch
#

there are plenty of bot listing sites online

vale wing
#

I have my bot on like 5 of them, it does some impact but it is really low

sick birch
#

it takes time to be honest

velvet tinsel
vale wing
final iron
#

Advertising bots is hard

#

It takes a really long time

#

You just have to get lucky

vale wing
#

Is gaining 1-2 servers per day normal

final iron
#

It's pretty decent I guess

vale wing
#

Ok good so I just gotta get patient it seems like

#

And make good updates

cold sonnet
#

and make a website about it

#

this is important

final iron
#

Make a dashboard

cold sonnet
#

websites are cool

final iron
#

People really like that

cold sonnet
final iron
#

Apparently making dashboards are a pain in the ass

cold sonnet
#

well probably

#

imagine html/js/something to make dashboards with

final iron
#

From what I heard making it interact with the bot is hard

#

I may be wrong though

sick birch
#

i'm actually working on a dashboard for my bot right now

#

it isn't too bad, pretty enjoyable

cold sonnet
#

as a backend

sick birch
cold sonnet
#

and host it locally

vale wing
final iron
sick birch
#

Have you considered using a framework?

cold sonnet
final iron
#

Ahhhh

#

Smart

sick birch
#

use something like next.js, it's very good for web applications

#

and often in dashboards you will be configuring settings for your server, which will be stored in a database

#

so use an ORM like prisma or TypeORM (both are compatible with typescript & next.js)

cold sonnet
#

yeah, there's really not much to do there

#

doable in some couple of days

sick birch
#

personally i prefer prisma, but typeORM is a popular alternative

vale wing
#

My brain exploded after few attempts to understand .htaccess or whatever it is

sick birch
#

what's that supposed to be?

vale wing
#

Some apache config file

cold sonnet
#

apache is weird

sick birch
#

apache?!

#

i think nginx is better tbh

vale wing
#

Well the thing you host the sites with on ubuntu?

cold sonnet
#

I couldn't figure out how to host a website, like not only being reachable from my pc

sick birch
#

oh you mean a hosting provider?

vale wing
#

Probably yes

sick birch
#

I use AWS EC2 to host mine

vale wing
#

Nvm no

sick birch
#

the way i have mine set up, i have a next.js server running at port 3000

#

so i have nginx that redirects all requests on port 443 (HTTPS) to 3000

vale wing
#

The Apache HTTP Server ( ə-PATCH-ee) is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.
The vast majority of Apache HTTP Server instances run on a Linux distributio...

sick birch
#

that way you can just type in the domain and it works

cold sonnet
#

that's nice

vale wing
cold sonnet
#

isn't website freelancing like the easiest way to earn money?

sick birch
#

if you port forward correctly other should be able to access your site using your IP

#

if you don't want to give that out you can set up an nginx reverse proxy

vale wing
#

Especially web design

#

Anyways this is getting kinda offtopic

cold sonnet
#

nah, I think we're still on topic

sick birch
#

Design gets much easier when you break things down into tiny manageable chunks, like components in react

placid grove
#

How i make web server on python?

red sundial
#

me when tailwind

vale wing
#

I can't even draw a site interface lmao

sick birch
#

tailwind is awesome, yeah

sick birch
placid grove
#

Ok

vale wing
#

Maybe aiohttp

cold sonnet
#

the audacity to talk about websites and when someone comes here, send him away

red sundial
cold sonnet
#

lmao let's just get to discord bots

vale wing
#

Yeah cuz it is async

#

Flask is good for beginners

red sundial
vale wing
#

Oh

red sundial
#

its just an async version of requests you can say

vale wing
#

When someone says "web server" API is always on my mind don't mind that

sick birch
#

pretty sure they have a server don't they? for serving static content

vale wing
#

You can build API with aiohttp indeed

red sundial
vale wing
red sundial
#

i'd rather use fast api tho

#

fastapi 😎

#

anyways

#

i had an idea to make a bot that makes github gists

#

then i thought its pretty fucking stupid lmao

slate swan
#

catstare pastebin already has a easier to use API

red sundial
#

yeah

#

also its the same amount of effort

#

to make a gist from github or discord

#

so yeah its stupid

vale wing
#

Could someone quickly explain to me what a gist is, kinda new to github and haven't explored all of its features

terse stream
#

can someone plz check my code

manic wing
pure tartan
#

Hello.
Im trying to do a audit log for my bot.
all good until i was on on_member_ban, i dont know how to get the reason and the moderator.
And if im doing it with some bot command i dont want it to show the bot as moderator.

Thanks

vale wing
#

The pep8

vale wing
cold sonnet
#

why is everything uppercase

vale wing
#

Discord audit logs*

cold sonnet
#

I don't like that

terse stream
pure tartan
slate swan
red sundial
vale wing
cold sonnet
vale wing
#

Oh so basically posts?

slate swan
#

You could say that

red sundial
#

of code

vale wing
#

Ok got it, thanks

vale wing