#discord-bots

1 messages · Page 750 of 1

maiden fable
#

!d discord.Interaction.guild

unkempt canyonBOT
maiden fable
#

Oh it exists. Nvm

hard trail
#
@commands.has_permissions(manage_messages=True)
async def snipe(ctx):
    try:
        contents, author, channel_name, time = bot.sniped_messages[ctx.guild.id]
        
    except:
        await ctx.channel.send("Didn't find anything to snipe!")
        return

    
    embed = discord.Embed(description=contents, color=discord.Color.purple(), timestamp=time)
    embed.set_author(name=f"{author.name}#{author.discriminator}", icon_url=author.avatar_url)
    embed.set_footer(text=f"Deleted in : #{channel_name}")

    message = await ctx.channel.send(embed=embed)
    await asyncio.sleep(2)
    await message.delete()```
I need it to delete but it's not. I did asyncio.sleep(2) then delete but it isn't working
dire folio
#

If it's the embed at the end do

await ctx.send(embed=embed, delete_after=2)
hard trail
#

Yeah it worked thanks

final iron
hard trail
#

alright

final iron
#

Also, any reason you're not updated to discord.py 2.0?

velvet tinsel
#

hello person gazing at water

drifting swift
#

are there any free 24/7 hosting services, i only need this bot to work on 1 server

kind wasp
#

!e @bot.event
async def on_message_delete(message):
await message.channel.send(message.content)

unkempt canyonBOT
#

@kind wasp :x: Your eval job has completed with return code 1.

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

!e @client.event
async def on_message_delete(message):
await message.channel.send(message.content)

unkempt canyonBOT
#

@kind wasp :x: Your eval job has completed with return code 1.

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

Oh

#

Thx

drifting swift
cerulean elbow
drifting swift
cerulean elbow
drifting swift
frank tartan
#

AttributeError: 'NoneType' object has no attribute 'id'

that is my error.

@client.command(aliases=['s'])
async def addRole(ctx, member : discord.Member=None,*,emoji=None):

    author_id = ctx.author.id
    if member == None:
        await ctx.reply("I need a member for you to sign")
        return
    if emoji == None:
        await ctx.reply("I need a team for you to sign the member too.")
        return

    newEmoji = emoji.split(":")
    newEmoji2 = newEmoji[1]
    roleName = newEmoji2.replace("_", " ")

    role = discord.utils.get(member.guild.roles, name=(roleName))
    role2 = discord.utils.get(member.guild.roles, name=(noRoleName))
    await member.remove_roles(role2)
    await member.add_roles(role) 

can anybody help?

drifting swift
#

ooh like maybe a schedule thingy so it pings everyone when class starts

cerulean elbow
frank tartan
drifting swift
#

a hat

frank tartan
final iron
frank tartan
final iron
#

Do you have intents?

frank tartan
final iron
#

!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 the Members and Presences intents, which are needed for events such as on_member 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.

frank tartan
final iron
#

Enable them, see what happens

frank tartan
frank tartan
# final iron Enable them, see what happens

NameError: name 'intents' is not defined

from discord import Intents

PREFIX = "<"
client = commands.Bot(command_prefix=commands.when_mentioned_or(PREFIX),  help_command=None, intents=intents)
cerulean elbow
final iron
#

Do you see your issue?

frank tartan
frank tartan
final iron
frank tartan
final iron
#

Did you enable them in the dev portal?

frank tartan
#

oh

#

uhh no.. lemme go enable them

frank tartan
final iron
frank tartan
final iron
#

I got no clue then

#

Actually

#

Send your constructor again

#

I want to verify you did it correctly

frank tartan
final iron
#

bot = commands.Bot(...)

#

That line

#

And show how you defined intents

frank tartan
keen talon
#

Where do I verify my bot

cerulean elbow
frank tartan
frank tartan
frank tartan
# final iron Show me `intents`
from discord import Intents
intents = Intents.default()
intents.members = True

PREFIX = "<"
client = commands.Bot(command_prefix=commands.when_mentioned_or(PREFIX),  help_command=None, intents=intents)
final iron
#

No idea then

cerulean elbow
halcyon sparrow
#

Does someone know to properly invite the bot

twin moon
#

How do I make a guild into a guildchannel

twin moon
#

URL generator

#

Redirect uri

#

Invite

#

By

#

Using link

halcyon sparrow
#

Alright, let me check. I have an invite but the bot doesn't have its own role when it joins

cerulean elbow
halcyon sparrow
#

I feel like it's my fault

twin moon
twin moon
twin moon
cerulean elbow
twin moon
#

EVERYONE FORGETS TO DEFINE CTX

cerulean elbow
twin moon
cerulean elbow
twin moon
cerulean elbow
twin moon
halcyon sparrow
#

Thanks guys. I read an article on it but I guess It wasn't good

cerulean elbow
twin moon
cerulean elbow
#

@Bot.command(ctx): something like this?

cerulean elbow
cerulean elbow
twin moon
#
@client.command()
async def idk(ctx)```
cerulean elbow
dire folio
#

i need help on why this isn't working i get no errors

@tasks.loop(seconds=10)
async def update_stats():
    guild = client.get_guild(913793214505447505)

    member_channel = client.get_channel(931624220885155860)
    list_member = guild.members

    #Edit stats All Member
    mem = 'Members: ' + str(len(list_member))
    print(mem)
    await member_channel.edit(name=mem)

btw i am starting the task

final iron
dire folio
#

1 sec

dire folio
dire folio
cerulean elbow
dire folio
#

I'll try myself but ty

cerulean elbow
final iron
dire folio
#

Ye

#

If I do await update_stats() in on_ready it works but the task isn't working

undone willow
#

Hey! I have a question if anyone knows some bots I could use for my idea?

I'd like for members of my server to be able to take a quiz with some questions and depending on their results be assigned a role

#

Not sure if it's entirely the right place to ask but couldn't find any better channel and hope that's okay!

spring flax
spring flax
undone willow
dire folio
undone willow
#

