#discord-bots

1 messages · Page 95 of 1

slate swan
#

yeah but its animated its also custom

#

so you need the ID

#

ok

honest shoal
#

🥸

slate swan
#

LMFAO

#

let me try

slate swan
#

then send in chat

silk fulcrum
slate swan
slate swan
#

yeah your just using the name

#

lol use need id too

silk fulcrum
#

or their bot is not on the server where that emoji is

#

or it doesnt exist

slate swan
#

he already clarified it is

#

\:FlashWhiteHeart: = :FlashWhiteHeart:```
#

also

#

w the id but it turns to that

#

your not doing it right lmao

honest shoal
slate swan
#

then you send in chat and it turns to this !kekw

honest shoal
silk fulcrum
slate swan
#

omg

#

there u go

silk fulcrum
# honest shoal

u dumass how dare u dont use python but use vscode when running python code

#

:lmaoXX2:

honest shoal
silk fulcrum
#

its a dumb code

slate swan
silk fulcrum
#

who is that meme man? @honest shoal

slate swan
#

still doesnt work

silk fulcrum
#

is he like 9 y/o?

honest shoal
#

@silk fulcrum

slate swan
silk fulcrum
#

cool'

slate swan
#

how do i put access

silk fulcrum
slate swan
#

i did

#

i took the emoji from the server

silk fulcrum
#

did you provide the emoji that is in your server?

slate swan
#

yes

silk fulcrum
#

I mean you can do \:socoolemoji:

slate swan
silk fulcrum
#

which will be the emoji from that server

slate swan
#

ill try now

silk fulcrum
#

and you can do \:socoolemojionmyserver: which is on your server

slate swan
#

:FlashWhiteHeart:

#

WORKED

#

OMGGGG

#

TYSM TYSM STYTAYSYDFG BSA7UYITTGNDSAUY

silk fulcrum
#

no need to spam tho

#

but 🎉 anyways

honest shoal
silk fulcrum
#

run it with python

#

i cant hold wtf

#

I barely avoided capslock

honest shoal
#

💀

silk fulcrum
#

Discord_Beta_Test.py :lmaooooo:

#

is this dude making new discord :bruh:

honest shoal
#

I was just checking the code & wow

#

whoever made it, is very free

silk fulcrum
#

i dont know what to say

#

why, just why

tidal hawk
honest shoal
#

a school project

tidal hawk
#

Hahaha

honest shoal
silk fulcrum
honest shoal
#

blocked him

tidal hawk
#

HAHAHHA

#

Soo innocent lmao

silk fulcrum
#

waiting

#

for him to come here

#

next time that guy will come with a huge site written on Laravel that has 49654577654875 dependencies and requirements and ask for us to run it on PHP

primal token
tidal hawk
#

Speaking of cool projects, I made this | Discord bot Discord B)

#

Y can log in as bot and do stuff

silk fulcrum
#

and what are deez msgs

honest shoal
silk fulcrum
#

authors are same as text

tidal hawk
#

5 days into that project

silk fulcrum
#

oh custom theme?

#

oh nvm im dumbass

tidal hawk
#

xd

silk fulcrum
#

forget what i said

primal token
silk fulcrum
#

it's python only discord

tidal hawk
honest shoal
#

chat using webhooks

primal token
tidal hawk
#

Chat using Gateaway and websockets

honest shoal
silk fulcrum
#

5 elur!

primal token
tidal hawk
#

Yep :d

brazen raft
#

Does it not count as self-botting though

#

I mean it might be using a bot token

primal token
#

no

silk fulcrum
#

if that is a bot then it doesnt

#

you're doing the same when making api requests via code

primal token
#

I doubt it, you're just making a discord bot and making a GUI with its payloads etc, a self bot is using your token with automation

silk fulcrum
#

maybe

tidal hawk
#

☝️

honest shoal
tidal hawk
primal token
#

@tidal hawk can i contribute to the project?

honest shoal
primal token
#

I only work with back-end for your information

silk fulcrum
#

oh my god! I found such an amazing tool: google drive, I'll 100% use it instead of git

tidal hawk
primal token
#

You should also set up docker

primal token
tidal hawk
#

xD

primal token
#

ahhh wait, youre using TS for back end

honest shoal
tidal hawk
#

Bruh I only used it bcs it shows instantly when somethings wrong

#

What's wrong with that?

primal token
#

Nothing, i just mainly like working with python backend

tidal hawk
#

Oh

#

Yeah it's nextjs project

primal token
#

😡

tidal hawk
#

I tried getting into Django, flask etc, but js frameworks seemed more reliable xd

primal token
#

yeah

tidal hawk
#

But JS discord bots are 🤮

#

I only learned js bcs of web

primal token
#

You gave me an idea, making a discord bot CLI with ascii

#

ill probably do it after i make my lang for thought

tidal hawk
#

Nice idea :D

silk fulcrum
tidal hawk
#

I don't like js that much

silk fulcrum
#

im not in them, but I can't say they are 🤢

#

i made one or two

tidal hawk
#

like you have to make slash commands in seperate files

#

I think itäs way more complicated to make a bot than in python

tidal hawk
#

cogs are wonderful in py

honest shoal
#

then how will you use cogs

slate swan
#

👀

#

You guys using discord py 2.0 ??

honest shoal
#

I use disnake

slate swan
#

Anyone here have any idea about how can I fetch random yt music videos urls pithink

primal token
# tidal hawk Nice idea :D

Or i can make a CLI domain language so then i can write the discord bot CLI in that domain language😳

slate swan
honest shoal
#

he's really innocent

slate swan
#

i think he dmed the whole server lmao

honest shoal
#

I think

#

I posted a lot off-topic

primal token
slate swan
primal token
#

old codebase

#

I'm not talking about newer abstractions

slate swan
#

i thought u was being saracastic

primal token
#

Never said i wasnt being sarcastic neither did i say i was being sarcastic

tidal hawk
honest shoal
austere bane
#

i'm trying to create a bot to learn some python, but i'm new to reading documentation, and i feel like the discord documentation is a bit overwhelming. i just can't seem to figure out how a lot of the stuff works, and a lot of the guides/youtube tutorials i find seem to be out of date.

how can i get the name of the voice channel i'm in? i'm trying:

        async def chan(self, ctx, user: discord.Member = commands.Author):
            channel = user.voice.channel
            await ctx.send(channel)```
