#discord-bots

1 messages · Page 595 of 1

magic stump
#

voice_channe = ctx.message.author.channel

slate swan
#

.voice.channel

magic stump
#

a

#

ctx.message.author.voice.channel

gaunt ice
#

halp

magic stump
#

url2 = info['formats'] [0] ['url'] KeyError: 'formats'

#
              url2 = info['format'] [0] ['url']```
slate swan
#

!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)
slate swan
normal folio
#

help him

gaunt ice
#

in dms

brazen raft
#

I don't know if people mentioned it but if you really want to define these commands in the class then try @commands.command()

desert halo
#

hello, I made a "gui" for my bot and I faced off with this problem

RuntimeWarning: coroutine 'Messageable.send' was never awaited
  users[int(index)].send(content=msg)
#

there is my code

bronze pilot
#

If you have a bot that is say, more than 150 lines of code in the main file, is it recommended to start using classes?

#

Like, a single class for the bot. Maybe it's the right way, but I feel like it just adds another layer onto what you already have

slate swan
visual island
#

you can't use threading with asyncio

#

pick one

magic stump
#

ctx.voice_client.stop() AttributeError: 'NoneType' object has no attribute 'stop'

slate swan
#

!rule 5

unkempt canyonBOT
#

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

desert halo
slate swan
#

Selfbots are not allowed

desert halo
#

It isn't self bot lol

bronze pilot
#

what's a selfbot?

desert halo
#

what is self bot

slate swan
#

Automating normal user accounts (generally called "self-bots") outside of the OAuth2/bot API is forbidden, and can result in an account termination if found.

bronze pilot
slate swan
desert halo
#

I think so

magic stump
slate swan
#

Clearly says it's a selfbot

magic stump
slate swan
#

bot=False and Connecting to account...

#

what the heck is an event bot

desert halo
#

it's bot account tf you saying

slate swan
#

No

bronze pilot
#

It attempts multiple bot tokens

slate swan
#

It's a self-bot

desert halo
#

I won't argue with you cuz it's stupid

magic stump
#

bot read question

bronze pilot
#

idk if that makes it a selfbot but that seems unnecessarily dodgy

slate swan
#

are you playing youtube music with the bot?

#

<@&831776746206265384> can you make them understand that this is a self-bot and therefore breaks rule 5, already tried but for some reason doesn't want to understand it

See bot=False and Connecting to account...

magic stump
#

and users leason

#

bot

bronze pilot
#

I wonder why the helpers role is non-pingable

slate swan
#

I don't understand nothing

magic stump
#

ctx.voice_client.stop() AttributeError: 'NoneType' object has no attribute 'stop'

slate swan
#

show the code

magic stump
slate swan
bronze pilot
magic stump
#

yes

slate swan
magic stump
#

but no working

#

and error

bronze pilot
#

I'm actually interested, idk what this does

slate swan
#

voice_client is no longer a thing

#

!d discord.ext.commands.Context.voice_client

unkempt canyonBOT
#

property voice_client: Optional[VoiceProtocol]```
A shortcut to [`Guild.voice_client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.voice_client "discord.Guild.voice_client"), if applicable.
slate swan
#

It is still a thing.

bronze pilot
#

Ahaha there you go

magic stump
#

o

slate swan
bronze pilot
#

Deprecation... deprecation everywhere!

slate swan
#

Only thing that got changed about this attribute

#

It's still a thing

slate swan
# slate swan

oh sorry i confused it with voice_channel , they had something similar

desert halo
#

how poor you are

#

I even imagine your "moral portrait"

magic stump
#

how can i stop bot when read ctx.voice_client.stop() no working but in documentation i can't find

visual island
slate swan
#

tizzy typing intensifies

#

a whole book

bitter depot
#

As was stated, this is a selfbot which is against discord's ToS so we can't help with this here. Please refrain from asking for help with ToS violating projects, as per our #rules

slate swan
#

listen guys

gaunt ice
#

hey

slate swan
#

im getting this error(the admin command is in a cog found in cogs/admin.py)

#
import discord
from discord.ext import commands

class AdminCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    async def admin(self, ctx, argument):
        embed=discord.Embed(title='Administrator Commands', description='All available admin commands', color=discord.Color.blue())
        embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
        embed.add_field(name='.ban', value='.ban [member]', inline=False)
        embed.add_field(name='.kick', value='.kick [member]', inline=False)
        embed.add_field(name='.mute', value='.mute [member] [time]', inline=False)
        embed.add_field(name='.purge', value='.purge [amount]', inline=False)
    
        await self.ctx.send(embed=embed)
    

        
def setup(bot):
    bot.add_cog(AdminCog(bot))```
#

and heres the code

#

you didnt provide an argument while using the command

bronze pilot
#

well, it suggests that you've invoked the command without argument

slate swan
#

how do i do some argument

#

<prefix>admin argument

#

self.ctx.send........

#

it's just ctx.send

#

im doing .admin so i can get the mbed

bronze pilot
#

essentially something like !admin argument_here

slate swan
#

bruh

#

can i make it not need an argument

slate swan
#

with deleting the argument

bronze pilot
#

Yeah, remove argument as an argument

slate swan
#

ok

bronze pilot
slate swan
#

we're getting the best issues

bronze pilot
#

I'm just here usually to see if there are some methods/properties that I've never seen before

slate swan
#

well , they all are well documented in the docs

bronze pilot
#

that is not a serious message

slate swan
#

lol

#

how can i make that he say a random text?

honest elm
bronze pilot
#

If it's just any random text

slate swan
bronze pilot
#

i.e. something that doesn't make any sense

honest elm
bronze pilot
#

you can search up "password generator". That's the same concept

#

But if it has to make sense, like something with words

final iron
bronze pilot
#

I swear there's a module for anything nowadays 😄

honest elm
#

And do

final iron
bronze pilot
#

You can use random and have a list of verbs, nouns, adjectives etc. and define a valid sentence structure, and have a random number for indexing these lists

#

or random.choice(), that's just me forgetting about things

honest elm
final iron
#

That's a lot more complicated than just using aiohttp

slate swan
#
async def cuddle(ctx, member: discord.Member, *, reason=None):
    await ctx.send(f"{member.nick} Du wirst von {ctx.author} Geknudellt || https://tenor.com/view/yoriko-frymiko-fryes-frymiko-hug-gif-22979062 || ")
``` how can i make that the bot send random link text?
bronze pilot
#

I'm out for this one

slate swan
#

uhm :/

opaque plinth
slate swan
#

?

bronze pilot
#

It's a confusing question

opaque plinth
#

Huh

#

ig he needs the bot to send random cuddle gifs everytime someone uses that

#

For that u should use a api or add many tenor cuddle gifs and use random.choice

bronze pilot
#

I was thinking of the second option 🙂

#

But in the case where you have hundreds of cuddle gifs use an api

#

even 50 ig

opaque plinth
#

yea that's also a point

bronze pilot
#

There probably is a gif generator module somewhere for python. As I said earlier, I swear there's a module for everything

opaque plinth
#

but half of the people use a api for this

slate swan
#

i am stuid ._.

#
async def cuddle(ctx, member: discord.Member, *, reason=None):
    await ctx.send(f"{member.nick} Du wirst von {ctx.author} Geknudellt {random.choice}|| https://tenor.com/view/yoriko-frymiko-fryes-frymiko-hug-gif-22979062 |||| https://tenor.com/view/hug-comfort-cute-anime-friends-gif-22169252||")```
#

idk how to do it

#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

!d random.choice

unkempt canyonBOT
#

random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
slate swan
#
async def cuddle(ctx, member: discord.Member, *, reason=None):
    await ctx.send(random.choice((f"{member.nick} Du wirst von {ctx.author} Geknudellt || https://tenor.com/view/yoriko-frymiko-fryes-frymiko-hug-gif-22979062 ||"))f"{member.nick} Du wirst von {ctx.author} Geknudellt ||https://tenor.com/view/hug-comfort-cute-anime-friends-gif-22169252||")
``` so? ik i am stupid
pallid harbor
#

how can I get message text content if message has image?

slate swan
unkempt canyonBOT
slate swan
#
if not (more than 0):
  return
#code```
pallid harbor
#

It gives me only attachments but I need to get text from message too

slate swan
#

read what i sent

slate swan
slate swan
#

Store the content in another variable

#

Or if you only use it once, just use message.content when you need it

slate swan
pallid harbor
#

thank you all!

slate swan
#

Just check if it's not empty and add the image into the embed, then do your stuff as usual

normal folio
#

I need quik help
problem:
if i choose and it will buy only from mainshop
If i choose or it will buy only from other shop

void dew
#

I need help

#

I tried a lyrics command but shows this error

#

Can anyone help

unreal cave
#

When I run the following code, I get the error: Exception has occurred: TimeoutError

            reactions = ["✅", "❌"]

            message=discord.Embed(title="Flight Log Confirmation", description=f"This is the information on your flight for {country}" , color=0x2e6600)
            message.set_author(name="ACRP Bot", icon_url="https://vignette.wikia.nocookie.net/acecombat/images/5/5d/Project_aces_logo.png/revision/latest?cb=20110612183934")
            message.set_thumbnail(url="https://cdn.discordapp.com/attachments/738862227469238272/838477697206190120/BhqmWPt.png")
            message.add_field(name="Aircraft Flown:", value=f"{aircraft}", inline=True)
            message.add_field(name="Distance Flown:", value=f"{km}km", inline=True)
            message.add_field(name="Money Gained:", value=f"{third}", inline=True)
            message.set_footer(text="Please make sure that you round the distance down to the nearest 30 (Auto-Rounding WIP)")
            msg = await ctx.send(embed=message)
            
            for reaction in reactions:
                await msg.add_reaction(reaction)

            while True:
                try:
                    reaction, user = await self.bot.wait_for("reaction_add", check=lambda reaction, user: user == ctx.author and reaction.emoji in reactions, timeout=20)

                except asyncio.TimeoutError:
                    await ctx.send("Something went wrong, please retry.")
                    return
steady flume
#

Pls help find Views in api ref

maiden fable
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.
steady flume
dusk dust
#

the robot sends a link with an attachment, but I wanted it without the attachment... what do I do?

slate swan
summer flume
#

help

slate swan
#

Each item in the list should have their own probability

#

So if you have 30 people who reacted, you should have a list containing 30 probabilities

#

Not just your 10 probabilities

summer flume
#

ok but there is no way to remove that probability?

slate swan
#

Yes?

#

Just remove it what

#

And use random.choice(your_list)

#

!d random.choice

unkempt canyonBOT
#

random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
summer flume
#

I did that first time but I want to not be the same winnner

slate swan
#

It doesn't give always the same winner

summer flume
#

oh alright

dusk dust
#

IPayForWinrar

#

can you help me?

slate swan
#

how do i make pages instead of being this

maiden fable
#

Paginator?

slate swan
#

tf is that

maiden fable
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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

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

This function returns the **first event that meets the requirements**...
maiden fable
vale wing
#

Is there a way to get an invite that was used by a just joined member

steady flume
#

The specified number of default values exceeds the specified maximum values
What does this error mean??

#

It appeared after I added 3 Option

upbeat otter
#

Guys, why does my bot keep saying that it doesnt have the permission to kick members when it has 2 roles that can kick members?

patent surge
#

Guys I have made a Minecraft bot, Minecord wanna see

#

.

slate swan
#
import discord
import random 

client - discord.client()

@client.event
async def on_ready():
  print('(0.user)'.format(client))
  print('lol online')
  print('---------------------')
  print('hello pls work ')

coinflip = {'tr1ckshot', 'alex'}

@client.event
async def on_message(message):
  if message.author.bot : 
    return 

if message.content.startswith('-alex'):
  await message.channel.send('alexs stock
        k-6 - offers open
        5t. - offers open
        rw.- c/o 10€
        kb.- offers open
              (message.author)')

client.run(process.env.TOKEN) ```
slate swan
brazen chasm
#

I need the info

slate swan
#

@brazen chasm ?

#
import discord
import random 

client - discord.client()

@client.event
async def on_ready():
  print('(0.user)'.format(client))
  print('lol online')
  print('---------------------')
  print('hello pls work ')

coinflip = {'tr1ckshot', 'alex'}

@client.event
async def on_message(message):
  if message.author.bot : 
    return 

if message.content.startswith('-alex'):
  await message.channel.send('alexs stock
        k-6 - offers open
        5t. - offers open
        rw.- c/o 10€
        kb.- offers open
              (message.author)')

client.run(process.env.TOKEN) ```
brazen chasm
#

Is that your bot?

slate swan
#

Yup

#

It’s not working

brazen chasm
#

I'm trying to make a different kind of bot

brazen chasm
slate swan
#

It’s fine

#

I’m gonna make message embedded

#

So I’ll use js

brazen chasm
#

good idea

pallid harbor
#

How can I check if user in guild?

reef shell
#

ig

#

it you are taking the user as input, then you can typehint it

wicked atlas
wicked atlas
bronze pilot
#

That should work. Also, you don't need the id before the if statement

#

Oooo that's a really good point

wicked atlas
bronze pilot
#

my ass

bronze pilot
pallid harbor
wicked atlas
#

Wait a minute, id() is a builting function?

pallid harbor
#

yep

wicked atlas
#

!d id

unkempt canyonBOT
#
id

id(object)```
Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same [`id()`](https://docs.python.org/3/library/functions.html#id "id") value.

**CPython implementation detail:** This is the address of the object in memory.

Raises an [auditing event](https://docs.python.org/3/library/sys.html#auditing) `builtins.id` with argument `id`.
wicked atlas
#

!d discord.Guild

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a “server” in the official Discord UI.

x == y Checks if two guilds are equal.

x != y Checks if two guilds are not equal.

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
bronze pilot
#

!d discord.Guild.get_member

unkempt canyonBOT
bronze pilot
#

Oh thanks how useful

outer violet
wicked atlas
#

I think you might have miswrote something

bronze pilot
wicked atlas
bronze pilot
#

Literaly, there is nothing to explain about that. It is a suggestion. Should the first work, dont bother with taking my suggestion

warped spear
#
@On(mcbot,'chat')
async def onChat(this, user, ctx , *args):
  print(f'{user}: {ctx}')
  channel = bot.get_channel(901314284972310641)
  await channel.send(f'{user}: {ctx}')```

im getting ``` RuntimeWarning: coroutine 'onChat' was never awaited del self.m[i]```
#

i need help

warped spear
#

minflayer from js using jspybridge

#

and discord

wicked atlas
#

well, it looks like the python function isn't being awaited

warped spear
#

how do you await it

wicked atlas
#

Because it's bridged from js to python, it's hard to tell how to fix it

slate swan
#

someone knows?

#

where is that

#

show more traceback

#

oh wait got it

#

len(queue)[start:end]

#

len(queue) is a number

#

26[2] makes no sense

slate swan
#

how do I make a command only usable by 2 users

#

its my queue list

#

you used length

#

which returns how many items your list has

#

therefore it's a number

#

so u know how to fix it?

vocal plover
#

you put [start:end] outside of the len() function, by accident i imagine, so instead you want to be taking a slice of the array before it goes in, not the return value

slate swan
#

maybe remove len(), I don't know what you want but it would remove the error

slate swan
#

what kind of error

#

and why the brackets

vocal plover
#

what you're doing: len(a)[]
what you're trying to do: len(a[])

slate swan
#

hm would make sense

#

see?

vocal plover
#

what is queue

slate swan
#

its the player queue list

vocal plover
#

yes but what actually is it

#

because its definitely not a list

slate swan
#
print(type(queue))```
#

maybe just the second one

vocal plover
#

you may need to end up doing len(list(queue)[start:end])

#

assuming that queue can be made into a list, but if its a sequence it should

slate swan
#

music bot question mark

#

this is a really wild guess for player

opaque wadi
slate swan
#

how do you make a command only used by two users

slate swan
#

Error says all

#

You gave a wrong token

#

guys im working on my bot and right now i want to make it so if someone types .verify the bot will assign them a role called "Verified"

#
@bot.event
async def on_message(message):
    verify_channel = bot.get_channel(909149225919582279)
    verify_role = get(member.guild.roles, id='908901399780266025')
    if message.content == '.verify' and message.channel == verify_channel:
        await member.add_roles(message.author, verify_role)
        await message.channel.send(f'{message.author}, thank you for verifying.')``` heres my code
#

Use commands

#

Not events to make commands

#

so would that make it so when someone joins i have to manually assign them a role

#

No

tacit sedge
#

yo why wont my code run

slate swan
#

It doesn't change anything to what tou have now

tacit sedge
#

lemme send it 1 sec

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

os.chdir("C:\\Users\\carli\\Desktop\\my bot\\economi.py")

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

@client.event
async def on_ready
    print("Ready")

@client.command
async def balance(ctx):
    await open_account(ctx.author)
    user = ctx.author
    users = await get_bank_data()

    wallet_amt = users[str(user.id)]["wallet"]
    bank_amt =users[str(user.id)]["bank"]

    em = discord.Embed(title = f"{ctx.author.name}'s Balance",colour = discord.Colour.red())
    em.add_field(name = "Wallet Balance",value = wallet_amt)
    em.add_field(name = "Bank Balance",value = bank_amt)
    await ctx.send(embed = em)

@client.command()
async def beg(ctx):
    await open_account(ctx.author)

    users = await get_bank_data()

    user = ctx.author

    earnings  = random,randrange(101)

    await ctx.send(f"Someone gave you {earnings} coins!")

    users[str(user.id)]["wallet"] += earnings

    with open ("mainbank.json" , "w") as f:
        json.dump(users,f)


async def open_account(user):
    with open("mainbank.json" , "r") as f:
        users = json.load(f)

        users = await get_bank_data()

        if str(user.id) in users:
            return False 
        else:
             users[str(user.id)] = {}
            users[str(user.id)]["wallet"] = 100
            users[str(user.id)]["bank"] = 100

        with open ("mainbank.json" , "w") as f:
        json.dump(users,f)
    return True 

async def get_bank_data():
    with open("mainbank.json" , "r") as f:
        users = json.load(f)

    return users  

client.run("token")
slate swan
#

No need to give another argument

#

where do i put dat

#

oh nv

#

Don't copy paste it...

#

Change your code to just have a role argument

#

And IDs are integers, not strings

#
@bot.command()
async def on_message(message):
    verify_channel = bot.get_channel(909149225919582279)
    verify_role = get(member.guild.roles, id=908901399780266025)
    if message.content == '.verify' and message.channel == verify_channel:
        await member.add_roles(verify_role)
        await message.channel.send(f'{message.author}, thank you for verifying.')```
#

hows that look

#

and it works

tacit sedge
slate swan
#

oh it works so well

#
@commands.command()
    async def purge(self, ctx, amount=150):
        channel = ctx.message.channel
        messages = []
        async for message in bot.logs_from(channel, limit=int(amount) + 1):
            messages.append(message)
        await bot.delete_messages(messages)
        await bot.delete_message(ctx.message)```
rare saddle
#

How to make the condition that if you specified not a category, but a text channel or a voice channel, then display an error

slate swan
#

alright this is my purge command, how do i make it so i can specify a certain amount instead of it being hardcoded

#

It is already specified

#

Just execute !purge <amount>

#

When using the command on Discord

#

oh ok

#

it didnt work

#
File "/home/austin/Desktop/Phasmo/cogs/admin.py", line 81, in purge
    async for message in bot.logs_from(channel, limit=int(amount) + 1):
NameError: name 'bot' is not defined
#

self.bot

#

You're in a cog

#

thx

bronze pilot
#

Are you supposed to use async with loops?

#

In async functions

slate swan
#
File "/home/austin/Desktop/Phasmo/cogs/admin.py", line 81, in purge
    async for message in self.bot.logs_from(channel, limit=int(amount) + 1):
AttributeError: 'Bot' object has no attribute 'logs_from'```
#

fuk

#

Pretty sure that's old copy pasted code

#

Use .purge method on a channel object

bronze pilot
#

@slate swan if in doubt just put the object inside dir()

#

It will tell you all properties and methods

slate swan
#

same error

opaque wadi
slate swan
unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Examples

Deleting bot’s messages...
slate swan
#

There is an example

slate swan
#

thx

slate swan
bronze pilot
#

One thing, is channel = ctx.message.channel necessary? I use ctx.channel.send() for sending messages, so I would think that channel = ctx.channel would give what they're looking for

slate swan
#

Sure I guess?

slate swan
#

import os
import discord
import random

client - discord.client()

@client.event
async def on_ready():
print('(0.user)'.format(client))
print('lol online')
print('---------------------')
print('hello pls work ')

coinflip = {'tr1ckshot', 'alex'}

@client.event
async def on_message(message):
if message.author.bot :
return

if message.content.startswith('-alex'):
await message.channel.send
('alexs stock
k-6 - offers open
5t. - offers open
rw.- c/o 10€

bronze pilot
#

That sounds good, idk why they have another .send method for the channel

tacit sedge
#

can i get some help

bronze pilot
#

still, what I'm saying is I think ctx.channel is better than ctx.message.channel

slate swan
slate swan
tacit sedge
#

i have

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

os.chdir("C:\\Users\\carli\\Desktop\\my bot\\economi.py")

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

@client.event
async def on_ready
    print("Ready")

@client.command
async def balance(ctx):
    await open_account(ctx.author)
    user = ctx.author
    users = await get_bank_data()

    wallet_amt = users[str(user.id)]["wallet"]
    bank_amt =users[str(user.id)]["bank"]

    em = discord.Embed(title = f"{ctx.author.name}'s Balance",colour = discord.Colour.red())
    em.add_field(name = "Wallet Balance",value = wallet_amt)
    em.add_field(name = "Bank Balance",value = bank_amt)
    await ctx.send(embed = em)

@client.command()
async def beg(ctx):
    await open_account(ctx.author)

    users = await get_bank_data()

    user = ctx.author

    earnings  = random,randrange(101)

    await ctx.send(f"Someone gave you {earnings} coins!")

    users[str(user.id)]["wallet"] += earnings

    with open ("mainbank.json" , "w") as f:
        json.dump(users,f)


async def open_account(user):
    with open("mainbank.json" , "r") as f:
        users = json.load(f)

        users = await get_bank_data()

        if str(user.id) in users:
            return False 
        else:
             users[str(user.id)] = {}
            users[str(user.id)]["wallet"] = 100
            users[str(user.id)]["bank"] = 100

        with open ("mainbank.json" , "w") as f:
        json.dump(users,f)
    return True 

async def get_bank_data():
    with open("mainbank.json" , "r") as f:
        users = json.load(f)

    return users  

client.run("token")
#

why wont this run

slate swan
#

You already created a help channel for it

bronze pilot
#

Because you have "" around your token

slate swan
#

Stay in there and don't copy paste code from internet

bronze pilot
#

remove the quotation marks, you are passing in a string

slate swan
#

It's just to hide the token...

bronze pilot
#

It's fine dude I can see the problem

#

..?

rare saddle
#

How to make the condition that if the specified id is not a category then display an error

tacit sedge
#

nope it wont run still

slate swan
#

It's to prevent to send the actual token

bronze pilot
#

I would have thought token is a variable, i wouldnt expect the actual token

tacit sedge
bronze pilot
#

lmao gotem

slate swan
#

Patience is part of your job

tacit sedge
#

yeah i know

#

ive had patience

slate swan
#

So stay in there and be patient

tacit sedge
#

it got closed

bronze pilot
#

@tacit sedge how do you mean it wont run?

#

any errors?

tacit sedge
slate swan
#

Your functions should be defined before you use them

bronze pilot
#

Open the file to host, hmmm

#

are you referring to a file to run your code, like a script?

slate swan
#

!e
my_func()
def my_func():
print("This will show error as the function got defined after I used it")

unkempt canyonBOT
#

@slate swan :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 'my_func' is not defined
bronze pilot
#

If it does that it suggests to me that all your code is doing is defining functions and not calling them, or you forgot to call an important function

slate swan
#

This is your issue

#

Nothing more

#

Define your functions before you try to execute them

bronze pilot
#

ye tbf you have your final function get_bank_data() called before it is defined, inside your first function

#

Although I'm confused as to why it isn't showing any errors and just closing instantly

slate swan
#

Put get_bank_data above open_account and put both of the functions at the top of your file before the command balance

bronze pilot
#

Even a bash script would output the error

#

love it when communications end without any notice

#

Also, do get_bank_data() and open_account() functions strictly need to be async functions?

rare saddle
#

How to make the condition that if the server already has a category with the same name, then do not create a new category?

slate swan
#

Ik but it doesn’t make sense read code Above

slate swan
#

BRUH

#

Un send

#

That’s against tos

slate swan
#

Self bot

#

I do

#

When you use bot type commands on your own account

#

Having self in your command doesn't mean its a self bot

#

how do I make a command only work if a user has a certain role

slate swan
#

ok

#

I have that

#

if role == roleid:something like that ig

#

Not a good explanation but sm like that

#

Yea

#

If role isn’t (“id”)

#

Huh?

slate swan
slate swan
#

@slate swan see this channel is for helping with bot not making

#

@slate swan

#

I think you have to read the description of the channel

#

O lol

slate swan
#

Bet

#

@slate swan how do I make it embed

slate swan
unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

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

Ty

#

Np

#

@slate swan I wanna make a list like
User- price
User - price

#

But it’s not working it keeps giving errors

#

import os
import discord
import random

client - discord.client()

@client.event
async def on_ready():
print('(0.user)'.format(client))
print('lol online')
print('---------------------')
print('hello pls work ')

coinflip = {'tr1ckshot', 'alex'}

@client.event
async def on_message(message):
if message.author.bot :
return

if message.content.startswith('-alex'):
await message.channel.send
('alexs stock')
k-6 - offers open
5t. - offers open
rw.- c/o 10€ ')

client.run

rare saddle
#

How to make sure that if a category with the same name already exists, then do not create it again?

slate swan
#

That’s what I would do

#

Ok

#

!Codeblock

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
#
import discord
import random 

client - discord.client()

@client.event
async def on_ready():
  print('(0.user)'.format(client))
  print('lol online')
  print('---------------------')
  print('hello pls work ')

coinflip = {'tr1ckshot', 'alex'}

@client.event
async def on_message(message):
  if message.author.bot : 
    return 

if message.content.startswith('-alex'):
  await message.channel.send
  ('alexs stock')
    k-6 - offers open
   5t. - offers open
  rw.- c/o 10€ ')

client.run```
#

@slate swan

wicked atlas
slate swan
#

Ok

#

Ok

wicked atlas
#

Honestly it's either you're trolling or you just don't pay attention when you type 😅

wicked atlas
#

yeah that was my first thought when i saw line 5

slate swan
#

Ofc that’s how I work

#

I know just the fix

#

Add print(“hello world”)

#

There we go problem fixed

#

What do you want to achieve exactly

#

Well I was trying to make command but then I gave up and trolled w code

#

Yea

patent lark
#

you need to use discord.ext.commands.Bot, discord.Client() doesn’t have any command decorators

slate swan
#

Ok

patent lark
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
patent lark
#

look into the documentations

slate swan
#

Ok thanks

#

@patent lark my plan is to make a command to show an embed message of stocks like
Stock - price
Stock - price
Ect but embedded

#

Pretty good tutorial to learn with

#

Ty

#

Yw

lusty swallow
#

Oof

slate swan
#
bot = commands.Bot(command_prefix="a!")

@bot.command(name="stocks")
async def embed(ctx):
  embed = discord.Embed(title="stocks, url="https://cdn.discordapp.com/attachments/895176029537189909/909014424969441280/standard_6.gif", description="test", colour=#444f59)
await ctx.send(embed=embed)
  
bot.run```
rare saddle
#

How to make the condition that if the author has a role with an ID that is in the list, then display the answer?

hardy yoke
#

do you have member intents enabled in the dev portal?
add intents=intents to your bot constructor (commands.bot(etcetc))

#

bots should not be given admin it's a security risk, just give it the perms it requires

#

that's not what I'm referring to anyway - in the dev portal there's a box to tick that you need to tick to get member intents

hardy yoke
slate swan
hardy yoke
#

if a syntax error is pointing at a bracket like that it's usually because you've missed something further up 🙂

#

I mean I doubt you need all those but yes that's 100% better than requestin Admin
But not related to the member intents thing

#

nextcord and d.py share the same syntax for the most part but you can check their server to be certain

#

nope

#

you need to do it in the code AND in the dev portal

#

the middle box there needs to be ticked on if you want to use member events

#

also it seems like you overwrite line 32 in line 36

silent ermine
# hardy yoke

Is that what shows when you can apply for verified bots?

slate swan
#

can anyone help me

hardy yoke
#

that looks good
then I assume it's because intents=intents isn't in the bot constructor, try adding that and reloading the bot.

e.g bot = commands.Bot(command_prefix=get_prefix, intents=intents)

slate swan
#
import discord
import random
import aiohttp
from discord.ext import commands
bot = commands.Bot(command_prefix="/")
@bot.command()
async def dog(ctx):
   async with aiohttp.ClientSession() as session:
      request = await session.get('https://some-random-api.ml/img/dog') 
      dogjson = await request.json() 
   embed = discord.Embed(title="Doggo!", color=discord.Color.purple()) 
   embed.set_image(url=dogjson['link']) 
   await ctx.send(embed=embed) 
#

it donst work

hardy yoke
silent ermine
#

does it require face registration ?

slate swan
#

can someone heklp

hardy yoke
reef shell
#

Yes you need to provide your personal info to them

hardy yoke
#

does your on_ready event run?

slate swan
#

like when i do /dog it wont send the photo

#

before it was working but i added more stuff so when i tested it it ddosnt work anymore

#

can i dm u full code

#

there

unreal cave
#

zoom out for indentation to work

#

Thats just a fraction

#

The whole thing is over 100 lines

#

But that fraction is basically what returns the error

#

specifically line 17

#

tabs

#

?

silent ermine
pale zenith
#

16?

slate swan
#

@unreal cave are you using vscode?

unreal cave
#

yes

silent ermine
hardy yoke
slate swan
#

@unreal cave what error does it produce?

#

and use pretty errors python -m pip install pretty_errors

slate swan
#

k

unreal cave
#

one sec

slate swan
#

dosnt work

unreal cave
#

Exception has occurred: TimeoutError exception: no description

#

@slate swan ^^

slate swan
#

show your imports

unreal cave
#

import discord from discord.ext import commands from googleapiclient.discovery import build from google.oauth2.credentials import Credentials from google.oauth2 import service_account import asyncio import math

#

The google stuff is for a spreadsheet

slate swan
#

import reactions

unreal cave
#

same error

slate swan
unreal cave
#

Thats an event

#

Its not an error with the reaction

#

like the reaction stuff works

#

its just that the timeout doesnt

slate swan
#
@slash.slash(description="Displays the Latency and Uptime of the bot")
async def ping(ctx):
    embed = discord.Embed(title=":ping_pong: Response Times :ping_pong:", color=discord.Colour.blue())
    embed.add_field(name="API", value=f"`Loading...`")
    embed.add_field(name="Websocket", value=f"`{int(client.latency * 1000)}ms`")
    embed.add_field(name="Uptime", value=f"`{str(datetime.timedelta(seconds=int(round(time.time()-startTime))))}`")
    time_before = time.time()
    edit = await ctx.send(embed=embed, content=f"{ctx.author.mention}")
    time_after = time.time()
    difference = int((time_after - time_before) * 1000)
    embed = discord.Embed(title=":ping_pong: Response Times :ping_pong:", color=discord.Colour.green())
    embed.add_field(name="API", value=f"`{difference}ms`")
    embed.add_field(name="Websocket", value=f"`{int(client.latency * 1000)}ms`")
    embed.add_field(name="Uptime", value=f"`{str(datetime.timedelta(seconds=int(round(time.time()-startTime))))}`")
    await edit.edit(embed=embed, content=f"{ctx.author.mention}")
``` this works as client.command but not as a slash command
#

any idea why?

#

anyone mind helping me

slate swan
slate swan
#

ok

#

thats my code and it works fine but

#

when i add this code

#
@bot.event
async def on_message(message):
    guild = message.author.guild
    if message.content.lower() == "+member": 
         role = discord.utils.get(guild.roles, name="member") 
         if role is not None: # 
            await message.author.add_roles(role)```
#

the code just dons't work

#

@bot.listen i think can solve the error

#

theres no error

#

its just lik dosnt do anything

slate swan
#

thanks

slate swan
#

how would u add a .env file to replit

slate swan
#

Under a command their will always be a list of errors and the reasons

slate swan
kindred epoch
#

Add a comma after user_id for the placeholder

slate swan
kindred epoch
#

Lol did it work?

#

Ohk

slate swan
kindred epoch
#

Hm

#

Try removing the (,) and just put user_id

#

Oh or index it

#

By the column name

#

Ok then add it

#

And try

#

Idk I'm so used to postgres that I don't have to wrap it around tuples so it's even more easy

#

Just returns in a list

dense pelican
#

Is it bad that I implement self editing utilities in my discord bot so I can edit the bot through the bot?

kindred epoch
#

Like

dense pelican
#

Other than the obvious if I make a mistake and save changes the bot will die and I'll have to edit it directly

#

I have a system where I edit by line, so I can display lines x to y then overwrite line z with such and such then restart and there's the patch done

#

That way I can host the bot remotely

slate swan
#

You want a coding assistant ?

#

Wait do you want a bot that does a update with no downtime?

#

I am so confused

dense pelican
#

Self editing bot

slate swan
#

Elaborate

kindred epoch
#

Even if it's inside a cog

#

You use self when it's only about commands.Bot

#

What

#

Wtf

#

Why did you do that

#

That's not even needed

#

What lib are you using

worthy wagon
#

Yo, how would I checks for this?, I can't seem to find any way out of the 3 I tried for this.

kindred epoch
#

Idk how to use that so why not ask in their support server?

worthy wagon
#

And then I get a conversion error.

kindred epoch
#

Huh

#

Doesn't look like it

worthy wagon
#

It's ignoring my if statements for some reason

kindred epoch
#

Lol

#

That's not how you set args as none

worthy wagon
#

Oh

#

That's what I thought you meant

kindred epoch
#

You defined them as None

worthy wagon
#

Yeah, I'm lost

kindred epoch
#

a: int=None

worthy wagon
#

Oh, I did that.

#

oh wait

#

I put 2 equal signs, 🤦

worthy wagon
kindred epoch
#

Np

brave flint
#

any docs for user latency?, in google they are only showing bot's latency not user

tiny ibex
#

What to do when you get bombed?? 💀

slate swan
#

Anybody got a good buttons tutorial for disnake

boreal ravine
slate swan
#

Alr

maiden fable
#

ctx.user*

#

Nvm

strong widget
#

this isn't a question

#

but im happy so im posting

boreal ravine
#

ok

tiny ibex
#
 memes = []


  @commands.command(pass_context=True)
  async def meme(self, ctx):
      wait = await ctx.send(f":mag: Please hold on, searching ")
      try:
          reddit = praw.Reddit(client_id="",
                               client_secret="",
                               username="Username",
                               password="",
                               user_agent="UserAgent",
                               check_for_async=False)
          if not memes:
              subreddit = reddit.subreddit("meme")
              meme = subreddit.top(limit=300)
              for i in meme:
                  link = i.url
                  if len(link.split('.')[-1]) == 3:
                      memes.append(i)

          send_meme = random.choice(memes)
          memes.remove(send_meme)
          embed = discord.Embed(title=send_meme.title, colour=0xffae00)
          embed.set_image(url=send_meme.url)
          embed.set_footer(text="Source: Reddit")
          await wait.edit(content="", embed=embed)
      except:
          await wait.edit(content=":x: Something went wrong, cannot get meme ")```
#

What's wrong here??

boreal ravine
tiny ibex
#

Simple

#

¯_(ツ)_/¯

boreal ravine
#

It doesnt work like that

#

its YOUR code

tiny ibex
#

IDK why

boreal ravine
#

try raising the exception

tiny ibex
boreal osprey
#
Ignoring exception in command lockdown:
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\myname\Desktop\montigraal\bot.py", line 488, in lockdown
    await ctx.send(embed=e)
  File "C:\Users\myname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\abc.py", line 1065, in send
    data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
  File "C:\Users\myname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\http.py", line 254, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.description: This field is required
stark bobcat
#

hello

stark bobcat
boreal osprey
# stark bobcat send code
@bot.command()
@commands.has_permissions(manage_channels = True)
async def lockdown(ctx, channel : discord.TextChannel=None):
    await ctx.channel.set_permissions(ctx.guild.default_role,send_messages=False)
    e=discord.Embed(descripion=f"✅ {channel.name} has been locked!")
    await ctx.send(embed=e)


@bot.command()
@commands.has_permissions(manage_channels=True)
async def unlock(ctx, channel : discord.TextChannel=None):
    await ctx.channel.set_permissions(ctx.guild.default_role,send_messages=False)
    e=discord.Embed(description=f"✅ {channel.name} has been unlocked!")
    await ctx.send(embed=e)
#

it says something about invalid body form

slate swan
#

heyy

#

i need help with my bot

#

"discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions" im getting this error but i gave my bot admin role

boreal osprey
#

send code

stark bobcat
boreal osprey
#

@stark bobcat i sent my code

slate swan
stark bobcat
slate swan
#
import os
import discord 
from discord.ext import commands

client = commands.Bot(command_prefix = ">")
slur_words = ['cat']
@client.event
async def on_ready():
  print('we have logged in as {0.user}'.format(client))


@client.event
async def on_message(message):
  if message.author == client.user:
    return
  channels = client.get_channel(908607227361890314)
  if any(word in message.content for word in slur_words):
    await message.delete()
    await message.channel.send(f"{message.author.mention} don't use slur words")
    await message.author.send("please don't use slur words")
    await channels.send(f"user {message.author.mention} has used slur word")
  await client.process_commands(message)

@client.command(aliases = ['clear'])
@commands.has_permissions(manage_messages =True)
async def clear_func(ctx, amount=1):
  print("it's working!!")
  await ctx.channel.purge(limit = amount+1)


@client.command(aliases = ["mute"])
async def mute_func(ctx, member:discord.Member, reason= None ):
  print("it's working")
  muted_role = ctx.guild.get_role(908354074989195266)
  await member.add_roles(muted_role)


my_secret = os.environ['token']
client.run(my_secret)
boreal osprey
stark bobcat
slate swan
#

yeah

boreal osprey
slate swan
#

ok

boreal osprey
#

god that wording came out so badly, omfg

slate swan
#

Ignoring exception in command mute_func:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 35, in mute_func
await member.add_roles(muted_role)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/member.py", line 777, in add_roles
await req(guild_id, user_id, role.id, reason=reason)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py", line 248, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/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: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

#

this is the error

boreal osprey
#

either you, or the bot is missing perms

slate swan
#

im sure both of us have permissions

#

lemme confirm it

stark bobcat
slate swan
#

yeah

#

the bot has admin role

boreal ravine
#

Bot doesnt have permission to do what you want it to do

boreal osprey
#

does the bot have manage roles perms

boreal osprey
#

FUCK9DEFMKJBRASEBFHUJASBGFASIUGBASIKEHGASWRE

boreal ravine
#

Learn to read the errors

#

In embed.description: This field is required
smh

boreal osprey
#

im blind as fuck

boreal ravine
#

@slate swan did you try the command on yourself?

slate swan
#

yeah

#

its not working

boreal ravine
#

thats the problem

slate swan
#

wait no

boreal ravine
#

it can't add things to you because of role hiearchy

slate swan
#

i used my alt

boreal ravine
#

you sure?

boreal ravine
# slate swan

maybe it's because the muted role is above the bots role

slate swan
#

yep

slate swan
#

just now tried it myself

dapper cobalt
#

There's a 't' missing.

boreal osprey
boreal ravine
boreal ravine
#

mhm

slate swan
#

lemme try it

#

lol yeah

#

how do i change it

boreal ravine
#

just click one of the roles and you should be able to change the order of it

slate swan
#

aight

#

@boreal ravine it worked thank you

heavy folio
boreal ravine
#

you entered the wrong username/password maybe

heavy folio
#

oh

#

guessed it alr

slate swan
#

ohhh

#

Its like the social pyramid their just more powerful lmao

#

makes sense

#

Yeah

#

thanks

full valley
#

anyone know any good open-source discord bot ranking systems in python

slate swan
valid galleon
#

so im using discord-components to make a calculator wit buttons. all the interaction stuff is inside a while loop, but when i click any of the buttons, it says "interaction failed" any idea why this happens?

opaque plinth
#

uh

slate swan
#

Show code

upbeat otter
# slate swan Show the code
async def kick(ctx, member: discord.Member, reason):
  if not ctx.message.author.guild_permissions.kick_members:
      await ctx.reply("You do not have the permission to kick members!")
      return
  await member.kick(reason=reason)
  try:
    with open("configure.json", "r") as f:
      data = json.load(f)
    channel = data[str(ctx.guild.id)]["mod"]
    embed = discord.Embed(title=f"Kicked {member.name}", description=f"Kicked by: {ctx.message.author.mention}", color=ctx.message.author.color)
    embed.set_image(url=member.avatar_url)
    modChannel = client.get_channel(int(channel))
    await modChannel.send(content=None, embed=embed)
  except:
    await ctx.reply(f"Kicked :white_check_mark:")

stark hearth
#

how can i make a command pass even if the text is in caps like !HELP?

slate swan
upbeat otter
slate swan
#

Are you sure the bot's top role is above the member's top role

upbeat otter
#

other bots*

slate swan
#

Why not

upbeat otter
#

even when the bot doesnt have any role

upbeat otter
#

yes, they have no roles, my bot has two roles one with admin perms and other with moderator too

slate swan
#

What's the exact error you get

upbeat otter
patent lark
#

your bot and the bot you are trying to kick likely has the same role, or you are missing permissions to run the command?

#

the bot you are trying to kick should be on a lower role than your bot.

patent lark
upbeat otter
patent lark
#

using bot.get_channel() tries to grab the channel from the bots cache. if it returns NoneType, likely the channel either doesnt exist, or is it not loaded in the bots cache

#

make sure you pass the correct channel ID

upbeat otter
#

I do pass the correct ID, but it just says None

patent lark
#

or maybe try await ctx.guild.chunk() before you get the channel

upbeat otter
#

ohh

patent lark
#

!d discord.Guild.chunk

unkempt canyonBOT
#

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

Requests all members that belong to this guild. In order to use this, [`Intents.members()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") must be enabled.

This is a websocket operation and can be slow.

New in version 1.5.
upbeat otter
#

thanxx

patent lark
#

actually no.

#

this wouldnt help, because you are trying to get a channel, not users

#

its 1 AM and my brain is fried. forgive me

maiden fable
patent lark
#

oh hi hunter

maiden fable
#

Hi

patent lark
#

long time no see.

maiden fable
#

Same

slate swan
#
import discord

client = discord.Client()

@client.event
async def on_ready():
  print('We have logged in as {0.user}
  '.format(client))
slate swan
#

im missng something

slate swan
patent lark
slate swan
#

^

patent lark
#

use commands.Bot()

#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
slate swan
#

oh

maiden fable
slate swan
#

ty

patent lark
#

it would.

maiden fable
#

She ain't making commands, is she?

slate swan
maiden fable
#

My bad

slate swan
#

dont watch yt tutorials , read the docs instead

maiden fable
#

!d discord

patent lark
#

not yet. i assume this is a mistake that can be fixed early on

unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

slate swan
slate swan
maiden fable
#

Yea use that

slate swan
maiden fable
#

?

slate swan
#

kk

maiden fable
#

Bruh why does pip bugs out while installing with git ;-;

slate swan
#

i literally wasted my 1 week watching yt videos

slate swan
patent lark
# slate swan

this person is using replit
this person is using discord.Client()
i dont think they are a good reliability.
(assuming its from yt)

patent lark
#

xd

slate swan
#

replit suggests it automatically when u create a python repl lol

maiden fable
#

True

#

It is good marketing 🤣

patent lark
#

youtube bot tutorials are not the way to go

#

copying their code is even worse

maiden fable
#

Lucas is the best, change my mind

slate swan
#

so i should scratch what i alrdy did & do this

maiden fable
slate swan
maiden fable
#

Imagine making API Calls for getting the bans

slate swan
patent lark
#
  1. you learn nothing from copying code.
  2. most of the yt tutorials are outdated and poorly written code
slate swan
#

3.not reliable

slate swan
maiden fable
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

Oof

#

i hate reading documents

slate swan
#

but okk

maiden fable
#

I learnt with examples from github

slate swan
slate swan
patent lark
#

you need

basic understanding of python syntax
basic understanding of Object Oriented Programming
basic understanding of Asynchronous Programming.
@slate swan

slate swan
maiden fable
maiden fable
#

Lemme see

#

What did u click

slate swan
#

Learn

maiden fable
#

Click on the blue link in the pic

slate swan
maiden fable
#

seems like your bot is also reacting to the message 🤣

slate swan
#

this is so confusing 8194_Blob_Cry_Animated

maiden fable
#

It was a joke but okay

slate swan
#

@maiden fable should i code on python or replit

maiden fable
maiden fable
slate swan
#

yea ik but

maiden fable
#

You mean local or replit?

slate swan
#

idk 😭

slate swan
maiden fable
#

Oof I guess just calm down and think from where you should start

#

BTW don't look into classes all of a sudden

#

You will want to leave Python

slate swan
maiden fable
#

Start with functions

slate swan
maiden fable
#

Yea it is

slate swan
#

Replit is just eh questionable

#

and often glitches with imports

maiden fable
#

I prefer coding in VSCode (locally)

maiden fable
slate swan
#

And non reliable

#

hell yeah , the lines stay underlined for a long time

#

Vs code is better in my opinion

maiden fable
#

same

slate swan
#

vsc is pog

#

Yes

#

Vsc is just simple but beautiful in a way

maiden fable
slate swan
#

i tried sublime too , its lightweight but didnt really liked it

slate swan
#

We were just appreciating how good vsc is😔

#

im eating tacos & salad rn

maiden fable
#

cool

slate swan
slate swan
#

im still dumb

maiden fable
#

Bruh

#

Start with if statements and loops

#

Very Very Very Basic

slate swan
#

I recommend starting with:
functions
Loops
Classes
Dictionarys
Other stuff

maiden fable
#

Not Classes For A Beginner Pleaseeeeeeeeeee

pliant gulch
#

visual studio code is simple??? kekw

slate swan
slate swan
pliant gulch
#

Coming from neovim that is laughable

slate swan
pliant gulch
#

As a beginner you should probably learn primitive types then flow control

slate swan
patent surge
#

How do you check one has voted for my bot or not in top.gg

#

?

#

??

#

???

#

????

#

?????

sullen shoal
#

why are you doing just except:

#

please dont do that, just doing that causes it to catch anything like even BaseException

hexed spoke
#

I need help with an issue

slate swan
#

Sounds great

boreal ravine
hexed spoke
#

@boreal ravine

#

idk what's wrong with it

boreal ravine
hexed spoke
#

I know that it is the issue

boreal ravine
#

you can't use something from a module without importing it first

gritty tendon
#

Where did I go wrong?

hexed spoke
boreal ravine
hexed spoke
boreal ravine
#

wtf

#

u import a module

#

how u usually import it

dusk pumice
#

How can I get role id?

valid perch
slate swan
valid perch
dusk pumice
gritty tendon
valid perch
#

.id ..

slate swan
dusk pumice
#

Not working

valid perch
#

Neither is my mind reading today. Define 'not working'

dusk pumice
#

\😦

valid perch
#

Or don't, not my issue

boreal ravine
dusk pumice
#

🙂

boreal ravine
#

Bruh ok

valid galleon
#

currently not on my main pc so cant show code atm

#

but theres no error in the terminal. only in discord

#

ig its something related to ratelimit

slate swan
#

No, you would get a ratelimit error and not 'Interaction failed'

#

Without code we can't help you

valid galleon
#

alright i'll send the code when im on my other pc

valid galleon
#

just in the discord app

boreal ravine
valid galleon
boreal ravine
valid galleon
#

i dont think so

#

no errors are being blocked

boreal ravine
#

Do you have an error handler?

normal jasper
#

hi

#

can someone help me ?

#

i want to make a discord bot that shows online players in a minecraft server in its status

#

hello ?

boreal ravine
valid galleon
boreal ravine
valid galleon
valid galleon
unkempt canyonBOT
#

A library to query Minecraft Servers for their status and capabilities.

valid galleon
#

but i'll check if the handler for another command is interfering with this one

normal jasper
boreal ravine
normal jasper
normal jasper
boreal ravine
valid galleon
boreal ravine
#

Ah ok then

valid galleon
valid galleon
#

not sure about other hosting sites though

slate swan
#

Just use mcstatus

valid galleon
#

if it does, you can use it

boreal ravine
#

What winrar said

slate swan
#

A VPS doesn't have an API if you don't make it by yourself.....

#

Do you even know what a VPS is?

normal jasper
slate swan
#

Just use mcstatus, you can get the statistics and information about any server based on the IP of the server

valid galleon
valid galleon
slate swan
#

Plugin??????

slate swan
#

It's a library for Python....

valid galleon
#

how does it connect to the server though?

slate swan
#

It doesn't.....................

valid galleon
slate swan
#

omfg

valid galleon
#

actually nvm i just read the docs