I'm not too sure about how complicated fetching data and such is, but I do have an external website where the survey can be done, would it be possible of some kind of bot checking the results over there and then have an if condition for the results like if it's greater than or equal to 80% they get assigned a role?

slate swan
#

I'm trying to make a ban command interactive with buttons.
here is the traceback error im getting:

Traceback (most recent call last):
  File "C:\Users\santi\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\bot.py", line 994, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\santi\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 894, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\santi\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 176, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'author'

here is the code:

#
class Ban(discord.ui.View):
    def __init__(self, ctx, member: discord.Member):
        super().__init__()
        self.value = None

    @discord.ui.button(label='Ban', style=discord.ButtonStyle.red, emoji="⚒️")
    async def create(self, button: discord.ui.Button, interaction: discord.Interaction):
        await interaction.member.ban(reason=None) #give the user the role with the name 'verified'
        await interaction.response.send_message(content=f"{interaction.user.name}{interaction.user.discriminator} has been banned!", ephemeral=True) # response message
        self.value = False

@bot.command()
async def ban(self, ctx,  user:discord.Member=None):
    view = Ban
    if user==None:
        user=ctx.author

    rlist = []
    for role in user.roles:
      if role.name != "@everyone":
        rlist.append(role.mention)

    b = ", ".join(rlist)

    banembed = discord.Embed(title = f'User Info - {user}', colour=botcolortheme,timestamp=ctx.message.created_at)
    banembed.set_author(name=f"You have initiated a `ban` on the following user:"),
    banembed.set_thumbnail(url=user.avatar.url),
    banembed.set_footer(text=f'Requested by - {ctx.author}', icon_url=ctx.author.avatar.url)
    banembed.add_field(name='ID:',value=user.id,inline=False)
    banembed.add_field(name='Name:',value=user.display_name,inline=False)
    banembed.add_field(name='Created at:',value=user.created_at,inline=False)
    banembed.add_field(name='Joined at:',value=user.joined_at,inline=False)
    banembed.add_field(name='Bot?',value=user.bot,inline=False)
    await ctx.send(embed=banembed, view=view)
    await view.wait()
native wedge
#

is python still good for bot making?

spring flax
# undone willow Not really much to be honest just a little with Python but none with dpy, was ju...

yeah sure, I asked that to know how detailed I should be in how to create it
So first, you'd need the quiz questions, and the answers
After that, you can send the questions using await ctx.send(the_question)
Then, you'd be using a await bot.wait_for for the bot to receive the user's answer.
Then you can check if the answer is equal to the question answer. If yes, you give a role.
So basically this is a rough idea

#create the quiz questions and answers as a variable. Let's take it as "quiz_questions" in this case, and the answer is "answer".
@bot.command()
async def quiz(ctx):
  choice = random.choice(quiz_questions) #selecting a random question
  await ctx.send(choice)
  def check(message):
    return message.author == ctx.author and message.channel == ctx.channel
  msg = await bot.wait_for('message', check=check)
  if msg.content == answer: #the answer is right
    await ctx.send("You got it right!")
    await msg.author.add_roles(the role you want) #adding the role to the user
  else:
    await ctx.send("You got it wrong") #they got the question wrong
#

Although mind the indents, they may be wrong

spring flax
#

An example being disnake.

native wedge
undone willow
slate swan
native wedge
#
import disnake
spring flax
#

yes

native wedge
#

like that?

slate swan
#

Well you need to install it first.

#

Then yes, it's correct.

native wedge
#

how would that work out

slate swan
native wedge
#

all i did is py import discord and it installed

spring flax
# undone willow Thank you so much for taking your time into this response. Unfortunately a bit b...

yeah no worries.
Here are the documentations since you mentioned you wouldn't mind reading through them, for each major part (just giving the commands, you can use them in #bot-commands)

Sending a message - !d discord.abc.Messageable.send
To get a random choice from a sequence - !d random.choice
Waiting for the user's message - !d discord.ext.commands.Bot.wait_for
Adding a role to a member - !d discord.Member.add_roles

spring flax
#

Do you know which line the error is being raised from

slate swan
#

no, doesn't say

slate swan
#

hi again

#

is there a cmd for

#
    {delete new message}```
#

No there is none, you need to store old messages yourself.

slate swan
flat solstice
#

Anyone know any library that has support for membership screening/rules screening that is also compatible with d.py 1.7 Never mind I finally found the member.pending which seems to be what I'm looking for

slate swan
#

has something changed with playing music using discord bots, music doesnt want to play?

slim ibex
#

Don’t think so but be careful with music bots especially if they use YouTube API

slate swan
#

we don't help with music bots here

#

it goes against our community guidelines

twin moon
#

if self.guild.owner_id == obj.id:

twin moon
#

or owner perms

slim ibex
unkempt canyonBOT
twin moon
slate swan
slate swan
#

however due to my own skepticism on how someone would use such knowledge i refrain from helping

slate swan
# slate swan not all all

could you possible just possibly, explain why when running the bot on a raspberry pi and playing sound, it works, yet when on windows proceeds not to?

cyan star
frank tartan
#

SO

#

so, im trying to upload one of my bots to repl. I'm getting this error.

#

those are the packages i've installed

#

I dont think im missing any though

shut leaf
#

can sm1 help

cloud dawn
#

Code has to match that

full lily
#

read the traceback carefully.

shut leaf
#

in both bro

#

in the main and also the music

cloud dawn
#

Also

#

!ytdl

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)
full lily
#

indentation looks fine to me

cloud dawn
#

import music is a youtube downloader, we don't help with that here.

shut leaf
#

bro just help me pls

#

please

cloud dawn
#

We won't help break ToS

frank tartan
full lily
slate swan
#

i.e master branch

full lily
#

the master branch if I recall

#

right right

slate swan
#

you need to clone the repo manually and run the setup

#

but since you're using replit

frank tartan
slate swan
#

and replit uses pypoetry.. I think

cloud dawn
slate swan
#

you can just add the git repository to the pyproject.toml file

frank tartan
slate swan
#

show me how you did it

frank tartan
slate swan
#

you did it wrong then

frank tartan
slate swan
#
"discord.py" = { git = "https://github.com/Rapptz/discord.py.git", branch = "master" }
#

put this below [tool.poetry.dependencies]

#

and ensure you remove any other versions

#

on the pyproject.toml file btw

#

then you should be able to just run the project and it'll update

#

otherwise click the shell tab in replit and

#

use the
poetry update command

frank tartan
#
"discord.py" = { git = "https://github.com/Rapptz/discord.py.git", branch = "master" }
[tool.poetry.dependencies]

like this?

slate swan
#

i said below

#

also there already should be an existing tool.poetry.dependencies

#

do not add a new section, put it below the existing one

frank tartan
#

ok

slim ibex
#

Can you directly add to a poetry toml file like you can in rust cargo.toml’s

#

I would assume so

slate swan
#

of course

#

just don't mess with the lock file

slim ibex
#

Alright

#

yeah ik that

slate swan
#

and always consult documentation before asking for help

cloud dawn
slate swan
#

well the documentation doesn't always answer everything

#

still the person might save themselves so much trouble by reading it

frank tartan
cloud dawn
#

Activate windows

frank tartan
covert otter
#

hello. I have a question, how can I detect the message of a bot with the client

unkempt canyonBOT
#

discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.

This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.

Warning

Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
slate swan
#
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "bot.py", line 311, in avatar
    userAvatarUrl = avamember.avatar_url
AttributeError: 'NoneType' object has no attribute 'avatar_url'

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

Traceback (most recent call last):
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/container/.local/lib/python3.8/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: AttributeError: 'NoneType' object has no attribute 'avatar_url'```
#