but i'm pretty clueless. feel like an idiot trying to figure this stuff out :\
#

by new to documentation i mean i've mostly used the standard libraries before. and if i've used others, i've managed to find most of the info i need by googling

meager chasm
#

Discord.py pretty complex lib so understandable that ur confused

fading marlin
#

Also, if you're just starting to learn Python, discord.py isn't the best beginner-friendly project to start with

austere bane
#

i don't know... it wont send the channel name to the chat when i use the command :S

meager chasm
#

I would say you just learn OOP in python (classes and objects and the like) and then you'll be able to read documentation

meager chasm
fading marlin
fading marlin
meager chasm
#

But why isn't it documented

fading marlin
#

namespace seems to be weird though

#

!d discord.discord.ext.commands.Author

unkempt canyonBOT
#

discord.ext.commands.Author```
A default [`Parameter`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Parameter "discord.ext.commands.Parameter") which returns the [`author`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.author "discord.ext.commands.Context.author") for this context.

New in version 2.0.
fading marlin
meager chasm
austere bane
#

yeah, i was told to use commands.Author the other day, as thats how its done in new version

#

i've made sure i'm in a voice channel when i tried the command

#

so shouldn't it return something then?

meager chasm
austere bane
slate swan
#

can you show code

austere bane
#

fml

#

spent friggin hours troubleshooting

#

sometimes programming is just the worst 😛 thanks for trying to help though 😉

faint sapphire
faint sapphire
fading marlin
#

if you're not subclassing Bot, you can use bot vars to achieve the same thing

from discord.ext import commands
bot = commands.Bot(...)
bot.something = "stuff"

then, inside a cog for example

@commands.command()
async def command(ctx: Context, ...):
    stuff = ctx.bot.something  # evaluates to "stuff"

you can implement this same concept with your database connection

#

be careful what you name your variables though, otherwise you might override something

next prairie
#

on vscode btw

#

any help?

sick birch
mental hollow
#

how do i and where can I learn about responding to slash commands using http?

slate swan
#

why does this not work?

#

if user_input == "end":
break

edgy plinth
slate swan
#

hmm ok

edgy plinth
#

im guessing u dont have a error

slate swan
#

nope

fading marlin
edgy plinth
#

is this code in a subroutine / function, make sure ur passing in the ver

edgy plinth
#

np

slate swan
#

are there any free 24/7 hosts i can use to make my discord bot run all the time

edgy plinth
slate swan
#

so there aint no webite that keeps the code running

edgy plinth
#

idk

slate swan
#

aight thx

#

u use ping? as a monitor type

slate swan
edgy plinth
#

use this code

#
from flask import Flask
from threading import Thread

app = Flask("")

@app.route("/")
def home():
  return "Hello. I am alive!"

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

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

put this in a different file e.g

#

then in ur main program put:

slate swan
#

ooh ok

edgy plinth
#

then before u do client.run put this

slate swan
#

soo keep_alive() before client.run?

edgy plinth
#

get a url from Webview and put it into uptime robot

edgy plinth
slate swan
#

okk

#

but how do i connect uptime website to the repl.it

edgy plinth
#

u need that url

#

ur version

slate swan
#

how do i get one

#

sorry ima noob just started learning this

edgy plinth
#

there is a url

slate swan
#

whats web view ahaha

edgy plinth
slate swan
#

yeah but i get so many errors on replit

edgy plinth
slate swan
edgy plinth
#

ah

#

intents

slate swan
edgy plinth
#

ill give u the way i did it

slate swan
#

aight

edgy plinth
#
from discord import Intents
Intents.message_content = True
client = discord.Client(intents = Intents.all())

slate swan
#

still

edgy plinth
#

let me see ur code

slate swan
#

yeah aight

#

ill send it in dms

edgy plinth
#

alr

slate swan
#

they have an insane free tier, you get a vps and just use pm2 to keep the bot running.

blazing estuary
slate swan
#

because you are using intents

#

that are not enabled in the dev porta

wispy spade
#

also I don't think you should be using abc classes for creating things?

blazing estuary
#

I'm just copying the code, I am in over my head, I've only ever worked with python once back in 2016

#

I'm trying to get this intent

#

the invite_create

fading marlin
#

use Intents.default then

fading marlin
slate swan
#

you need to enable the intents inside of dev portal pretty sure you also need guild intent to create invites .

wispy spade
wicked atlas
#

Don’t confuse intents for permissions, they are two different things

wispy spade
slate swan
#

he doesn't have them enabled in dev portal lol look at the error

wicked atlas
#

That could be any of the privileged intents, since they’re using Intents.all()

blazing estuary
#

Ah okay, yea that was the issue, so it got passed that, but yea now I'm stuck on the abc class thing of it

slate swan
#

you need an actually channel object

wispy spade
wicked atlas
wispy spade
fading marlin
#

don't do stuff it on ready either

primal token
wicked atlas
#

Strange that you exit your script after going through on_ready

primal token
#

Segfault moment

blazing estuary
#

I am just taking what was in the stack overflow

#

and trying to make it work

#

lmao

wispy spade
wispy spade
blazing estuary
#

yea it doesn't even have intents in it

#

That's why I was trying to get help for it to be used with current changes in discord.py

wispy spade
# primal token Not exactly

An object can refer to an instance, for example 20 is technically an instance of int and is also an object. Unless object "blueprints" (classes) are also objects themselves, it should be enough info to infer that I'm referring to c (an object or an instance of a class)
*just verified the "unless" clause, classes are themselves objects too

blazing estuary
#

I'm really dumb, is there anyone willing to help me in dm's so I don't clog this channel?

wicked atlas
blazing estuary
#

I tried that to no avail

#

I can maybe open another one I guess

slate swan
#

what do you need helpo with ?

#

you already have a channel object

wicked atlas
blazing estuary
#

Alright, so I changed it to the c.invite and c.create_invite but it just made it an error, what did I change wrong

slate swan
#

why are you doing c.invites(c)

wicked atlas
slate swan
#

what is the meaning behind that lol

blazing estuary
#

now we're here

wicked atlas
#

That one is because you're calling exit()

blazing estuary
#

ye I removed that after I posted it

#

now it's just printing "Finished. Exiting soon..."

wicked atlas
#

It does this by raising the SystemExit exception, which discord.py probably picks up and raises

primal token
blazing estuary
#

I feel like there is an easier way to create multiple single use invite codes, that I can send to different people at will

#

But I can't wrap my head around it

sick birch
#

No need to re-assign i

#

Just give it a new variable name, that should be your invite

wicked atlas
sick birch
#

Also keep in mind invites is always going to be less than 75 so you should have an infinite loop

blazing estuary
#

well I have a paid subscription service to enter the server, and I need to make say 48 invite links to send out, but I can only make one link at a time through discord, then once they use it, only then can I make a new link

#

so I was trying to find a way where I can make 48 or however many sing use, permanent invite links to my server, without having to do it one by one after each person joins

blazing estuary
sick birch
blazing estuary
#

Ah I see, well now I'm here

#

someone mentioned on_ready being a problem earlier, is this what is affecting ti

wispy spade
#

c.invites() does not take any arguments, so c.invites(75) will error

blazing estuary
#

So I'm pretty sure the code I got was just hog wash then no? Or is it just because it was outdated

blazing estuary
#

yea because no form of editing this creates any shape or form of a discord link invite

#

all it does is print, well, what's in print

sick birch
#

!d discord.TextChannel.create_invite

unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") to do this.
wispy spade
wicked atlas
#

oracle cloud free tier is really annoying

#

I don't know if this is just me or what, but I can't find anywhere that I change the info I put into it like my email, phone, etc.

#

They keep sending me emails and calling me too

slate swan
#

what is result1[0]

blazing estuary
#

Alright my friend sent me this, it is supposed to make a CSV file with invite links, but I think I'm doing something wrong

primal token
#

If its an int why is it in an f string?

#

And you're probably showing the wrong part of the code

jagged adder
#

i have a command in my bot that creates a channel and overwrites permissions for that channel so only the user/bots/admins can see it. I want a way to be able to 'invite' people to be able to view that channel (i was thinking of using mentions and a keyword ie &invite, then pull the mentions and add them somehow).
The issue is im not sure how to give select other users the perms to see it. Ive thought about custom server roles, but i dont know how to make it so the person granted x role cant see all other open chatrooms.
You could think of this as a way to have dms on a server, or in my case, this is to allow people to be invited to join a game run in an otherwise private channel.

#

perhaps theres a way for the bot to create a temporary role, and set the channel to need the matching role to see it?
Then delete the role once a certain time has passed or some such

slate swan
jagged adder
slate swan
#

its a slash command

#

so the member mentioned

#

like this
/inviter @slate swan

jagged adder
#

ah i havent dabbled in slash commands

slate swan
#

ahhhh

#

you can still do the same with chat cmds

#

i havent used them tho lmao so i wouldn't know how, but you can just get the person mention in the chat cmd

jagged adder
#

alr

#

yeah i can deal with pulling the person

jagged adder
slate swan
#

the overwrites

jagged adder
#

unless im not understanding part of how its working lol

slate swan
#
overwrites = {
        member: disnake.PermissionOverwrite(
            view_channel=True, send_messages=True,
        ),
    }
#

then you edit the channel with those overwrites

jagged adder
#

i understand how the overwrites work

#

just not where the code gets who im actually mentioning; i would think i would need to replace something with a var

#

and add the mentioned user to that var

slate swan
#

wait dont use overwrites cause i think it will get rid of the original you can use this instead so it only changes for that user.

await channel.set_permissions(member, read_messages=True,
                                                      send_messages=False)
jagged adder
#

with member being the var ?

jagged adder
#

ohh r u using member as the var

#

sorry for the lack of understanding xd

#

it just didnt quite gel till just now what u were doing

slate swan
#
@bot.command()
async def inviter(ctx, member: discord.Member):
    await channel.set_permissions(member, read_messages=True, send_messages=False)
    await ctx.send(f"{member} added to the channel")
#

all you need

jagged adder
#

i just realised one issue; i cant ping people who cant see the channel alrdy

slate swan
#

just make a channel for commands

#

and add a param for channel

#

in the cmd deco

#

or you can still do in that channel but take member id instead then get member object

jagged adder
#

i was thinking of that

#

its not exactly convenient for other people to do that tho, as this isnt a developer server or anything

#

is there a way to use slash commands that let u show everyone in the server as a choice for a parameter?

#

seeing as u r familiar with em

slate swan
#

nah if they don't have perms to that channel the slash cmd is being executed in then you can't mention them

jagged adder
#

damn

#

can u think of any workaround atm

#

i guess i could make a command that lets people get the id of whoever they pinged

#

its a lil messy but could work

slate swan
#

you can still ping ppl in channels they cant see

jagged adder
#

what

#

u can ?

slate swan
#

yeah

jagged adder
#

u need the id tho right

#

and write it up like @spark hamlet ?

#

oh shit

slate swan
#

i actually right clicked their name in a normal channel hit mention then copied it from chat box and pasted in that channel

#

but ye you can also do like that

#

but its kind of annoying if youre just a normal user

jagged adder
#

also do u know if its possible to have 2 people running on the same version of an instantiated class

#

ie if i had 2 people who were in diff channels but could interact with the same info

#

and modify it

thorny flint
#

How do I append an async function to a dict, without triggering it?

a_dict = {}
a_dict.update({"ID_1": await an_async_function(arg1, arg2)})

I want to add it now but trigger it later by doing something like a_dict["ID_1"], when clicking on a button

I tried to do this, without await

a_dict.update({"ID_1": an_async_function(arg1, arg2)})

to later do this: await a_dict["ID_1"]

But it wouldn't let me.
It will give me error about that I need to put await in it, before it can continue

unkempt canyonBOT
#

loop.create_task(coro, *, name=None)```
Schedule the execution of [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine) *coro*. Return a [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") object.

Third-party event loops can use their own subclass of [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") for interoperability. In this case, the result type is a subclass of [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task").

If the *name* argument is provided and not `None`, it is set as the name of the task using [`Task.set_name()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.set_name "asyncio.Task.set_name").

Changed in version 3.8: Added the *name* parameter.
thorny flint
torn sail
#

Could someone send me the discord.py source for where interactions are processed for like views and all commands?

#

I’ve looked and I couldn’t find it

slate swan
hushed galleon
thorny flint
slate swan
#

ack I need help

rugged shadow
lilac oriole
#

what's the problem?

vocal snow
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

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

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

vocal snow
slate swan
vocal snow
slate swan
# lilac oriole what's the problem?

first of all put your token lol client.run(“TOKEN”)
and turn on the intents on ur bit and write tgat after the “*”, intents=discord.Intents.all()

slate swan
lilac oriole
slate swan
slate swan
#

send ur code please

#

in here or dm?

#

id preffer DM :p

#

Okay then

vocal snow
unkempt canyonBOT
#
Install packages with `python -m pip`

When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.

Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.

Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.

vocal snow
#

And run your code with the python command instead of through your ide

steep river
#

What's the best way to see if message has a thread created? Trying to delete message and thread if it exists.

ionic edge
#

is this a group under group ??

slate swan
slate swan
#

Hey, can someone help me with making a button that says “claim” and hen you tap on it it changes to “claimed by - {the user name}”

slate swan
#

Okay

slate swan
#

Thankss

#

welcome, you can always ask for help here if you face any issues regarding those

slate swan
ionic edge
#

like i want to make

#

?autorole human add <@role>

slate swan
#

nested grouos aren't a thing though, add is probably an argument

#

groups*

ionic edge
#
    @commands.hybrid_command(
        name="userinfo",
        description="Get some useful information about a user.",
        aliases=["ui"]
    )
    @checks.not_blacklisted()
    async def userinfo(self, context: Context, *, user: discord.User = None) -> None:
        if user is None:
            user = context.author
        account_created = discord.utils.format_dt(user.created_at, style="R")
        id = user.id
        name = user.display_name
        if user in context.guild.members:
            joined_at = discord.utils.format_dt(user.joined_at, style="R")
            roles = [role.mention for role in context.author.roles if role.name != "@everyone"]
            if user.bot:
                roles.append("Bot")
                embed = discord.Embed(
                    title="__User Info__",
                    description=f"**Username:** {user.mention} \n **Nickname:** {user.display_name}\n **ID:** {id}\n **Bot Account? : Yes ✅**\n**Account Created:** {account_created}\n**Joined Server:** {joined_at}",
                )
            else:
                embed = discord.Embed(
                    title="__User Info__",
                    description=f"**Username:** {user.mention} \n **Nickname:** {user.display_name}\n **ID:** {id}\n **Bot Account? : No ❌**\n**Account Created:** {account_created}\n**Joined Server:** {joined_at}\n**Roles:** {', '.join(roles)}",
                )

        await context.send(embed=embed)
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'User' object has no attribute 'joined_at'

#

error

#

if the user is in guild then i am getting this error

naive briar
unkempt canyonBOT
#

An aware datetime object that specifies the date and time in UTC that the member joined the guild. If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be None.

ionic edge
heavy folio
#

what

naive briar
ionic edge
naive briar
# ionic edge is there any other way?

You could use typing.Union and check if the argument is Member or User before getting the joined_at

import typing

...

async def userinfo(
    self,
    context: Context,
    *,
    user: typing.Union[discord.Member, discord.User] = None,
):

    ...

    joined_at = None # Default value
    if isinstance(user, discord.Member): # Check if `user` is an instance of `discord.Member`
        joined_at = discord.utils.format_dt(user.joined_at, style="R")

You can improve this later, but I'll keep it simple

jagged adder
#

is it possible to make a link of some kind that when clicked makes my bot perform an action? i dont mean like a button or a reaction, but an actual link. its fine if it only works within the server

slate swan
naive briar
#

Idk that's how I'll do it 🫠

slate swan
slate swan
jagged adder
#

i dont mean a website link (i hope it doesnt involve a website anyway)

jagged adder
#

im looking for a way for peeps in my server to share a limited life (timed) invite link to a multiplayer private game channel

#

i guess i could use a database to store a password that gets deleted after a time; the users could just have to type the password into any of the chats for the bot to allow them access

#

think of typical multiplayer games where u need an password to join; im just trying to create a version of that password

#

atm im using ping mentions and direct messages, but a couple of issues im trying to work around is that u cant directly ping someone from within a private channel

slate swan
#

how do links come into play

jagged adder
#

and if someone has their dms off the reaction invites dont work

#

well links was the best thing i could think of to get around those issues

slate swan
jagged adder
#

well if you're trying to invite a friend to play

slate swan
#

hm

jagged adder
#

atm u need to ping them within the private channel

#

which u cant easily do

slate swan
#

hm yeah

jagged adder
#

once u do that, the bot will send the pinged player a dm

#

that player can react with an emoji within 60 seconds to join the game; after that the link expires

slate swan
#

ah

#

you'll have to set up a custom event or smth ig? which checks if a new member was added to a channel

jagged adder
#

i need a simpler way of 1, pinging the players, and 2, being able to manually give the players a code that lets them join if dms r set to friend only

#

because atm the only way to ping/mention the players in the private channel is to type @ so and so in a general channel then copy paste it into the private one

#

technically what i have functions. im just after a easier method for the people who are trying to chill and have fun, as the current way is a bit messy

slate swan
#

you could make something like a command which shows all the available private game channels in a server along with their codes. the user then types in the code and a prompt is shown in the game channel asking if the user can join or not
I think that's an easier way

#

and then the room owner can accept/decline that request

#

or you can send them to the owner's dms if they are enabled

jagged adder
#

thats an interesting idea

slate swan
#

hm, I really think that's gonna be cleaner, easier and would give more control to you

jagged adder
#

probably less work to set up than what ive had to do so far too lol

jagged adder
slate swan
#

mhm

jagged adder
#

well ive noted that down for later, thx

slate swan
#

can anyone help pls

honest shoal
#

use Bot

slate swan
#

what

#

Me dumb? Yes

honest shoal
unkempt canyonBOT
#

@honest shoal :white_check_mark: Your 3.11 eval job has completed with return code 0.

9
slate swan
#

what does that have to do with the bot

#

and client

honest shoal
#

because you defined Client and Bot both using client

slate swan
#

yeah but it works in vs code

honest shoal
#

only the latest one is taken in python

slate swan
#

i just followed a tut on yt

honest shoal
#

don't go for them

drifting arrow
#

@slate swan use bot or client. Not both

slate swan
#

why is it doing error on view

slate swan
#

Vs*

#

what>?

slate swan
honest shoal
slate swan
#

can you help me w that\

honest shoal
#

were you the one who just ghost ponged

slate swan
#

yes

honest shoal
slate swan
#

why is the view making an error

#

like it sayd that its not defined

#

says

honest shoal
#

can you hover the mouse over it

#

and show what it says

slate swan
honest shoal
#

oh

#

make it discord.ui.View

drifting arrow
#

who @'d me? D:

#

why would you invis-@ me? D:

#

be a man and show yourself!

rotund creek
#

yo

slate swan
rotund creek
#

someone just scammed me :/

#

I made them a discord bot & dashboard and once I transferred he blocked me lmao

honest shoal
#

you should take money first

slate swan
#

Doesnt work

honest shoal
#

how are you sending

slate swan
#

It supposed to be !menu

#

And it doesnt shows up

honest shoal
#

you should get some error

slate swan
#

Thats weird i dont get an error

primal token
slate swan
honest shoal
#

then you maybe missing something, I can't help because I've never made a single select menu

slate swan
naive briar
# slate swan

Swap the interaction and select in the callback function

slate swan
#

done

#

lets try now

naive briar
#

It's values I believe

#

!d discord.ui.Select.values

unkempt canyonBOT
slate swan
#

WORKS!

#

do u know how do i do that if theyre choosing an option the bot is giving them a role?

rugged shadow
slate swan
#

Can anyone remake my code for me? Ill send the code in dms

rotund creek
primal token
rotund creek
#

It's my first time selling so I didn't know

rotund creek
primal token
#

25 for both?

rotund creek
#

Economy/moderation/mini games

rotund creek
primal token
#

That's a scam already it shouldve been, 15$ the bot and 15$ the dashboard

rotund creek
#

I mean I thought 25 was fine

#

I just wanted the money to get a Google dev accoun

primal token
#

depending on your codebase and the purpose of your bot but i'm thinking your codebase isnt terrible

rotund creek
#

I'm using py for the bot and web server

#

I need to find a new reliable customer

slate swan
#

why does my code work with bots and client in vs but not in replit

copper flume
#

How to make auto help msg

#

Dpy

naive briar
slate swan
naive briar
slate swan
#

@naive briar

ripe jackal
#

Hey guys, can someone tell me what is wrong with this thing: python users = await new_msg.reactions[0].users().flatten()

AttributeError: 'async_generator' object has no attribute 'flatten'

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

I'm trying to make a giveaway command and this error pops up and I don't know what is up with it.

tropic burrow
meager chasm
#

!d discord.Reaction.users

unkempt canyonBOT
#

async for ... in users(*, limit=None, after=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") representing the users that have reacted to the message.

The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

Changed in version 2.0: `limit` and `after` parameters are now keyword-only.

Examples

Usage...
limber bison
#

hmmm how i get all yes/YES/YeS/Yes/yES in one
all combination
for check

keen dust
#

Hey guys is there a way to combine slash commands and prefix commands

robust fulcrum
#

guys what's use of ctx.typing() function?

meager chasm
meager chasm
keen dust
meager chasm
#

There is mor info in docs probaby

keen dust
#

but it should be the same right?

meager chasm
#

Not necessarily

#

Check nextcord docs

jagged adder
#

where am i going wrong ere

id_list = '\n'.join([f' - {m.name} ({m.id})' for m in ctx.guild.members]):
                                await game_channel.send(id_list)

it says that neither m nor ctx is valid references (tho i suspect fixing ctx would fix m)

Im assuming that list comprehensions cant use global values?

#

this is within an async func

meager chasm
#

Or the full function

jagged adder
#

wait stupid me

meager chasm
#

Also why is there colon after

jagged adder
#

i think i worked out why smh

slate swan
keen dust
ripe jackal
meager chasm
ripe jackal
#

reading the docs.

meager chasm
#

Forget the doc

#

Read the example

#

You know how to use lists in python?

ripe jackal
#

gives me error for this python users = [user async for user in new_msg.users()] AttributeError: 'Message' object has no attribute 'users

meager chasm
#

Because it is method of Reaction not Message

meager chasm
ripe jackal
#

new_msg.reactions[0] ?

meager chasm
#

ye

#

U use users method on that

ripe jackal
#

ye it worked now. Tysm, appreciate it!

naive briar
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

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

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

robust fulcrum
#

Guys i have run my discord bot in termux
How can I stop the running of code?

slate swan
robust fulcrum
#

Ooops i have my notification off

robust fulcrum
naive briar
slate swan
#
class h(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
       embed = '**__You have cooldown ! Please use this command again in {:.2f}s__**'.format(error.retry_after)
       await ctx.send(embed)

@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def h(ctx, *,message='No Reason ! ❌', self, button: discord.ui.Button, interaction: discord.Interaction):
    await interaction.response.send_message("You claimed me!", ephemeral=True)
    check = ctx.author.voice
    if check is None:
      voice = f'The User Is Not Connected To A Voice ! ❌'
    else:
      voice = ctx.author.voice.channel.mention
    emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
    emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
    emeb12233.add_field(name="Voice:", value=voice, inline = False)
    emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
    emeb12233.set_thumbnail(url=ctx.author.avatar)
    await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h)```
#

thats the code

#

and its not working

naive briar
#

If not then I honestly don't know another way besides exiting the app

cold sonnet
#

don't name the class and your command the same

naive briar
slate swan
#

Oh

#

then how?

meager chasm
#

What the hell is going on in command callback params 😆

cold sonnet
#

put your button in the View

#

wait why is it also a command

slate swan
#

can u go on a call?

cold sonnet
#

no

slate swan
#

oof

slate swan
#

i need it to be a claim button

#

that staff can claim

cold sonnet
#

@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey) this should go in your View h

#

with a callback
and you should name your command something else

#

cuz it overwrites your view

limber bison
unkempt canyonBOT
#

examples/views/counter.py lines 21 to 28

class Counter(discord.ui.View):

    # Define the actual button
    # When pressed, this increments the number displayed until it hits 5.
    # When it hits 5, the counter button is disabled and it turns green.
    # note: The name of the function does not matter to the library
    @discord.ui.button(label='0', style=discord.ButtonStyle.red)
    async def count(self, interaction: discord.Interaction, button: discord.ui.Button):```
slate swan
#

thanks

cold sonnet
#

yeah use those examples to create your own button

slate swan
#

also i cant find the callback

cold sonnet
#

I don't know, it can be anything, that's why discord.py also added a name kwarg

@bot.command(name="h")
async def coconut(ctx):
    await ctx.send("Coco Jumbo")
#

it's triggered with !h

slate swan
#

ohhh

#

thats good

#

wait

#

class h(discord.ui.View):
def init(self):
super().init()
self.value = None

@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)

@bot.command(name="h")
async def coconut(ctx):
@commands.cooldown(1,30,commands.BucketType.user)
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def h(ctx, *,message='No Reason ! ❌', self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.response.send_message("You claimed me!", ephemeral=True)
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("Coco Jumbo")
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h)

#

thats the code now

cold sonnet
#

you didn't change anything tho

slate swan
#

yes im doing before and after

cold sonnet
#

ok

meager chasm
cold sonnet
#

I just realized something

meager chasm
#

!d discord.TextChannel.typing

unkempt canyonBOT
#

async with typing()```
Returns an asynchronous context manager that allows you to send a typing indicator to the destination for an indefinite period of time, or 10 seconds if the context manager is called using `await`.

Example Usage:

```py
async with channel.typing():
    # simulate something heavy
    await asyncio.sleep(20)

await channel.send('Done!')
```  Example Usage...
cold sonnet
#

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
       embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
       await ctx.send(embed)

you should add an else: raise error

slate swan
#

oh

#

is that the problem?

cold sonnet
#

well not necessarily

slate swan
#

oh

cold sonnet
#

what it does is not showing you the error

slate swan
#

ohh

cold sonnet
#

so you don't know what's wrong because you see no error

slate swan
#

ill check one moment

cold sonnet
#

except if it's a CommandOnCooldown error, you get that message

#

but eats up all others

slate swan
meager chasm
#

Do u have message content intents?

slate swan
#

yes

#

i have all the intents on

meager chasm
#

In dev portal and code?

slate swan
#

ummm

#

just in dev portal i think

#

i will send my code

meager chasm
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

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

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

meager chasm
#

U need to enable in code like that

cold sonnet
#

import Intents 🤮

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

slate swan
#

@meager chasm

cold sonnet
#

you do have intents

slate swan
#

oh

meager chasm
#

Intents are fine but wtf is happening in command code

cold sonnet
#
@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
       embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
       await ctx.send(embed)
    else:
       raise error
meager chasm
#

Why do u have command decorator on top of button decorator

cold sonnet
#

it makes you have errors

#

errors are good

#

errors are great actually

slate swan
cold sonnet
#

god I love errors

slate swan
naive briar
cold sonnet
#

you did !b

#

?

#

and yeah this is completely wrong it's gonna error

slate swan
#

No my friend did

cold sonnet
#

then that'll error

#

you can still handle that error

meager chasm
#

U should look at dpy GitHub examples for how to make button

#

Mashing code together won't work

slate swan
#

like

naive briar
slate swan
#

like

#

ill send

cold sonnet
#

first of all let's clear your command mate

slate swan
#

i want to do that

naive briar
#

That's what buttons do

slate swan
#

that it will do Help and if u tap on it it says "claimed by (the user)

cold sonnet
meager chasm
#

That's a normal looking button

cold sonnet
#

done

meager chasm
slate swan
#

nono it is

slate swan
#

but if u tap on it its says claimed by and the user

meager chasm
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

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

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

meager chasm
#

And maybe learn OOP

slate swan
#

Hehe

#

class MyButton(discord.ui.View):
def init(self):
super().init()
self.value = None

@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error

@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h)