i just runed my bot and tryied to use avatar command

#

wait the command works but when i type +avatar @nick

covert otter
tranquil badge
# covert otter ??

He means use something like this

@bot.event
async def on_message(message):
<whatever you want it to do>
    await bot.process_commands(message)
#

sorry if it doesn’t look right

#

on mobile

covert otter
#

Thx men

slate swan
#

which imo is better

tranquil badge
#

true

#

on_message is a whole ordeal

slate swan
#

yeah

tranquil badge
#

I’ve been dealing with it for a couple days now

#

it’s really annoying

slate swan
#

lol

tranquil badge
#

I need it for a few simple on message reactions

slate swan
#

i just use buttons

#

and not reactions

tranquil badge
#

but my testmode thingy I’m working on makes it pain

slate swan
#

then use buttons lol

tranquil badge
#

buttons?

slate swan
#

yeah

#

buttons are great

#

lol

tranquil badge
#

wdym by buttons

slate swan
#

!d disnake.ui.Button

unkempt canyonBOT
#

class disnake.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
slate swan
#

!d disnake.ui.View

unkempt canyonBOT
#

class disnake.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
slate swan
#

for buttons you would need to subclass view

#

im not sure what fork or if your using dpy

#

main branch of dpy has view tho

#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
tranquil badge
#

The thing is that I don’t need buttons

slate swan
#

ic whats the command for?

tranquil badge
#

Basically putting the bot in a toggle-able state that only I can use commands in

slate swan
tranquil badge
#

already doing that

slate swan
#

with interaction_check

tranquil badge
#

i see

#

but my problem rn is specifically that what I have currently is blocking all commands as if process_commands isn’t there

#

but it’s not referencing process commands at all

potent spear
#

make sure your process commands isn't in an if statement

tranquil badge
#

so whatever @ andy provided me with yesterday is breaking something upstream

#

it’s not

unkempt canyonBOT
#

Pasting large amounts of code

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

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

potent spear
#

put all your code here, I'll spot the obvious

#

don't leak the token tho

tranquil badge
#

It’s in its own bot.event

potent spear
#

irrelevant

#

also tell me what command you've tried to run after sending the code

tranquil badge
#

simple help and another with is_owner() to check

#

also not currently able to send the code

potent spear
#

can't help then unfortunately

#

last option I can tell you on top of my head: disable the error handlers and the errors will start popping up by themselves

tranquil badge
#

Basically I’d get an error saying that the command didn’t exist or something of the sort

slate swan
#

can someone give any ideas what commands I can add to the bot because I have no ideas.