cold sonnet
#

so the button you want is going to be in the view

meager chasm
cold sonnet
#

put it in the class

slate swan
#

put what?

meager chasm
#

The button

primal token
# slate swan

You need to use an instance of the class object not the actual class object

meager chasm
#

In the view

slate swan
#

@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)

#

yes?

cold sonnet
#

make a button like

@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def my_button(self, button: discord.ui.Button, interaction: discord.Interaction):
    print("pressed")
#

in the view

slate swan
#

okay

cold sonnet
#

you're also gonna wanna fix
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h)
to
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h())

#

view= doesn't take a Class but a Class Instance

slate swan
#

WTF

#

שלום לך

meager chasm
slate swan
primal token
cold sonnet
#

have you renamed your command yet?

slate swan
#

MyButton

meager chasm
primal token
#

i corrected myself as well for the people who like to be pedantic

cold sonnet
slate swan
#

@bot.command()
async def menu(ctx):
view = MySelect()
await ctx.send("Hello", view=view)

meager chasm
primal token
cold sonnet
#

with one waste of a variable that doesn't change the outcome

primal token
#

What's with the creation of a reference?

cold sonnet
#

your MySelect is a lot different than h though

#

what reference

slate swan
cold sonnet
#

no...

primal token
slate swan
cold sonnet
#