frank tartan
#
Traceback (most recent call last):
  File "main.py", line 239, in <module>
    client.run(os.getenv('TOKEN'))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 663, in run
    return future.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 642, in runner
    await self.start(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 605, in start
    await self.login(token)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 473, in login
    data = await self.http.static_login(token.strip())
AttributeError: 'NoneType' object has no attribute 'strip'

so that is my error message...

[tool.poetry]
name = "npfl-bot"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "^3.8"
"discord.py" = { git = "https://github.com/Rapptz/discord.py.git", branch = "master" }
python-dotenv = "^0.19.2"
Flask = "^2.0.2"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

that is what is in my pyproject.toml. Btw this is in repl

slate swan
slate swan
#

oop forgot to ping @frank tartan sorry

frank tartan
#

but speaking of which, i never put the token in

slate swan
frank tartan
slate swan
#

his token isnt correct thats all

frank tartan
slate swan
slate swan
frank tartan
#

how can i make it so I can do

-removeRoles {roleName}

and it will remove that role from everyone

slate swan
frank tartan
frank tartan
slate swan
#

just member its a for loop

#

!e

numberlist = [1, 2, 3, 4, 5]
for number in numberlist:
    print(number)
unkempt canyonBOT
#

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

001 | 1
002 | 2
003 | 3
004 | 4
005 | 5
frank tartan
slate swan
#

How can I check if name_of_Role is None with utils.get?

#

I'm trying to make a ban command interactive with buttons.
here is the traceback error im getting:

Traceback (most recent call last):
  File "C:\Users\santi\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\bot.py", line 994, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\santi\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 894, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\santi\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 176, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'author'

here is the code:

#
class Ban(discord.ui.View):
    def __init__(self, ctx, member: discord.Member):
        super().__init__()
        self.value = None

    @discord.ui.button(label='Ban', style=discord.ButtonStyle.red, emoji="⚒️")
    async def create(self, button: discord.ui.Button, interaction: discord.Interaction):
        await interaction.member.ban(reason=None) #give the user the role with the name 'verified'
        await interaction.response.send_message(content=f"{interaction.user.name}{interaction.user.discriminator} has been banned!", ephemeral=True) # response message
        self.value = False

@bot.command()
async def ban(self, ctx,  user:discord.Member=None):
    view = Ban
    if user==None:
        user=ctx.author

    rlist = []
    for role in user.roles:
      if role.name != "@everyone":
        rlist.append(role.mention)

    b = ", ".join(rlist)

    banembed = discord.Embed(title = f'User Info - {user}', colour=botcolortheme,timestamp=ctx.message.created_at)
    banembed.set_author(name=f"You have initiated a `ban` on the following user:"),
    banembed.set_thumbnail(url=user.avatar.url),
    banembed.set_footer(text=f'Requested by - {ctx.author}', icon_url=ctx.author.avatar.url)
    banembed.add_field(name='ID:',value=user.id,inline=False)
    banembed.add_field(name='Name:',value=user.display_name,inline=False)
    banembed.add_field(name='Created at:',value=user.created_at,inline=False)
    banembed.add_field(name='Joined at:',value=user.joined_at,inline=False)
    banembed.add_field(name='Bot?',value=user.bot,inline=False)
    await ctx.send(embed=banembed, view=view)
    await view.wait()
slate swan
#

just

await member.ban
frank tartan
slate swan
frank tartan
slate swan
#

!d discord.Member.remove_roles

unkempt canyonBOT
#

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

Removes [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s from this member.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
slate swan
#

can your bot remove roles?

frank tartan
slate swan
#

thats what happens when its removed

frank tartan
manic wing
#

self.member = member in your init

cold hearth
#

So I’m getting back into discord bots, what api is everyone using after discord.py went away?

jade tartan
#

Hi i dont know if i should ask this am guessing this is a #web-development type question but it wont let me import 'semantic-ui-css/semantic.min.css' this?

#

To design my buttons for my discord bot dashboard

wicked atlas
#

Theres a few. pycord is one of them. I prefer disnake though

gleaming torrent
#

so I just got rate limited for rerunning my bots code twice

#

Literally how

#

"Too many requests"

final iron
#

It's the wrapper that changed

frank tartan
#

so can anybody help me make a command that removes a sertan role from everybody on the server?

cold hearth
gleaming torrent
#

How long does rate limiting last?

cold hearth
final iron
#

Most people just don't want to switch

magic ore
gleaming torrent
cold hearth
gleaming torrent
#

Got rate limited for running my bots code twice

magic ore
#

That's why, multiple users share the same ip on replit

final iron
cold hearth
final iron
#

Yup

gleaming torrent
magic ore
#

They're dynamic, iirc from 30 minutes to an hour usually

#

Long term solution is not using replit/free hosts

#

Short term solution is waiting

slate swan
#

is there a way i can have my bot repeat a message when i do a command? for instance

bot: hi
bot: hi
bot: hi```
brittle axle
#

Im trying to make an add role command but it keeps on saying missing permissions even though I have manage role in testing server here is the code:

@bot.command()
@has_permissions(manage_roles = True)
async def addrole(ctx, member: discord.Member, role: discord.Role):
await member.add_roles(role)
await ctx.send(f"Added role to {member}")

slate swan
#

or do i have to individually type out "hi"

brittle axle
#

or a while loop

slate swan
#

thanks ill look into it

slate swan
#

this?

brittle axle
slate swan
#

ok wait

#

wait a min

#

what would true =?

empty veldt
slate swan
frank tartan
empty veldt
frank tartan
empty veldt
#

they won't get "missing permission" error

brittle axle
deep torrent
#

How do I make a giveaway for only people with a certain role

deep torrent
brittle axle
frank tartan
#
for member in ctx.guild.members:
        role = discord.utils.get(member.guild.roles, name=(roleName))
        await member.remove_roles(role)

when my code gets to this, it basically just skips over it

brittle axle
final iron
#

If you read the docs

#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
final iron
#

Does your bot have the appropriate permissions?

brittle axle
#

yes

#

i gave it administrator

final iron
#

the added Roles must appear lower in the list of roles than the highest role of the member.

#

Have you read this note?

brittle axle
#

wait

brittle axle
#

my role is the highest

#

wait i got the problem my bots role is lower than the role i need to add

#

let me see wether amking my bot the second highest role works

#

it worked thanks for the help

frank tartan
#
@client.command()
@commands.has_permissions(administrator=True)
async def removeAll(ctx, emoji=None):
    author_id = ctx.author.id
    if emoji == None:
        await ctx.reply("I need a role to remove..")
        return

    newEmoji = emoji.split(":")
    newEmoji2 = newEmoji[1]
    roleName = newEmoji2.replace("_", " ")

    for member in ctx.guild.members:
        role = discord.utils.get(member.guild.roles, name=(roleName))
        await member.remove_roles(role)

    await ctx.reply(f"I have removed the `{roleName}` from everyone.")

when I run that, it runs the await ctx.reply(f"~~~~") thing, but it doesn't remove the role from everyone

frank tartan
final iron
#

print roleName

#

Verify its correct

frank tartan
final iron
#

Remove the brackets around roleName

frank tartan
final iron
#

I'm not sure if python cares about it

#

But they're not doing anything

frank tartan
final iron
#

Wait

#

No way in hell I've been confusing brackets and parentheses

#

bruv

final iron
frank tartan
final iron
#

Personally I would suggest you just set all the intents to true

#

!d discord.Intents.all

unkempt canyonBOT
#

classmethod all()```
A factory method that creates a [`Intents`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents "discord.Intents") with everything enabled.
frank tartan
final iron
frank tartan
final iron
#

Use this unless you have a specific reason to not have all intents enabled

final iron
frank tartan
final iron
#

Did you do intents=discord.Intents.all() inside your bot constructor?

frank tartan
final iron
#

!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 the Members and Presences intents, which are needed for events such as on_member 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.

final iron
#

So

#

In your bot constructor like shown above you would use the intents kwarg

#

Therefore intents=discord.Intents.all()

frank tartan
#

@final iron

RuntimeError: Event loop is closed

final iron
#

You really just need that

#

You don't need to define intents since its not going to be used

frank tartan
final iron
#

Can you send the full traceback?

frank tartan
frank tartan
boreal ravine
# frank tartan https://pastebin.com/u2iXiKP0

discord.errors.PrivilegedIntentsRequired: 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.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

final iron
# frank tartan https://pastebin.com/u2iXiKP0
discord.errors.PrivilegedIntentsRequired: 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.
#

Learn to read your errors

frank tartan
final iron
brittle axle
#

it didnt remove anything

slate swan
#

hey so the buttons stack for some reason, any way to make them not?

msgn = await ctx.reply(embed=embed,components=[
                Button(style=ButtonStyle.green, label="MassPing", emoji='✅', custom_id="massping"),
                Button(style=ButtonStyle.blue, label="MassJoin", emoji='✅', custom_id="massjoin"),
                Button(style=ButtonStyle.red, label="Finish", emoji='❌', custom_id="cancel")
            ])```
#

using discord_components

boreal ravine
#

it should work afaik from what I've heard

slate swan
#

still stacks

#

dk what you mean by 2d but i looked it up and i figured this

#

like the buttons work, they just stack

obsidian ledge
#

do u want it to look like this

#

wait

slate swan
#

yeah

#

side by side

obsidian ledge
#

i used buttoncallbacks

#

and renamed it

#

like i copy and pasted it but renamed the "button_callback" thingy to "button_callback1"

slate swan
#

wdym buttoncallbacks

#

like is it in d_components lib or some other lib

obsidian ledge
slate swan
#

hm

#

okay

obsidian ledge
#

then add like nunmbers after the "button_callback"

#

so it doesnt replace the new ones with the current

slate swan
obsidian ledge
#

idk

#

i just wrote it out of my memory

#

i tihnk it was because i had "button.disable" or something like that

slate swan
#

and why the examples he hasnt even subclassed View

#

idk im kinda new to making discord bots so shrug

#

are you using discord-components?

#

yeah it was the first thing i learned for buttons so i just stuck with it

#

yikes

#

should i be using pycord for buttons or something 😭

#

disnake is good for buttons or just use master branch

#

you can , but pycord is not a too good fork imo

#

well , components for all forks remain same

exotic linden
#

So im using discord-components because yes... anyways while trying to get the person who clicked the button while inputing to a function to add to a database its saying it is missing a required argument

#

TypeError: MonkeyDataTools.check_for_user() missing 1 required positional argument: 'user'

#

ok so nevermind i have severe smoothbrainness

valid perch
#

Do you have any code?

rough wadi
#
@bot.command()
async def addon(ctx, user=None, days=None):

    try:

        if user == None:
            embed = discord.Embed(color = discord.Colour.red())
            embed.set_author(name='Addon Command')
            embed.add_field(name="Error", value="`You Did not specify a user`")
            embed.set_footer(text="Developed by Noelp")

            await ctx.send(embed=embed)

        elif days == None:
            embed = discord.Embed(color = discord.Colour.red())
            embed.set_author(name='Addon Command')
            embed.add_field(name="Error", value="`You Did not specify a amount of days`")
            embed.set_footer(text="Developed by Noelp")

            await ctx.send(embed=embed)

        elif Check_User(user) == False:
            embed = discord.Embed(color = discord.Colour.red())
            embed.set_author(name='Addon Command')
            embed.add_field(name="Error", value="`The user is not in the DataBase`")
            embed.set_footer(text="Developed by Noelp")

            await ctx.send(embed=embed)




        else:
            for user in dbdate["Data"]:
                print(user)
            embed = discord.Embed(color = discord.Colour.green())
            embed.set_author(name='Addon Command')
            embed.add_field(name="Success", value="Bruh")
            embed.set_footer(text="Developed by Noelp")

            await ctx.send(embed=embed)```
valid perch
#

Well you'll want to get the user's dict

#

Then when you have it, you can change it

rough wadi
#

oh ok

slate swan
#

how can i make a global var for my db connection with a bot var?

#

im not sure

valid perch
#

bot.variable = value

slate swan
quick gust
#

yea should be something like self.db = bot.db or however you made your db connection

slate swan
#

makes sense

quick gust
#

sorry I edited, it's not self.bot

valid perch
#

Yup, or just self.bot.db

slate swan
#

same thing

#

🏃

slate swan
#

im making it in a async function but when i try to use it outside it its not defined

valid perch
#

wdym

quick gust
#

could you explain a little more

slate swan
#

is there a way i can make my bot cooldown

#

not for a command, but for an event

rough wadi
slate swan
quick gust
slate swan
quick gust
#

I usually make a db connection in my main.py, (bot subclass) as bot.db, then in a cog I just have self.db = bot.db and now self.db is a bot.db instance and you can do stuff normally like self.db.execute or whatever

slate swan
#

never mind i got it

quick gust
#

alr

slate swan
#

sorry instances confuse me sometimes lol

final iron
#

Like a real smooth brain I open and close the connection in each command

quick gust
#

happens

maiden fable
quick gust
#

I think he knows

maiden fable
#

It not only makes the command slow, but can also result in your DB getting corrupted

final iron
#

Now that wouldn't be ideal

maiden fable
#

Indeed

final iron
#

I'll change it tmr

#

So what would I do?

maiden fable
#

Just like what Infernum does

slate swan
final iron
#

How would I access this from a cog?

slate swan
#

so each time i would just do

cursor self.db.execute(f"SELECT * FROM mytable;")
slate swan
#

since its a var inside of the class

final iron
slate swan
slate swan
#

let me do it myself smh idk why i havent

final iron
slate swan
final iron
#

Yes

slate swan
#

self.db.commit()

#

db is a var inside the class thats why your using self

quick gust
slate swan
#

if you made the bot var just bot.db.commit()

final iron
quick gust
#

so you can just do

slate swan
#

the var name lol

quick gust
#

self.connection = bot.connection

await self.connection.commit or await self.connection.execute basically everything u would do normally

final iron
#

Aight

slate swan
quick gust
#

in your bot subclass?

slate swan
#

yes

quick gust
#

no error?

slate swan
#

nah it just says its any

#

like the coro

quick gust
#

did u add self.bot.db = None

slate swan
quick gust
#

in the class

#

a bot variable

#

actually not sure if its needed

slate swan
#

i doubt its needed

#

because in my cog its not saying its the coro but i do have it in my bot subclass

quick gust
#

its too early for me ill help u later

slate swan
#

relatable

slate swan
#

😭

lament mesa
#

or use asyncio.loop.run_until_complete

slate swan
lament mesa
#

call the connection function for the attribute to be set

#

the attribute wont be set unless that function is called

slate swan
lament mesa
#

did you call the function?

#

!e ```py
class Foo:
def bar(self):
self.a = 10

foo = Foo()
try:
print(foo.a)
except AttributeError:
print("errr")

foo.bar()
print(foo.a)```

unkempt canyonBOT
#

@lament mesa :white_check_mark: Your eval job has completed with return code 0.

001 | errr
002 | 10
slate swan
#

the bot subclass?

slate swan
slate swan
# slate swan yes

so self would be the bot .., self.bot.db should raise an error imo

#

yes

#

make it self.db :p

#

that would be BotClass.db

slate swan
potent spear
slate swan
slate swan
potent spear
potent spear
#

there's a difference between the sync and async ones

slate swan
#

yes ik

#
#bot subclass
async def dbconnection(self):
    self.db = await aiosqlite.connect("")

cog

self.db = bot.db

just doesnt have the methods of the db

slate swan
slate swan
#

you dont need to worry about that , its just because Bot object does not have that attribute

#

you defined it manually

#

instead if you typehint bot as your bot class in the cog's __init__ , it will appear as the Connection object

#

let me check

#

and it does make sense

#

😳 yes , but , since you are connecting to the db only after your bot is ready .... i doubt if it will do that
so , just print or ctx.send it using a command

#

wont work with me tho

#

their not in the same folder lol

#

so what , you can import it

vale wing
#

How to close the connection when the bot is going off

slate swan
#

close connection from discord's websocket?

slate swan
vale wing
#

Db connection

#

Asyncpg in my case

slate swan
#

since you said it can corrupt itself

slate swan
#

!d discord.on_disconnect

unkempt canyonBOT
#

discord.on_disconnect()```
Called when the client has disconnected from Discord, or a connection attempt to Discord has failed. This could happen either through the internet being disconnected, explicit calls to close, or Discord terminating the connection one way or the other.

This function can be called many times without a corresponding [`on_connect()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_connect "discord.on_connect") call.
vale wing
#

Ok thx

slate swan
#

ill use it

vale wing
#

So when I make keyboard interrupt it will occur right?

slate swan
#

but its called only when the bot closes automatically , not by yourself

vale wing
#

I need it to close the connection on keyboard interrupt

#

Literally every time the bot finishes its work

vale wing
slate swan
#

well if you are closing it by yourself , it means the whole script is stopping
so that code will never execute

#

for me , i close the database as soon i finish the reading/writing operation

vale wing
#

Connection needs to be closed

slate swan
#

and should i close my cursor each time

#

is it bad if i dont?

vale wing
slate swan
#

nah , you dont need to

vale wing
#

I could implement it that way easily

slate swan
slate swan
#

so should i make a command that closes the db?

#

you can..

#

and then turn off the bot

#

🚶

#

seems like a pain

#

doesnt the connection close as soon as the script stops running

vale wing
#

The connection closes when the close method is called ig or when the timeout occurs

slate swan
#

docs says

async close() → None
Complete queued queries/cursors and close the connection.

#

so ig its like a return?

#

is it bad if i dont use a cursor var 🧍‍♂️

potent spear
slate swan
#

i just do .execute() without a var

slate swan
potent spear
slate swan
#

applies for all sqlite3 libs

#

idk i like not using a cursor

potent spear
#
async with aiosqlite.connect(...) as db:
    db.row_factory = aiosqlite.Row
    async with db.execute('SELECT * FROM some_table') as cursor:
        async for row in cursor:
            value = row['column']

    await db.execute('INSERT INTO foo some_table')
    assert db.total_changes > 0```
that's an example
rest would be [#databases](/guild/267624335836053506/channel/342318764227821568/)
slate swan
#

thats from docs lol

potent spear
#

correct

slate swan
#

i used the generator to see the rows

potent spear
#

everyone does

#

readability ftw

slate swan
#

i thought there was a better way lol

#

but ig not

potent spear
#

just change the row_factory to avoid having to look "what index" your column is

slate swan
#

i just index it lol

#

since i dont have much rows

potent spear
#

not yet

slate swan
vale wing
#

Maybe after bot is shutted down I can just get new asyncio loop and run the coroutine that closes database connection after bot.run

potent spear
#
class CustomBot(discord.Client):  # or inherit commands.Bot
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        ...

    async def close(self):
        await super().close()
        # close the stinky db here```
vale wing
#

Ah this thing

#

This thing is called whenever the program stops running right?

potent spear
#

correct

vale wing
#

Alr ty

slate swan
#

im not gonna even close the db connection🧑‍🦯

pliant gulch
#

The garbage collector would probably handle it anyways

potent spear
#

true, but this can be handy in case you for example want the "last time the bot closed/went offline" or whatever

#

I don't use it, nor do I implement such useless stuff

slate swan
#

whats a __init__.py file for seen it many times but im confused as people say its to make your file like a module or make it like a tree for all imports

slate swan
potent spear
#

you can ask it here tho, but if you want fast answers, you can go in active textchannels
I'm not a mod lol

boreal ravine
#

My bot isn't sending the help message, there are no errors

slate swan
boreal ravine
#

it's set to my help command

boreal ravine
#

not sure why my other command doesn't

slate swan
boreal ravine
slate swan
pliant gulch
#

Okimii I am opening the rewrites repo soon!

#

you can soon see how diff it is now from dpy

pliant gulch
#

😔

slate swan
#

how would i do

+send #channel {text}

slate swan
slate swan
#

@boreal ravine did you make any overwrite in the help class , other than send_help's?

exotic hill
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

boreal ravine
#

I overwrited every method that started with send_

#

Bro what

#

bruh

pliant gulch
#

Lefi is not being developed anymore

#

Since I'm making a rewrite right now of it

slate swan
slate swan
pliant gulch
#

Rin,

slate swan
#

is this what u mean?

slate swan
pliant gulch
#

I got the repo private rn I will be opening it later

slate swan
#

sad day

slate swan
slate swan
pliant gulch
#

I told you like a few times I was rewriting

slate swan
boreal ravine
slate swan
boreal ravine
#

oh wait

slate swan
boreal ravine
#

uh i havent

#

my bad thanks

slate swan
#

yw

boreal ravine
slate swan
pliant gulch
# slate swan you didnt told me the name 🧑‍🦯
from __future__ import annotations

import asyncio
import logging
import os

import rin

logging.basicConfig(level=logging.DEBUG)


async def main() -> None:
    token: str = os.getenv("DISCORD_TOKEN")  # type: ignore
    client = rin.GatewayClient(token, intents=32509)

    @client.once(rin.Event.READY)
    async def on_ready(user: rin.User) -> None:
        print(f"Logged in as: {user.id}")

    @client.on(rin.Event.MESSAGE_CREATE)
    async def on_message(data: dict) -> None:
        print(data)

    await client.start()


asyncio.run(main())
``` Heres how it currently looks
#

Not to shabby

#

Also I am vaporizing any get_ methods

#

As now is a class specific cache

slate swan
#

your starting from the start !!!!!!!!

pliant gulch
#

E.g get_user -> rin.User.cache.get(id)

slate swan
pliant gulch
#

are you serious

slate swan
#

im sorry😭

quick gust
#

lmfao

slate swan
#

🏃

quick gust
#

makes sense

keen talon
pliant gulch
#

And the package itself is typed strongly as of speaking

slate swan
#

but can it beat disnake😳

pliant gulch
#

maybe

slate swan
#

👀

slate swan
pliant gulch
#

what

slate swan
#

looks easy to do idk you make it seem easy

pliant gulch
#

some what easy 2 do for me cause I've made a few api wrappers already

slate swan
#

:kek:

maiden fable
pliant gulch
maiden fable
#

Functions inside function
Decorators inside function

#

The main function ^^^

pliant gulch
#

ohh

maiden fable
#

In the example u gave 😐

pliant gulch
#

Yea decorators in functions lol

#

why can't you do that?

maiden fable
#

Rip

#

Won't be better if u do asyncio.run(bot.run()) tho?

pliant gulch
#

bot.run() doesn't exist

maiden fable
#

I meant asyncio.run(client.start())

maiden fable
unkempt canyonBOT
#

Source code: Lib/__future__.py

__future__ is a real module, and serves three purposes:

• To avoid confusing existing tools that analyze import statements and expect to find the modules they’re importing.

• To ensure that future statements run under releases prior to 2.1 at least yield runtime exceptions (the import of __future__ will fail, because there was no module of that name prior to 2.1).

• To document when incompatible changes were introduced, and when they will be — or were — made mandatory. This is a form of executable documentation, and can be inspected programmatically via importing __future__ and examining its contents...

maiden fable
#

stdlib

heavy folio
#

oh

pliant gulch
#

Not sure if it's needed

static lintel
#

hey im getting this error but when i try to install DiscordUtils[voice] it says no matches found: DiscordUtils[voice]

potent spear
static lintel
potent spear
#

how have you tried to install the lib?

slate swan
static lintel
potent spear
#

can't be

#

unless you're in a venv

#

what happens when you run the said command? does it say 'requirement already satisfied"?

slate swan
static lintel
potent spear
#

installed via pip before?

static lintel
slate swan
#

Try using python3.9 -m pip install DiscordUtils[voice]

static lintel
maiden fable
#

Try installing from GitHub

static lintel
slate swan
#

It will install music too

#

Along with invite tracker and pagination

maiden fable
#

Where url and folder are in respect to GitHub

slate swan
maiden fable
#

🤣 facts

pliant gulch
#

taking a quick look

#

holy crap, this looks badly written

maiden fable
#

Facts

slate swan
#

Is naming the file Music.py okay? The capital M

unkempt canyonBOT
#

DiscordUtils/Music.py line 294

class Song(object):```
pliant gulch
#

Lmao what is this python 2?

maiden fable
#

badly written -> easier to understand to me hehe

maiden fable
pliant gulch
#

file names should be in lower case

maiden fable
slate swan
#

PascalCase is meant only for classes ryt

maiden fable
#

Yea

slate swan
#

☠️why would someone intentionally write it in 2.x , dpy is supported only after 3.5 iirc

maiden fable
#

Mhm

#

My man still living in the Python 2.6 era :DDD

static lintel
#

wait sorry i left for a sec

maiden fable
#

It's fine

static lintel
#

was there anything i should try to get it to work?

maiden fable
#

Yea...

pliant gulch
#

Was required in python 2 though

#

😔

maiden fable
#

Yea

slate swan
#
url = ""

🧑‍🦯

maiden fable
#

url = str()

static lintel
#

ok so i got it downloaded

maiden fable
#

Now do

#

pip install .[voice]

#

In that folder in a cmd

slate swan
# maiden fable url = str()
async def ytbettersearch(query):
    url = f"https://www.youtube.com/results?search_query={query}"
    async with aiohttp.ClientSession() as session:
        async with session.get(url) as resp:
            html = await resp.text()
    index = html.find('watch?v')
    url = ""
    while True:
        char = html[index]
        if char == '"':
            break
        url += char
        index += 1
    url = f"https://www.youtube.com/{url}"
    return url

url = "" 🧑‍🦯

#

if it was in rust 😳

let link : &str
slate swan
#

is legal

maiden fable
slate swan
pliant gulch
#

for (const auto &link : str) cpp

slate swan
#

cpp god 👀

maiden fable
#

I'm striving to become a React God by not learning React by learning it

slate swan
#

im going to learn ruby or php😳

pliant gulch
#

When you realize it's called React cause it uses reactive programming paradigm

slate swan
#

just learn python and make discord bots emoji_88

maiden fable
static lintel
#

ngl idk if i did this right

maiden fable
#

Tf?

static lintel
#

i googled it 😭

static lintel
pliant gulch
#

How would this even work, this package doesn't have a setup.py for pip to use

maiden fable
#

No I meant that's correct

pliant gulch
slate swan
#

going to learn swift feeling like a boss you already know😎

copper gulch
#

!e
for number in range(100, 8):
print number

unkempt canyonBOT
#

@copper gulch :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     print number
003 |     ^^^^^^^^^^^^
004 | SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
slate swan
copper gulch
#

Oh yea

pliant gulch
#

print with no parenthesis, python 2 moment

maiden fable
slate swan
vast gale
#

@timid wagon hi

timid wagon
#

Yes hoi

maiden fable
slate swan
#

you guys are on 3?

#

already on 4🤸

static lintel
slate swan
#

Ah cool then

#

Ignore it in that case

static lintel
#

hmmm anything else i should try?

slate swan
#

going to sleep gn🛌

slate swan
static lintel
slate swan
static lintel
maiden fable
#

Show yr imports and file structure

#

@static lintel

#

Ik the issue

slate swan
#

i don't want to be the person but it uses ytdl

maiden fable
#

Ik

#

But ig we have helped them till here, let's just finish it. Won't be helping with more code issues after this 🤷‍♂️

static lintel
maiden fable
#

Yea... Show yr imports and file structure

maiden fable
#

And file structure

static lintel
#

like this?

maiden fable
#

Which IDE u using? There should be a files and folder list on the left side of the window

static lintel
#

ohhh

#

does that look any better?

maiden fable
#

Rip u didn't open the whole folder in the IDE

#

Anyways

maiden fable
slate swan
#

i think im gonna learn ruby🧑‍🦯

maiden fable
#

Rip

#

Learn Lua, ezz

static lintel
maiden fable
timid wagon
#

I mean as per the error you received, you installed the package without voice

slate swan
maiden fable
timid wagon
maiden fable
twin moon
#
@nextcord.slash_command(name = "kick",description="kick a member",guild_ids=[ServerID])
    async def kick(self,interaction:nextcord.Interaction,member:nextcord.Member=None,*,reason:str = SlashOption(default = "no reason provided",required = False)):
        await interaction.response.defer()
        self.bot_user = self.client.get_user(self.client.user.id)
        if interaction.channel.permissions_for(interaction.user.id).kick_members is True and interaction.channel.permissions_for(self.bot_user).kick_members is True:
            if member is None:
                return
            await member.kick(reason=reason)
            embed = nextcord.Embed(description=f"{interaction.user.mention} kicked {member}")
            await interaction.followup.send(embed = embed)```
maiden fable
twin moon
maiden fable
#

obj is a number

#

Could be its already the ID?

maiden fable
#

Yea perfect

static lintel
#

sorry that took so long

maiden fable
slate swan
maiden fable
maiden fable
static lintel
slate swan
maiden fable
maiden fable
# static lintel

Do one thing... Move the DiscordUtils folder out of the DiscordUtils-master folder

#

The whole folder

#

Just drag the folder out of the other folder and place it with other files

twin moon
maiden fable
static lintel
maiden fable
maiden fable
#

Now u should be able to do music = Music()

maiden fable
#

Ik

maiden fable
#

It's Music bot

twin moon
#

that module violates TOS

maiden fable
maiden fable
static lintel
static lintel
#

uh i somehow managed to get a new error

maiden fable
#

Ah thought so haha

#

Add this line before importing music

from sys import path
path.insert(1, ".") 
#

Gonna work then (:

static lintel
twin moon
maiden fable
maiden fable
twin moon
#
@nextcord.slash_command(name = "nickname",description="kick a member",guild_ids=[ServerID])
    async def nickname(self,interaction:nextcord.Interaction,member:nextcord.Member = None,*,nickname:str = SlashOption(default = None,required = False)):
        await interaction.response.defer()
        if interaction.channel.permissions_for(interaction.user).manage_nicknames is True and interaction.channel.permissions_for(self.client.user).manage_nicknames is True:   #HERE
            await member.edit(nick=nickname)
            await interaction.followup.send(f"{member} nickname has been changed to {member if nickname is None else nickname}")```
maiden fable
#

Which line

#

Seems like a nextcord issue

twin moon
maiden fable
#

Seems like a nextcord issue

#

!d discord.TextChannel.permissions_for

unkempt canyonBOT
#

permissions_for(obj, /)```
Handles permission resolution for the [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role").

This function takes into consideration the following cases...
maiden fable
#

Yo @slate swan please tell them about the import error

#

My way not working lol

twin moon
maiden fable
#

Ik...

twin moon
maiden fable
unkempt canyonBOT
#

property me: discord.member.Member```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
maiden fable
unkempt canyonBOT
#

property me: nextcord.member.Member```
Similar to [`Client.user`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Client.user "nextcord.Client.user") except an instance of [`Member`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Member "nextcord.Member"). This is essentially used to get the member version of yourself.
maiden fable
#

There bruv

maiden fable
#

!d discord.abc.GuildChannel