you don't make a view inside the button

#

you make the button inside the view

slate swan
#

okay

cold sonnet
#

and you send the view in a command

primal token
cold sonnet
#

thank you I've been figuring this phrase for quite a while

slate swan
#

class MyButton(discord.ui.View):
def init(self):
super().init()
self.value = None
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error

@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=MyButton)

@bot.command()
async def helpme(ctx):
view = MyButton()
await ctx.send("Hello", view=view)

cold sonnet
#
class MyButton(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None
    
    @discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
    async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
        print("pressed")
#

and the helpme command is right

slate swan
#

class MyButton(discord.ui.View):
def init(self):
super().init()
self.value = None

@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
    print("pressed")

@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error

@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=MyButton)

@bot.command()
async def helpme(ctx):
view = MyButton()
await ctx.send("Hello", view=view)

#

so now do i run the code?

cold sonnet
#

this is good, helpme is right, h is missing a parantheses but ok

#

you do !helpme

slate swan
#

oh

#

but i want to do like

#

!h

cold sonnet
#

await ctx.send("@deleted-role", embed=emeb12233, view=MyButton())

#

fix this and it's probably gonna work

slate swan
#

ill try

#

OMG IM GOBBA CRY

#

IT WORKS LITERALLY WORKS

cold sonnet
#

did it print?

slate swan
cold sonnet
#

good

slate swan
#

Now i need to learn how to make it edit to Claimed by (user)

#

i will learn this

#

thank you so much.

cold sonnet
#

good luck

#

with the hard part

slate swan
#

your the best thanks

#

Hey!

I want to make an event when someone joins a certain VC it makes a private one for that user.

What would something like that look like?

gaunt ice
slate swan
#

sum like that

gaunt ice
#

hmm

tidal hawk
#

Create on_voice_state_update and check if the user joined the certain VC, if so then create a new voice channel just for the user and move him there

gaunt ice
#

yea

#

should it create a new vc just for that person

gaunt ice
#

hm

slate swan
#

with perms to invite people to it

#

i know how oto change the perms

#

i just dont know how to detect when a user joins that exact vc

#

then proceed to make the channel

gaunt ice
#

on_voice_state_update

slate swan
#

how would i check if someone joined that specific channel then make a new channel?

gaunt ice
#

alr wait

tidal hawk
#

Check after voice channel id

gaunt ice
#

yea

slate swan
#

on interaction:
if role-id in interactor.roles:
send-message "Claimed by" + interactor.name
else:
do nothing

#

can someone help me w turning this into a py code

slate swan
dull terrace
slate swan
gaunt ice
#

idk if its right

#

im new to python

primal token
slate swan
gaunt ice
dull terrace
gaunt ice
#

its just we ned to help them to understand it

#

its not like we shouldnt write any code

dull terrace
primal token
tidal hawk
dull terrace
#

or tell them to read docs which is unhelpful

primal token
#

Spoonfeeding a whole command to a beginner is worst than actually giving them directions, you can give pseudo code but not one that they may continue using without any idea how it may work

slate swan
#

thank you

slate swan
primal token
#

It's a good cause but causes more problems

tidal hawk
#

Just remove the expression

primal token
primal token
tidal hawk
tidal hawk
#

Let's no hate xen, it's his own choice xD

slate swan
#

how would i check if they were in a vc before hand?

#

like if anyone from anywhere joins the vc it still makes the channel

primal token
#

I'm not hating on him, I'm just giving him alternatives that may help a user further than giving him the solution

tidal hawk
#

if the @slate swan really wants to learn programming then he'll realize the importance of self learning

primal token
#

That's not learning programing, more like python and the process of coding and also programming

dull terrace
potent spear
tidal hawk
potent spear
#

as for help servers, you'll get the up-to-date answer all the time

slate swan
potent spear
#

no, that can't be

slate swan
#

would that fix it?

tidal hawk
#

Try it bro

potent spear
#

that condition isn't even possible in Python...

dull terrace
potent spear
#

you should use and

slate swan
#

where or how

potent spear
#

well, first condition AND second condition

primal token
dull terrace
#

!e

x = True
y = False
z = False
try:
  if x != y == z:
    print("asdfsad")
except:
  print("doesn't work")
unkempt canyonBOT
#

@dull terrace :white_check_mark: Your 3.11 eval job has completed with return code 0.

asdfsad
dull terrace
#

it really feels like that shouldn't work

primal token
dull terrace
primal token
#

It's just expressions i wouldnt doubt python cant parse that order, which it doesnt have any trouble

slate swan
#

how would i do permissions for voice channels.. ive only ever done txt channels

#

ok

naive briar
#

!d discord.VoiceChannel.set_permissions

unkempt canyonBOT
#

await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sets the channel specific permission overwrites for a target in the channel.

The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that belongs to guild.

The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.

If the `overwrite` parameter is `None`, then the permission overwrites are deleted.

You must have [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") to do this...
slate swan
naive briar
slate swan
#

but i think i got it

naive briar
unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") to do this.
naive briar
slate swan
#

yerrr

#

thanks!

#

Skill problem

light jungle
meager chasm
#

Print the embed dict after modifying and send here

#

No

#

The embed dict which ur changing

#

to_d

#

Bruh just print to_d

slate swan
#

okay so i successed about changing to it to the one who tapped the button but im getting troubles to do that only one role can tap the button and if you tap the button it doesnt change the message its changing the button to claim by interaction.user

naive briar
#

You could've just add new field by using "add_field"

meager chasm
#

Ur printing this after adding the field?

naive briar
#

The add_field also do changes to embed..

meager chasm
#

They just editing the second field

naive briar
#

And set the edited field by using set_field_at pithink

meager chasm
#

Sure but that edits internal dict anyways and doesn't make it more readable

#

It subjective ig

meager chasm
#

You do to_d[1]["fields"]...

Print to_d after that

#

And see if it has the contents u want in the edited embed

slate swan
gaunt ice
#

like that new private channel should be deleted after 5 mins of being empty

#

@slate swan

gaunt ice
#

alr wait

shell wing
#

Code

@bot.command()
async def incrypt_setup(ctx):
    incrypt_role = 1024617513054650448
    incrypt_overrides = {
                    ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False, connect=False),
                    incrypt_role: discord.PermissionOverwrite(read_messages=True, send_messages=True)
                  }
    incrypt_main = await ctx.guild.create_category("Incrypt-X", overwrites=incrypt_overrides)
    incrypt_general = await ctx.guild.create_text_channel("General", overwrites=incrypt_overrides, category=incrypt_main)
    incrypt_announcements = await ctx.guild.create_text_channel("Announcements", overwrites=incrypt_overrides, category=incrypt_main)
    incrypt_cmds = await ctx.guild.create_text_channel("Bot Commands", overwrites=incrypt_overrides, category=incrypt_main)
    await ctx.send (f"Channels for Incrypt-X has been created \n {incrypt_general.id} {incrypt_announcements.id} {incrypt_cmds.id}")

error

Traceback (most recent call last):
  File "E:\Python projects\CSI\venv\lib\site-packages\discord\ext\commands\core.py", line 190, in wrapped
    ret = await coro(*args, **kwargs)
  File "E:\Python projects\CSI\main.py", line 82, in incrypt_setup
    incrypt_main = await ctx.guild.create_category("Incrypt-X", overwrites=incrypt_overrides)
  File "E:\Python projects\CSI\venv\lib\site-packages\discord\guild.py", line 1545, in create_category
    data = await self._create_channel(
  File "E:\Python projects\CSI\venv\lib\site-packages\discord\guild.py", line 1197, in _create_channel
    payload = {'allow': allow.value, 'deny': deny.value, 'id': target.id}
AttributeError: 'int' object has no attribute 'id'
#

what does the error even means ??

naive briar
slate swan
#

define userguess

naive briar
shell wing
lament acorn
#

You have written us6er and not user

naive briar
shell wing
shell wing
meager chasm
unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
naive briar
#

🫠

shell wing
#

ah alr it works ty

slate swan
#

okay so i successed about changing to it to the one who tapped the button but im getting troubles to do that only one role can tap the button and if you tap the button it doesnt change the message its changing the button to claim by interaction.user

meager chasm
#

Where is embedToEdit defined?

#

Creates to many creates? Wdym by dat

slate swan
#
class MyButton(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None
    
    @discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
    async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
        await interaction.response.edit_message(content=f"Claimed By {interaction.user}")
        

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
       embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
       await ctx.send(embed)
    else:
        raise error

@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
    check = ctx.author.voice
    if check is None:
      voice = f'The User Is Not Connected To A Voice ! ❌'
    else:
      voice = ctx.author.voice.channel.mention
    emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
    emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
    emeb12233.add_field(name="Voice:", value=voice, inline = False)
    emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
    emeb12233.set_thumbnail(url=ctx.author.avatar)
    await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=MyButton())

@bot.command()
async def helpme(ctx):
    view = MyButton()
    await ctx.send("Hello", view=view)```
slate swan
split forge
#

now I have a code called round_id = str(round_id) and I want it to write the round id in this code in my bot how can I do it

#

example .help
When [round_id] is entered, I want the round id we entered to appear at the bottom of the Embed.

meager chasm
# slate swan got anythin?

async def delete_vc
    await asyncio.sleep(5)
    await vc.delete()

vacant = {}

async def on_voice_state_update
    if not channel.members
        vacant[channel.id] = asyncio.create_task(delete_vc(channel))
    elif channel.id in vacant
        task = vacant.pop(channel.id)
        task.cancel()
``` just pseudocode but sometin like dat?
#

And maybe sometin in delete_vc to pop the task from vacant dict after it is complete

slate swan
#

how owuld i repeat that every 5 minutes or so

meager chasm
slate swan
#

if a channel is vacant

#

delete it

meager chasm
#

If channel is vacant u make asyncio task that sleeps 5 sec and deletes vc

#

But if channel get occupied and is in the dict then u cancel the task

#

So it don't get delete

slate swan
#
class MyButton(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None
    
    @discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
    async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
        await interaction.response.edit_message(content=f"Claimed By {interaction.user}")
        

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
       embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
       await ctx.send(embed)
    else:
        raise error

@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
    check = ctx.author.voice
    if check is None:
      voice = f'The User Is Not Connected To A Voice ! ❌'
    else:
      voice = ctx.author.voice.channel.mention
    emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
    emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
    emeb12233.add_field(name="Voice:", value=voice, inline = False)
    emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
    emeb12233.set_thumbnail(url=ctx.author.avatar)
    await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=MyButton())

@bot.command()
async def helpme(ctx):
    view = MyButton()
    await ctx.send("Hello", view=view)```
#

okay so i successed about changing to it to the one who tapped the button but im getting troubles to do that only one role can tap the button and if you tap the button it doesnt change the message its changing the button to claim by interaction.user

meager chasm
#

Or make interaction_check method of View

slate swan