#discord-bots

1 messages · Page 483 of 1

drifting arrow
#

He needs

#
def setup(client):
    client.add_cog(Moderation(client))
``` at the end.
lyric moat
#

yeah like invites it show user invites

drifting arrow
#

It's what I am working on

#

I think mine will be different tho.

drifting arrow
lyric moat
#

i did

drifting arrow
#

kgood

valid perch
#

There trying to import invites. The class is called Invites, with a capital. Im aware they can have capitals lol, I wrote that code lol (Minus customization)

#

🤷‍♂️

drifting arrow
#

I really want to finish my invites code

#

been bugging me for like a day.

#

honestly might just use yours

valid perch
#

The direct answer to this error is it should be from cogs.invites import Invites
But you shouldn't be importing it, it should be loaded via load_extension

lyric moat
#

same thing

drifting arrow
#

oh

#

you use DiscordUtils

#

I'm not using that

valid perch
lyric moat
#

so i have this code lemme show

#

but like i want it to work if i try ;;invites @user

valid perch
#

Fetch it from the database within your command

stark hearth
#

also i figured that i need an async on for submission in subreddit.top

lyric moat
#

how can i make it have 2 user id here?

        if ctx.author.id == 737448363418452019:
little thicket
#

what is the problem

lyric moat
slate swan
lofty mulch
#

I want it

little thicket
#

solarized dark

keen comet
#

You don’t, discord.py does not have slash command support iirc 😳

slate swan
#

Dpy doesn't have slashes

#

And since it's discontinued I'd recommended using disnake (a really good fork of dpy that has all the newest features)

drifting arrow
#

isnt there a library that lets you make slash commands?

#

thats it

#

disnake

slate swan
#

Mhm

drifting arrow
#

someone write that down.

slate swan
#

It's by far the best fork of dpy that has the newest features and pretty easy to use

#

Sadly it's not as popular as some other forks that are behind 😔

slate nymph
#

says utils and core couldnt be found?

slate swan
#

How to create webhook with code

slate swan
unkempt canyonBOT
#

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

Creates a webhook for this channel.

Requires [`manage_webhooks`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_webhooks "discord.Permissions.manage_webhooks") permissions.

Changed in version 1.1: Added the `reason` keyword-only parameter.
slate swan
#

Thank you

#

@slate swan

clever wind
#
    for user_id in lobby1_team_a_id:
        user_ign = get_user_ign(user_id)
        user_elo = get_user_elo(user_id)
        print(user_elo)
        await member.edit(nick=f'[{user_elo}] ' + user_ign)
        
    for user_id in lobby1_team_b_id:
        user_ign = get_user_ign(user_id)
        user_elo = get_user_elo(user_id)
        await member.edit(nick=f'[{user_elo}] ' + user_ign)

the user_elo in the database and printed are all correct. but the ign doesn't change for some reason

sick talon
#

how to check if a user is in VC or not ?

#

I tried this

    voice_state = ctx.member.voice
    voice_channel = ctx.member.voice_channel.id
    if voice_state is None:
      await ctx.send("You need to be in a voice channel to run this command")

and this gave me this error

    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'member'
clever wind
#

is there a way to edit nicks with the user ids?

boreal ravine
#

!d discord.ext.commands.MemberConverter

unkempt canyonBOT
#

class discord.ext.commands.MemberConverter```
Converts to a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member").

All lookups are via the local guild. If in a DM context, then the lookup is done by the global cache.

The lookup strategy is as follows (in order)...
heavy radish
#
@bot.command(description="The unpin Command", aliases=['UNPIN','Unpin'])
@commands.has_permissions(manage_channels=True)
async def unpin(ctx, message: discord.Message):
    await message.unpin()
``` Whats the problem
unkempt canyonBOT
#

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

Unpins the message.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to do this in a non-private channel context.
lone aurora
#
@client.event
async def on_message_edit(message_before, message_after):
    channel_id1 = client.get_channel(888763536447250532)
    embed = discord.Embed(
    colour = 0
    )
    embed.set_footer(text='By oSeatch#6969')
    embed.set_author(name= "Edited", icon_url=message_before.author.avatar_url)
    embed.add_field(name='Before Edit:', value=message_before.content, inline=False)
    embed.add_field(name='After Edit:', value=message_after.content, inline=True)
    embed.add_field(name='Edited By:', value=message_before.author, inline=False)
    embed.add_field(name= 'In Channel', value='#what do i put here', inline=False)
    await channel_id1.send(embed=embed)``` anyone?
sick talon
slate nymph
#

Says ..utils and ..core could not be resolved

boreal ravine
heavy radish
#

where

clever wind
#

like await convert(id)?

boreal ravine
lone aurora
#

client = commands.Bot(case_insensitive=True)

#

like this

heavy radish
#

ahh

boreal ravine
sick talon
lone aurora
boreal ravine
#

hm

lone aurora
#

i tried message_before.author.get_channel

#

but it didnt work so now im here lmao

heavy radish
#

Hello @boreal ravine (Hope you're fine with me pinging you), I have an idea which I need some help for...
"How would i add permissions to a user for a channel so say there is channel-a and user-a has permission for it but user-b does not, i want to have the bot toggle the "read messages" and "send messages" permission toggle for user-b on channel-a"

lone aurora
#

toggle perms?

#

u can make an if statement

heavy radish
#

So in simple words, I need to make a command where if they do !t people who are not added to the channel (which i will do) cant see

#

Yes, how tho?

lone aurora
#

hm

#

you could make an if statement

#

1 sec

heavy radish
#

Ok

lone aurora
#

i have a similar code written

heavy radish
#

F

boreal ravine
#

I guess you could change the channel perms for user b

heavy radish
#

Hm

#

user b is alot of people

supple thorn
lone aurora
#

if (not ctx.author.guild_permissions.read_messages)or whatever the permission is

heavy radish
#

Skev

supple thorn
#

Currently in class so cant really help much with your problem

heavy radish
#

Ik

lone aurora
#

verified = discord.utils.get(guild.roles, name="NameOfYourRole")
await member.add_roles(verified)

heavy radish
#

i was just sayin. Relax

#

oh so its a role?

lone aurora
#

yes

heavy radish
#

hm

lone aurora
#

you can't add permissions per user

heavy radish
#

ahh

#

yes yes

lone aurora
#

@heavy radish you just need it as a verification yes?

heavy radish
#

So lets me put this together

lone aurora
#

best to have the role named something like Member

stark bobcat
#

how do i mention a channel

#

cause #channelname does not work

heavy radish
#

oh no. This is private

stark bobcat
#

can i do it with name?

lone aurora
lone aurora
heavy radish
#

So like its a public channel and the channel owner can toggle

heavy radish
#

Sure

stark bobcat
heavy radish
#

I'll DM u ig

stark bobcat
#

oh

#

oof

#

hmm

#

one min

ocean leaf
#

any mistake i have made? it is showing that i started playing but it is not actually playing

#

yes

#

no

#

discordUtils

#

can anyone help

stark bobcat
#

one min getting the code

stark bobcat
#

@tawdry perch py await ctx.guild.create_category('Mailer') await ctx.guild.create_text_channel('Mailer-logs')
i am doing like this is it possible to get the id of the text channel Mailer-logs

slate swan
#

Pretty sure creating a new channel returns the channel object

#

So just store it in a variable

stark bobcat
#

can i do smth like a = await ctx.guild.create_text_channel('Mailer-logs') and do bot.get_id(a)

slate swan
#

^

stark bobcat
#

oh

#

ohh

#

ok thanks let me try that

slate swan
#

!d discord.TextChannel.mention

unkempt canyonBOT
slate swan
#

Yes it does

stark bobcat
#

thanks

ocean leaf
#

it don't provide any error

#

i thought but no idea

#

!source

unkempt canyonBOT
stark bobcat
#

@tawdry perch how do i get category id

ocean leaf
#

hmmm

heavy radish
#

Need help with the toggle command. To restrict a role from viewing. Someone help?

stark bobcat
#

ok

ocean leaf
#

so what can i really do

#

no one is helping

little ether
heavy radish
#

F

fading harness
#

help me! i want the bot to stream a video from youtube, the youtube video should appear as the video of the bot, what should i do

unkempt canyonBOT
#

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

fading harness
#

it break the rules?

little ether
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)
fading harness
#

ok

#

so if we stream the youtube video, it break the rules

fading harness
stark bobcat
supple thorn
fading harness
#

and i want the bot to kick people and ban people and unban people and tempban people what should i do

supple thorn
#

or shit

fading harness
stark bobcat
#

ok lemma try

supple thorn
boreal ravine
#

u cant stream anything related to youtube

#

u can but u cant with a bot

supple thorn
#

i was told you can stream non copyrighted shit

boreal ravine
#

you can

#

but a bot cant

unkempt canyonBOT
#

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

Bans a user from the guild.

The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
fading harness
#

and...

#

how can i set the bot's status? like "offline, do not disturb, online, idle"?

reef shell
#

!d discord.Status

unkempt canyonBOT
#

class discord.Status```
Specifies a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member") ‘s status.
slate swan
#

!d discord.ext.commands.Bot.activity

reef shell
#

!d discord.ext.commands.Bot.change_presence

unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
boreal ravine
unkempt canyonBOT
#

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

Kicks a user from the guild.

The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

You must have the [`kick_members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.kick_members "discord.Permissions.kick_members") permission to do this.
heavy radish
#

Ahh yes. Sorry, didn't even notice the ping

#

How?

unkempt canyonBOT
#

class discord.PermissionOverwrite(**kwargs)```
A type that is used to represent a channel specific permission.

Unlike a regular [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions"), the default value of a permission is equivalent to `None` and not `False`. Setting a value to `False` is **explicitly** denying that permission, while setting a value to `True` is **explicitly** allowing that permission.

The values supported by this are the same as [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions") with the added possibility of it being set to `None`.

`x == y` Checks if two overwrites are equal.

`x != y` Checks if two overwrites are not equal.

`iter(x)` Returns an iterator of `(perm, value)` pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.
heavy radish
#

I've spent 1hr on the website with the docs

#

So

#

Lets say Role = 12345678909876543

#

Hm

#

Let me play with this a bit

#

Hm

#

whats a role object?

#

oh

#

How do I add that?

#

let me show current code

#
@bot.command()
async def toggle(ctx):
  Role = ctx.guild.get_role(889398480181800961)
  perms = discord.PermissionOverwrite(channel_view=False)
  await ctx.channel.set_permissions(Role, overwrites=perms)
#

Seems wrong

#

No

#

I think its a spelling mistake

#

looking through it rn

#

Works, now I need to make an else or elif for it

slate swan
#
  @commands.Cog.listener()
  async def on_message(self, message):
      if message.channel.name=="Cross-server-chat": 
       m = message.content 
       n = message.channel.create_webhook(name=message.author.name,avatar=message.author.avatar_url)
       await n.send(content=m)```
What is error in code
grizzled star
#

!d discord mute

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.

meager chasm
#

also the avatar kwarg takes bytes, not a str

slate swan
#

Intention is correct no intention error what are others

dreamy sluice
#

Anyone know why my discord bot isn't connecting to the vc the person is in?
Code:

@bot.command()
async def vc(self, ctx):
    channel = ctx.author.voice.channel
    if channel:
        print("Joining vc")
        player = self.get_player(ctx)
        embed = discord.Embed(text="Joining VC, gimme a second...")
        await ctx.send(embed=embed)
        await player.connect(ctx, channel)
    else:
        print("Not gonna join vc")
        embed = discord.Embed(text="Oops! You're not connected to a voice channel.")
        await ctx.send(embed=embed)
meager chasm
slate swan
#

Ok

slate swan
#

Other

dreamy sluice
#

I shouldn't?

boreal ravine
#

If its in a cog then yes add self

dreamy sluice
#

Ah, I am not using a cog.

boreal ravine
#

If it isnt then remove then self

dreamy sluice
#

Mkay

#

Well, what should I do to make it join then?

#

This was the older code I used, and it also doesn't seem to do anything.

@bot.command()
async def vc(ctx):
    channel = ctx.author.voice.channel
    if channel:
        print("Joining vc")
        embed = discord.Embed(text="Joining VC, gimme a second...")
        await ctx.send(embed=embed)
        await channel.connect()
    else:
        print("Not gonna join vc")
        embed = discord.Embed(text="Oops! You're not connected to a voice channel.")
        await ctx.send(embed=embed)
#

@boreal ravine

meager chasm
dreamy sluice
#

Nope

#

It just did the print statement

meager chasm
#

which one?

dreamy sluice
#

"Joining vc"

#

It didn't execute anything after the print statement

meager chasm
#

there is no text kwarg

dreamy sluice
#

ah

#

Oh my bad

#

it's title

#

Oki, it also sends the embed.

#

However, it still doesn't join the vc

#

@meager chasm

supple thorn
dreamy sluice
keen comet
dreamy sluice
#

For some reason, it doesn't execute the else statement

dreamy sluice
#

Yep one second

#
@bot.command()
async def vc(ctx):
    channel = ctx.author.voice.channel
    if not ctx.author.voice.channel:
        channel = ""
    print(channel)
    if channel:
        print("Joining vc")
        embed = discord.Embed(title="Joining VC, gimme a second...")
        await ctx.send(embed=embed)
        await channel.connect()
    else:
        print("Not gonna join vc")
        embed = discord.Embed(title="Oops! You're not connected to a voice channel.")
        await ctx.send(embed=embed)
#

It doesn't execute the else statement if I am not in a vc, and it also doesn't join the vc in the voice channel if I am there.

#

hmmm

#

@tawdry perch How do you connect a bot to a vc?

#

O_o

meager chasm
dreamy sluice
#

Hmmm,

dreamy sluice
river walrus
#

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

meager chasm
dreamy sluice
#

Mkay

#

I might have not turned it on

#

; -;

meager chasm
#

you can also check them in your code if you want

dreamy sluice
#

I gave it administrator though,

#

Hmm

#

Lemme make an error handling system

heavy radish
#

Heyy

meager chasm
dreamy sluice
#

yea

heavy radish
#

I think I have done a madness. Can you see my code and get disappointed?

heavy radish
#

Lol

#
@bot.command()
async def t(ctx):
  name = ctx.guild.get_role(889398480181800961)
  hide = discord.PermissionOverwrite(view_channel=False)
  show = discord.PermissionOverwrite(view_channel=True)

  if ctx.perms == hide:
    await ctx.channel.set_permissions(name, overwrite=show)
    await ctx.send("We're now IDK!! Be Respectful")
  
  else:
    hide.enabled = not hide.enabled
    await ctx.channel.set_permissions(name, overwite=hide)
    await ctx.send("We're now IDK!! Be Respectful")
#

It is what it is

dreamy sluice
#

And I can't understand a thing cause I am dumb.

heavy radish
#

GG

dreamy sluice
#

Rip, I got this when I run it while I am not in a vc

heavy radish
#

Me?

dreamy sluice
#

.... And this when I try to connect it to a vc

heavy radish
#

Can you check my code?

dreamy sluice
#

@heavy radish He is talking about my code I think

heavy radish
#

I guess

meager chasm
dreamy sluice
#

What's that?

unkempt canyonBOT
#

Python binding to the Networking and Cryptography (NaCl) library

meager chasm
#

you don't need PyNaCl to connect to VCs

dreamy sluice
heavy radish
#

the whole thing

#

the if ctx.perms is wrong

dreamy sluice
#
@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
        embed = discord.Embed(title="HUMAN! YOUR SPEED IS STAGGERING FOR ME! PLEASE WAIT FOR {:.2f} SECONDS!".format(error.retry_after)).set_image(url='http://pa1.narvii.com/6425/fd9a8be05b97ccb2a8ad3402d016039bfcc8531d_00.gif')
        await ctx.send(embed=embed)
    else:
        embed = discord.Embed(title=str(error))
        await ctx.send(embed=embed)

(oh and, I also use it for a cooldown system so yea)

heavy radish
#

attribute problem

meager chasm
dreamy sluice
#

What does raise do?

heavy radish
#

Pardon?

meager chasm
dreamy sluice
#

:0

heavy radish
#

yes

dreamy sluice
#

Would you mind if you could explain more? @meager chasm

heavy radish
#

One way works. But the other way doesnt

#

Okay

slate nymph
#

utils and core could not be resolved?

meager chasm
dreamy sluice
#

Ah

meager chasm
dreamy sluice
#

so it tries to tell you to resolve the error?

meager chasm
#

it just causes an error normally

dreamy sluice
#

ah

#

Holy flip it joined the vc-

#

Now I only have 1 issue, it doesn't send the message I want it to send when the user is not in a vc.

heavy radish
#

Whats the last one? Please use booleans false and true?

#

Hm

#

Ok ok

#

So can I change True for something else?

#

Like !t public or something like that

#

hm

#

ok, will do now

dreamy sluice
#
Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "d:\Discord Bots\UnderBot Rework\main.py", line 38, in vc
    channel = ctx.author.voice.channel
AttributeError: 'NoneType' object has no attribute 'channel'

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

Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "d:\Discord Bots\UnderBot Rework\main.py", line 23, in on_command_error
    raise error
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel
#

It was the channel = ctx.author.voice.channel line

little ether
dreamy sluice
#

That returned None ig

dreamy sluice
#

I thought of it but I put NoneType and I got an error

heavy radish
#

Works only one way

#

So its becomes true

#

not false

#

yes

#

true works. False doesnt

little ether
heavy radish
#

hm

dreamy sluice
#

Oki I am too rusty with python ;-;

heavy radish
#

Yes

#

the perms stayed on True. I checked settings inside channel

#

so it stayed as Yes. Ticked to the right side for yes (Inside channel perms)

#

ok

little ether
unkempt canyonBOT
#

Identity vs. Equality

Should I be using is or ==?

To check if two objects are equal, use the equality operator (==).

x = 5
if x == 5:
    print("x equals 5")
if x == 3:
    print("x equals 3")
# Prints 'x equals 5'

To check if two objects are actually the same thing in memory, use the identity comparison operator (is).

list_1 = [1, 2, 3]
list_2 = [1, 2, 3]
if list_1 is [1, 2, 3]:
    print("list_1 is list_2")
reference_to_list_1 = list_1
if list_1 is reference_to_list_1:
    print("list_1 is reference_to_list_1")
# Prints 'list_1 is reference_to_list_1'
dreamy sluice
#

Oki the error is still there

#
Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "d:\Discord Bots\UnderBot Rework\main.py", line 38, in vc
    if ctx.author.voice.channel is None:
AttributeError: 'NoneType' object has no attribute 'channel'

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

Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "d:\Discord Bots\UnderBot Rework\main.py", line 23, in on_command_error
    raise error
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel'
heavy radish
#

no permission called overwrite

little ether
floral crypt
#

Is there something like on_voice_client_stop or something?

heavy radish
#

huh

#

ohh

#

Ahh, works. Thank You!! @tawdry perch

dreamy sluice
#

Something like this?

@bot.command()
async def vc(ctx):
    if ctx.author.voice.channel is None:
        return
    else:
        channel = ctx.author.voice.channel
    if channel:
        print("Joining vc")
        embed = discord.Embed(title="Joining VC, gimme a second...")
        await ctx.send(embed=embed)
        await channel.connect()
    if channel==None:
        print("Not gonna join vc")  
        embed = discord.Embed(title="Oops! You're not connected to a voice channel.")
        await ctx.send(embed=embed)
heavy radish
#

Now I need to figure out a way to get rid of true and false

#

but thats a job for another day

#

Thank You!!

steep estuary
#

Can i use a python file for storing variables?

dreamy sluice
steep estuary
#

:/

#

ok ty :/

sick talon
#

My code

@client.event
async def on_raw_reaction_add(payload):
  msgID = 889401033091067965
  guild = client.get_guild(payload.guild_id)
  member = guild.get_member(payload.user_id)
  voice_state = member.voice
  if voice_state is not None:
    if payload.emoji.name == "📷" and payload.message_id == msgID:
      await member.move_to(channel=889394157595033611)
  else:
    print("test didnt worked")

Error

    voice_state = member.voice
AttributeError: 'NoneType' object has no attribute 'voice'```

So, i am trying to make something where if the user reacts with a emoji he will be dragged to a voice channel
steep estuary
#

Pls help i want to store my variables in other py file likeni have 2 files - main.py and store.py so i want all variables in store.py and i want that main.py can change the var values

wicked gulch
little ether
wicked gulch
#
@bot.listen(hikari.DMMessageCreateEvent)
async def on_dm_message(event):
	if event.message.author.is_bot:
		return
		
	guild = await bot.rest.fetch_guild(466101319699136512)
	channel = await bot.rest.fetch_channel(815150323986595882)
	
	embed = (
		hikari.Embed(
			color = bot.colors["blue"],
			description = event.message.content
		)
		.set_author(name = event.message.author, icon = event.message.author.avatar_url)
		.set_footer(text = "This was handled using hikari.")
	)
	await bot.rest.create_message(channel, embed) 

Am I doing something wrong? It keeps saying JSON is not serializable at the line where create_message is awaited.

sick talon
#

@river walrus

stark bobcat
#
@commands.command()
    async def setup(self, ctx):
        a = await ctx.guild.create_category('Mailer')
        await ctx.guild.create_text_channel('Mailer-logs',category=a.id)```
why doesn't this work
#

@tawdry perch

#

ok

sick talon
stark bobcat
#

yipee works tysm

#

yep thanks

river walrus
slate swan
#

Did anyone here tried cross server chat with webhooks

reef shell
#

This is the reason why discord will make message intent privileged🗿

slate swan
#

Means

jade jolt
#

is how i made it cross-server

#

and works between games

stark bobcat
#

how do i check if a channel exists

reef shell
#

Means your bot won't be whitelisted for message intents unless you actually need it

jade jolt
reef shell
#

Yep

stark bobcat
#

so if there's a specific channel in the server called mailer logs

jade jolt
#

so if its not big, no need to worry

stark bobcat
#

it should break

jade jolt
#

^

teal furnace
#

im new

jade jolt
#

welcome

reef shell
#

Yep

teal furnace
#

what can i do here

slate swan
#

I am creating a bot i need to do something like this

jade jolt
#

but why

teal furnace
#

bc they r his reqirements

#

ye

#

good point

#

but what can i do in the server

#

???

#

hello anyone there

heavy radish
#

Do we have template for Channel name change using BOT?

#

Hm

boreal ravine
#

!d discord.TextChannel

unkempt canyonBOT
#

class discord.TextChannel```
Represents a Discord guild text channel.

x == y Checks if two channels are equal.

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

hash(x) Returns the channel’s hash.

str(x) Returns the channel’s name.
heavy radish
#

Like change the channel name using a command

boreal ravine
#

you can just fetch the channel id

heavy radish
#

!changename CEO

boreal ravine
#

and change it

heavy radish
#

Hm

#

ctx.message.channel.edit anything to do with this?

boreal ravine
heavy radish
#

Hm....but the channel is not set

#

Like whichever channel i do the command in. I want to change that channel name

boreal ravine
#

Then do channel = ctx.channel

heavy radish
#

Ok, one sec. Let me grab my charger... Lol

boreal ravine
#

Do ctx.channel lol

heavy radish
#

Alrighty, Lets do some guess and check

dreamy sluice
heavy radish
#

So I did this and it worked like twice

#

then it just gave up

#
@bot.command()
async def cname(ctx, arg):
  channel = ctx.channel
  await channel.edit(name=arg)
boreal ravine
#

Dunno how it just gave it lmfao

slate swan
#

How can my bot edit its own message?

heavy radish
magic frigate
slate swan
magic frigate
#

says it no? define the message you want to edit

boreal ravine
jade jolt
#
msg=await ctx.send("123")
await msg.edit(content="321")
bitter depot
heavy radish
boreal ravine
heavy radish
#

Ahhh

heavy radish
bitter depot
slate swan
heavy radish
#

Okay then

bitter depot
#

Because it's gonna be ratelimited

boreal ravine
#

make a variable

bitter depot
heavy radish
#

Hm okay then

bitter depot
#

But yeah, you 99% don't want a command to change channel names

heavy radish
#

Will try

jade jolt
bitter depot
#

People can do it manually if they really need to change it

slate nymph
#

so i had to make a purge command in which the bot will display the number of messages purged and will delete its own message after 5 seconds

bitter depot
jade jolt
#

i did wym

bitter depot
jade jolt
#

literally says content

bitter depot
#

You need to do edit(content="new content")

jade jolt
#

read it again

bitter depot
#

You just edited it lol

jade jolt
#

before u sent that :)

#

i noticed it

bitter depot
#

With the content= it'll work

jade jolt
#

before you sent ur message saying it wont work 😐

#

not long before, maybe a few seconds

sick talon
#

how to check if a user has joined a specific VC ?
I wanted to make a command which can be used when the user joins a specific VC only

hasty iron
#

check if Member.voice is None

slate nymph
#

so i had to make a purge command in which the bot will display the number of messages purged and will delete its own message after 5 seconds

hasty iron
#

!d discord.Member.voice

unkempt canyonBOT
#

property voice: Optional[discord.member.VoiceState]```
Returns the member’s current voice state.
jade jolt
sick talon
hasty iron
#

compare that to the channel you want

sick talon
slate swan
#

If my bots reboots daily can I still use @tasks.loop(hours=24) for a task to happen everyday?
Or is there a easier way?

heavy radish
#

Heyy, I've got a question. In a command like !add @someone Can i restrict that someone to be a BOT account??

#

So pinging a user wont do anything...

jade jolt
#
if member.bot:
    # do stuff
hasty iron
#

yes check if Member.bot

#

or User.bot

jade jolt
#

or whatever you defined the member as ^

hasty iron
grim oar
#

I don't think that will help

slate swan
#

The server reboots so I dont know if that would help

grim oar
#

You will have to check when the task happened last time by storing the time

slate swan
#

Ah thinkcat I want to avoid databases since I dont really do well with them

hasty iron
#

you dont really need a db for this

grim oar
#

ye

hasty iron
#

a json file could do it

#

since you’d be storing 1 or 2 things

grim oar
#

Actually, wait, sounds like you use heroku?

jade jolt
#

text file

slate swan
heavy radish
#

Heyy, is this the correct variable? I want to ping someone after the command

async def add(ctx, Member: discord.Member):
jade jolt
grim oar
grim oar
#

Use an external db

jade jolt
#

Heroku is horrendous for hosting discord bots

heavy radish
slate swan
# jade jolt why?

Its a server specific bot and since I have extra hours it works perfectly

hasty iron
unkempt canyonBOT
#
**PEP 8 - Style Guide for Python Code**
Status

Active

Created

05-Jul-2001

Type

Process

grim oar
slate swan
slate swan
grim oar
#

Yeah

jade jolt
hasty iron
heavy radish
#

ok

hasty iron
#

for the argument

heavy radish
#

Is that right?

grim oar
#

Don't name it add too e

heavy radish
#

So it requires them to ping someone afterwards

jade jolt
grim oar
#

I think you can't see the line cut thingie, i for a second thought add was built in then remembered it's from operator.

jade jolt
#

if it was a builtin, just call it directly

grim oar
#

What

jade jolt
fading harness
#

i want to set status of my discord bot what should i do

grim oar
#

shadowing is a bad idea u know

#

😩

jade jolt
jade jolt
grim oar
hasty iron
#

i don’t think thats "esoteric"

jade jolt
#

not exactly.

#

its used a lot though

grim oar
jade jolt
#

yes i know.

#

i got it the first time 😐

grim oar
#

Your "probably won't work" Made me think you didn't get the point

heavy island
#

how can i send an attached image through an announcement command?
for an example, -announce <text here> <assume that an image has been attached> (I want the attached image to be sent by the bot in the desired channel)

jade jolt
grim oar
#

yeah

boreal ravine
#
@client.event
async def on_message_delete(message):
  channel = client.get_channel(880030618275156001)
  embed = discord.Embed(title='Message Deleted')
  embed.set_author(name=message.author)
  embed.add_field(name='Channel', value=f'{message.channel.mention} (`{message.channel.id}`)')
  embed.add_field(name='Author', value=f'{message.author.mention} (`{message.author.id})`')
  embed.add_field(name="Message", value=f"{message.content}")
  embed.timestamp = message.created_at
  await channel.send(embed=embed)
``` Wot?
hasty iron
#

message.content is empty

slate swan
#

bot is not dming people whu get banned

#

help

hasty iron
#

you’re using both fstrings and concatenation in the same string

jade jolt
#

who does that

#

bro his name 😂

boreal ravine
grim oar
unkempt canyonBOT
#

@grim oar :white_check_mark: Your eval job has completed with return code 0.

5
grim oar
jade jolt
#

check #bot-commands

slate swan
#

Yes

#

Dpy has buttons and select menus

#

Not slashes

#

There is no new version

#

Dpy isn't maintained since last month

sick talon
#

how to check the limit of a VC ??

slate swan
#

A fork of dpy

hasty iron
#

a shit fork

slate swan
hasty iron
#

it is shit

slate swan
#

U haven't even bothered checking it

hasty iron
#

lol?

sick talon
hasty iron
#

how do you know

slate swan
#

What about it is shit

hasty iron
hasty iron
grim oar
#

!d discord.VoiceChannel.user_limit

unkempt canyonBOT
slate swan
grim oar
#

This probably?

sick talon
hasty iron
#

having an opinion is stupid

slate swan
#

Don't label all the forks as shit bc u tried an actual shit fork

hasty iron
#

thanks

grim oar
#

blanket is smort

#

😩

slate swan
#

🤦‍♂️

grim oar
#

smarter than me and u combined

hasty iron
#

i look at the source code

#

and judge based on that

slate swan
#

Disnake > any other fork you've looked over

jade jolt
#

no

slate swan
#

Yes

hasty iron
#

ok just to make you happy ill look at it again

slate swan
#

Yw

grim oar
#

nice

cloud dawn
#

disnake has some good programmers.

jade jolt
slate swan
#

It's the best fork for dpy

jade jolt
#

i know bad code when i see it, coming from someone that makes bad code

slate swan
#

That's not the official dpy docs

slate swan
jade jolt
#

i looked 2 days ago 😐

slate swan
#

Alr

slate swan
#

Yw

cloud dawn
#

At this point just make your own api wrapper or use a compiled language.

slate swan
#

^

jade jolt
#

ok bet

#

ill be back in a week

hasty iron
#

        try:
            user = await self.fetch_user(user_id)
        except Exception:
``` seriously? a bare except?
#

yeah good fork

jade jolt
#

my point

cloud dawn
hasty iron
#

wow

grim oar
#

There's Exception to shut up flake8

jade jolt
#

couldve narrowed it down

cloud dawn
#

!d discord.ext.commands.Bot.get_channel

hasty iron
unkempt canyonBOT
hasty iron
#

every exception inherits from Exception

jade jolt
#

yep

slate swan
hasty iron
#

another double bare except

#

that doesn’t make it not shit

grim oar
hasty iron
#

makes it a positional only argument

grim oar
#

Hmm

cloud dawn
slate swan
#

I hope it will

cloud dawn
#

Looking at how the pypi website is maintained i'd suggest otherwise.

slate swan
#

unban command not working whai

slate swan
boreal ravine
#

also you can just use commands.has_permissions(permission=True)

slate swan
boreal ravine
#

I said "are u sure"

strong kettle
#

How do I check the permissions of someone in on_message?

heavy radish
#
@bot.command()
async def add(ctx, member: discord.Member):
  add = discord.PermissionOverwrite(view_channel=True)
  member = discord.Member
  channel = ctx.channel
  await ctx.channel.set_permission(member, overwrite=add)
  await ctx.send("Welcome {member}, you are now officially appart of {channel}!!" )
#

Can you check whats wrong?

boreal ravine
#

whats the error

heavy radish
boreal ravine
heavy radish
boreal ravine
#

did u mention a member though

boreal ravine
heavy radish
#

Wait

#

More error

boreal ravine
#

you can just do ctx.author.mention for the bot to mention the author of who did the command

boreal ravine
trail breach
#

Have channel ID's been removed?

heavy radish
heavy radish
trail breach
#

if i right click i cant see the option

heavy radish
#

Have u got developers mode on?

trail breach
#

hmm lemme check

#

idts

heavy radish
#

It works for me

boreal ravine
heavy radish
#

Ok

trail breach
heavy radish
#

Its a tick in settings

#

Not sure where it is

trail breach
#

this on the devloper/applications portal

unkempt canyonBOT
#

@slate swan, looks like you posted a Discord webhook URL. Therefore, your message has been removed, and your webhook has been deleted. You can re-create it if you wish to. If you believe this was a mistake, please let us know.

hoary yacht
#

what about python

heavy radish
#

Did I do it right?

boreal ravine
#

same goes for the channels

heavy radish
boreal ravine
hoary yacht
#

i'm still using discord 1.8.0 something idkl

oak warren
#

how do i reset cooldown of a slash command ( discord py interactions )

hoary yacht
#

i havent dont discor bot coding in 3 years, i just got into it recentalty

boreal ravine
trail breach
heavy radish
#

Let me check

#

One sec

trail breach
#

myb i hv to get the devloper's license

oak warren
#

^^

trail breach
#

ty

heavy radish
#

Nice

hoary yacht
#

sure

#

purge like delete

#

literally await channel.purge(amount=amount)

boreal ravine
#

add @commands.has_permissions(administrator=True) below @client.command

hoary yacht
#
@commands.has_permissions(manage_messages=True)
@bot.command()
async def clear(ctx, amount=5):
    # by default the bot would delete 5 messages

    if amount > 100:
        await ctx.send(f":x: Can delete a maximum of 100 messages, you are passing the limit")
    else:
        await ctx.channel.purge(limit=amount+1)
        message = await ctx.send(f":white_check_mark: Deleted {amount} messages")
        await asyncio.sleep(5)
        await message.delete()
#

this is without cogs yeah

cloud dawn
jade jolt
#

why are you spoonfeeding :l

#

iirc mee6 can do a lot more

heavy radish
#
@bot.command()
async def add(ctx, member: discord.Member):
  add = discord.PermissionOverwrite(view_channel=True)
  channel = ctx.channel
  await ctx.channel.set_permissions(member, overwrite=add)
  await ctx.send("Welcome {ctx.author.name}, you are now officially appart of {ctx.channel.name}!!" )

So I'm trying to add the members name and the channel which he was added to. Why isnt it not working?

cloud dawn
#

It works.

jade jolt
#

yeah

boreal ravine
#

So theres a reason why dyno can't delete messages over 14 days old?

jade jolt
#

i can do 1000 messages just fine

cloud dawn
#

bulk deletion is allowed

jade jolt
boreal ravine
#

hmm

#

Yes

#

Theres event an event for it

cloud dawn
#

it's not a for loop of .delete()

jade jolt
#

if any

cloud dawn
#

purge

#

!d discord.TextChannel.purge

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...
heavy radish
jade jolt
#

could just clone the channel and delete the old one if its messages are too old

heavy radish
#

the {channel} & {name} doesnt work

cloud dawn
#

kwarg default is 100 lol

jade jolt
#

how did u do it

cloud dawn
slate swan
#
client = commands.Bot(command_prefix="sbs!")
@client.command()
async def on_message(message):
 mess = message.content 
 print(mess)
 web = await mesage.channel.create_webhook(balasai,avatar=None,reason=None)
 print(web.url)
client.run(os.getenv('Token'))```
cloud dawn
#

Maby restarting too quick or something else.

slate swan
#

Can anyone check code

heavy radish
#

Anyone....

boreal ravine
#

not rlly lel

heavy radish
#

Can anyone else investigate and help Kayle?

jade jolt
#

whats the check?

cloud dawn
heavy radish
#

Huh, its to add someone

cloud dawn
#

oh lol

heavy radish
#

Like the channel will be public and we would add them then go private

#

Lol

cloud dawn
#

thought user was a kwarg nvm

heavy radish
#

Hm

heavy folio
#

im tryna make a choose command, so im using args.split but i want the bot to choose something random. so i need a for loop so the bot can only choose number of args that are split so that i can do args[{number}] but im not so sure how to do it could someone help

jade jolt
#

uhh

#

!e

import random
print(random.choice([1,2,3,4,5]))
unkempt canyonBOT
#

@jade jolt :white_check_mark: Your eval job has completed with return code 0.

2
heavy radish
#
@bot.command()
async def add(ctx, member: discord.Member):
  add = discord.PermissionOverwrite(view_channel=True)
  channel = ctx.channel
  await ctx.channel.set_permissions(member, overwrite=add)
  await ctx.send("Welcome {ctx.author.name}, you are now officially appart of {ctx.channel.name}!!" )
```  Here it is, again
jade jolt
#

any error?

#

^ use an f-string btw

heavy radish
#

Nope, i need to fix the {ctx.author..} & {ctx,channel...}

#

It doesnt work

high flame
#

bruh

heavy folio
jade jolt
#

use an f-string

cloud dawn
#

lmao

high flame
#

fstring

heavy radish
#

ok

cloud dawn
heavy folio
heavy folio
#

okay sure

cloud dawn
#

if message.author.bot:
return

#

it is

high flame
#

but its different

boreal ravine
high flame
heavy radish
high flame
#

this checks if the author is your bot

boreal ravine
cloud dawn
#

!f-string

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

heavy radish
#

AttributeError: 'Context' object has no attribute 'member'

boreal ravine
#

then use member.name

high flame
#

ctx.member is not a thing

#

ctx.author you mean?

boreal ravine
#

hes tryna make it say the member mentioned hence member.name

#

u cant

boreal ravine
heavy radish
high flame
#

member.mention

boreal ravine
#

and member.mention

heavy radish
#

That was mention for kayle but yea. thanks

slate swan
#

kk

heavy radish
#

no hate

mental brook
#

confused where it's!!

whole shoal
#

Nothing wasnt able to locate

heavy radish
#

Heyy, view_channel=True is they can see and view_channel=False they can't. How about Idle. like in the middle? Do i do view_channel=Idle

#

idk, like i don't want to complete remove them from the channel

#

As in like they can see if they have the role

#

Or how do I just remove them from the added permissions??

#

GG

agile goblet
#

just None

heavy radish
#

ahh

slate swan
#

?

sick talon
#

how to get the number of people connected in a VC ?

heavy radish
unkempt canyonBOT
#

property latency: float```
Measures latency between a HEARTBEAT and a HEARTBEAT\_ACK in seconds.

This could be referred to as the Discord WebSocket protocol latency.
misty stream
#

hello im using slashcommand an i run into some errors when using a command

#

The error
An exception has occurred while executing command scheduleon:
Traceback (most recent call last):
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\client.py", line 1352, in invoke_command
await func.invoke(ctx, **args)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\model.py", line 210, in invoke
return await self.func(*args, **kwargs)
File "C:\Users\Robin310\Desktop\Shoutout Network\Timeslot\bot.py", line 816, in scheduleon
roles = [role.name for role in ctx.message.author.roles]
AttributeError: 'NoneType' object has no attribute 'author'

#
@slash.slash(name='scheduleon', description="will enable the schedule", guild_ids=[878637134737735691,859871231335858247])
async def scheduleon(ctx:SlashContext):
    roles = [role.name for role in ctx.message.author.roles]
    if ADMIN_ROLE in roles:
        global schedule
        schedule = True
        await ctx.send('enabled schedule')
#

the command
how do i fix this ?

hasty iron
#

ctx.message is None for some reason

river walrus
#

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

hasty iron
#

your library probably fucked up something

#

and you probably shouldn’t use it cuz it’s shit

misty stream
#

but with slash command you can see all the commands if you do /

#

isnt there a way to make it work ?

slate swan
#

use dislash

misty stream
#

where can i find a doc about it ?

#

cause idk how to set up dislash Xd

hasty iron
#

have you tried googling it

misty stream
#

yeah

hasty iron
#

sure

misty stream
#

i end up at a github

hasty iron
#

so you end up at the github and just give up?

misty stream
#

no

hasty iron
#

that’s it, there is nothing more to see?

misty stream
#

i get some wierd pages that says dislash 3

#

i letterly started python last week im sorry

cloud dawn
#

Based on this code i can say that the code is constructed a bit weird anyways

misty stream
#

yeah sorry it works tho Xd

#

cause idk what the correct way of doing it is

#

so i just use the template of what works

clear comet
#

!d discord.ext.commands.ColourConverter

unkempt canyonBOT
#

class discord.ext.commands.ColourConverter(*args, **kwargs)```
Converts to a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour").

Changed in version 1.5: Add an alias named ColorConverter

The following formats are accepted...
boreal ravine
#

huh that exists

trail breach
#
@client.event
async def on_message(message):
    username = str(message.author).split('#')[0]
    user_message = str(message.content).lower()
    message_list = user_message.split
    for i in range(0,len(HELLO)):
        if username != client.user:
            if  HELLO[i] in user_message :
                general_channel = client.get_channel(GENERAL)
                await general_channel.send(f'Hello {username}')
                return 
``` the bot ends up replying to itself any solutions??
lusty swallow
cloud dawn
#

if message.author.bot: return

lusty swallow
slate swan
#

So I have a txt file I want to read the top line from the file and send it to a channel everyday, I have the loop etc setup just wondering how I would read the line from the file and delete it so that the next day it reads the next line, I have initialized the file already

trail breach
lusty swallow
clear comet
#

Can anyone help me how to use color converter in embeds please

slate swan
lusty swallow
#

or are you talking about the loop?

trail breach
slate swan
lusty swallow
slate swan
#

No- smh_im_done I actually dont know

trail breach
lusty swallow
slate swan
#

yep

trail breach
#

@lusty swallow my ide shows bot is not defined

lusty swallow
# slate swan yep

the just do

with open('file.txt', 'r') as data:
    x = data.readlines()
    pick = x.pop(0)
with open('file.txt', 'w') as data:
    data.write(x)
``` or something
plucky agate
#

I have a doubt,That my bot doesn't work properly and talks back to me and also is evil,I cannot change the settings
I want to make it like the other bots like Wick bot and Mee6
Also:I did create this bot with a website called www.autobotcreator.com and i need to change it

lusty swallow
misty stream
#

so i am now using dislash

@inter_client.slash_command(name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=[878637134737735691,859871231335858247])
async def clear(inter, amount: int):
    if amount == -1:
       await ctx.channel.purge(limit=500)
       await ctx.send("cleared everything")
       sleep(2)
       await ctx.channel.purge(limit=1)
    else:
       await ctx.channel.purge(limit=amount)
       await ctx.send(f"cleared {amount} messages")
       sleep(2)
       await ctx.channel.purge(limit=1)

it now gives the same error again

#

Ignoring exception in on_socket_response
Traceback (most recent call last):
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1229, in _on_socket_response
await self._process_interaction(payload["d"])
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1387, in _process_interaction
await self._on_slash_command(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1287, in _on_slash_command
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1282, in _on_slash_command
await app_command.invoke(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 216, in invoke
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 212, in invoke
await self._maybe_cog_call(self._cog, interaction, interaction.data)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 37, in _maybe_cog_call
return await self(inter, **params)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\core.py", line 72, in call
return await self.func(*args, **kwargs)
TypeError: clear() missing 1 required positional argument: 'amount'

slate swan
lusty swallow
misty stream
#

i did the ctx

#

i changed it to what it says

#

inter

lusty swallow
trail breach
plucky agate
#

I have a doubt,That my bot doesn't work properly and talks back to me and also is evil,I cannot change the settings
I want to make it like the other bots like Wick bot and Mee6
Also:I did create this bot with a website called www.autobotcreator.com and i need to change it

slate swan
#

Hm, Would I just be able to read the lines specifically? Eg, Read line 1 on day one, read line 2 on day 2 etc

lusty swallow
plucky agate
trail breach
#

client. user refers to bot?

plucky agate
unkempt canyonBOT
#

property user: Optional[discord.user.ClientUser]```
Represents the connected client. `None` if not logged in.
lusty swallow
#

ooh

lusty swallow
plucky agate
#

1min

harsh ledge
#

does any dpy fork have full slash command support for cogs?

harsh ledge
trail breach
#
    for i in range(0,len(HELLO)):
        if username == client.user:
            if  HELLO[i] in user_message :
                general_channel = client.get_channel(GENERAL)
                await general_channel.send(f'Hello {username}')
                return ``` pls check this once something wrong regarding the if statement differentiating b/w the user andd the bot
lusty swallow
trail breach
#
@client.event
async def on_message(message):
    username = str(message.author).split('#')[0]
    user_message = str(message.content).lower()
    message_list = user_message.split
    for i in range(0,len(HELLO)):
        if username == client.user:
            if  HELLO[i] in user_message :
                general_channel = client.get_channel(GENERAL)
                await general_channel.send(f'Hello {username}')
                return 
                ```
harsh ledge
boreal ravine
clear comet
#

Anyone help me

little ether
harsh ledge
plucky agate
trail breach
#

client.user refers to??

plucky agate
#

These are the Uto commands

hasty iron
plucky agate
#

Auto*

lusty swallow
hasty iron
#

!d discord.Client.user

unkempt canyonBOT
#

property user: Optional[discord.user.ClientUser]```
Represents the connected client. `None` if not logged in.
plucky agate
trail breach
hasty iron
cloud dawn
lusty swallow
hasty iron
#

hm

harsh ledge
plucky agate
lusty swallow
cloud dawn
hasty iron
#

lol wtf

trail breach
# hasty iron ye
@client.event
async def on_message(message):
    username = str(message.author).split('#')[0]
    user_message = str(message.content).lower()
    message_list = user_message.split
    for i in range(0,len(HELLO)):
        if username != client.user:
            if  HELLO[i] in user_message :
                general_channel = client.get_channel(GENERAL)
                await general_channel.send(f'Hello {username}')
                return ``` here the bot starts talking to itself
hasty iron
lusty swallow
little ether
misty stream
#

i still get this error
Ignoring exception in on_socket_response
Traceback (most recent call last):
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1229, in _on_socket_response
await self._process_interaction(payload["d"])
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1387, in _process_interaction
await self._on_slash_command(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1287, in _on_slash_command
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1282, in _on_slash_command
await app_command.invoke(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 216, in invoke
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 212, in invoke
await self._maybe_cog_call(self._cog, interaction, interaction.data)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 37, in _maybe_cog_call
return await self(inter, **params)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\core.py", line 72, in call
return await self.func(*args, **kwargs)
TypeError: clear() missing 1 required positional argument: 'amount'

#

with this code ```py
@slash.command(name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=test_guilds)
async def clear(inter, amount):
if amount == -1:
await inter.channel.purge(limit=500)
await inter.send("cleared everything")
sleep(2)
await inter.channel.purge(limit=1)
else:
await inter.channel.purge(limit=amount)
await inter.send(f"cleared {amount} messages")
sleep(2)
await inter.channel.purge(limit=1)

hasty iron
misty stream
#

i have tried amount: int

hasty iron
#

actually, use sphinx properly*

little ether
slate swan
#

can someone help fix this code?

#
    @commands.Cog.listener()
    async def on_voice_state_update(self, member, before, after):
      if before.channel is None and after.channel is not None:
        if after.channel.id == 886331304944214077:
            for guild in self.client.guilds:
                channel2 = guild.create_voice_channel(name='📞 Support')
                await member.move_to(channel2)
boreal ravine
#

wahts the error

lusty swallow
misty stream
#

the last slash library gave a description and a args this 1 doesnt

lusty swallow
trail breach
hasty iron
lusty swallow
# boreal ravine Not making a vc? Why though

i meant not create vc for every voice_state_update on all server.
That will create it on every server the bot is in.

it will probably go in a loop too since the bot is moving the user, it will probably also trigger another voice_state_update which will call the function agin

misty stream
#

can someone help em out ?

#

this code ```py
@slash.command(name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=test_guilds)
async def clear(inter, amount:int):
if amount == -1:
await inter.channel.purge(limit=500)
await inter.send("cleared everything")
sleep(2)
await inter.channel.purge(limit=1)
else:
await inter.channel.purge(limit=amount)
await inter.send(f"cleared {amount} messages")
sleep(2)
await inter.channel.purge(limit=1)

#

gives this error

lusty swallow
#

what's the libs used?

#

let me read the docs

#

@misty stream

misty stream
#
Traceback (most recent call last):
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1229, in _on_socket_response
    await self._process_interaction(payload["d"])
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1387, in _process_interaction
    await self._on_slash_command(inter)
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1287, in _on_slash_command
    raise err
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1282, in _on_slash_command
    await app_command.invoke(inter)
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 216, in invoke
    raise err
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 212, in invoke
    await self._maybe_cog_call(self._cog, interaction, interaction.data)
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 37, in _maybe_cog_call
    return await self(inter, **params)
  File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\core.py", line 72, in __call__
    return await self.func(*args, **kwargs)
TypeError: clear() missing 1 required positional argument: 'amount'
misty stream
#

those 2 i read and used

#

they use the same things tho

lusty swallow
#

did you give it the right arguements when calling?

misty stream
#

i did /clear clicked the command and did 10

#

so /clear 10

#

but this library doesnt show the args like it used to

#

this is what it did

#

this is what it now does

cloud dawn
# misty stream this code ```py @slash.command(name='clear', description="the bot will remove th...
@slash.command(name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=test_guilds)
async def clear(inter, amount: int = 500):
    if amount <= 0:
       amount = 500
       await inter.send("cleared everything")
    else:
       if amount > 1000:
          amount = 1000
       await inter.send(f"cleared {amount} messages")
     await inter.channel.purge(limit=amount)
     await asyncio.sleep(2)
     await inter.channel.purge(limit=1)
lusty swallow
slate swan
#

how would one convert a message object into a role object? The message will only be 1 argument which will be the tagged role. I am a little stuck now aha

cloud dawn
#

You are using the python IDE to code your bot..?

slate swan
#

oof

misty stream
#

i started using python last week 😂 idk all the tools yet sorry

lusty swallow
#
@slash.command(
    name='clear',
    description="the bot will remove the set amount of messages (max 100)",
    guild_ids=test_guilds,
    options=[
        Option("amount", "Enter the amount", OptionType.INTEGER)
    ]
)
async def clear(inter, amount:int):
    if amount == -1:
       await inter.channel.purge(limit=500)
       await inter.send("cleared everything")
       sleep(2)
       await inter.channel.purge(limit=1)
    else:
       await inter.channel.purge(limit=amount)
       await inter.send(f"cleared {amount} messages")
       sleep(2)
       await inter.channel.purge(limit=1)
``` @misty stream try this lol
#

not sure if it would work tho

misty stream
#

it works !!

lusty swallow
#

dislash bad. jk

maiden fable
misty stream
#

dislash is complicated tho Xd

misty stream
#

now i need to add py @slash.command( name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=test_guilds, options=[ Option("amount", "Enter the amount", OptionType.INTEGER) ] ) async def clear(inter, amount:int):
to the other commands and edit it all Xd

lusty swallow
maiden fable
misty stream
reef shell
#

O

maiden fable
unkempt canyonBOT
misty stream
#

ooh

stiff helm
#

anyone know of code to make it so that I send a message in a discord server channel every hour to beat my friend in the Mee6 money game

maiden fable
#

Self botting no no

spring flax
#

Do not ask for help on that here.

#

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

cloud dawn
#

you could make a 1hr timer in python then go to the channel and then type the message.

unkempt canyonBOT
#

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

cloud dawn
#

That is tos friendly version.

boreal ravine
#

jkjk

#

lmfao

cloud dawn
#

a t i m e r

misty stream
#

wow @lusty swallow i have a question

@slash.command(
    name='makechannel',
    description="the bot create a text and voice channel for the member that executes this command",
    guild_ids=test_guilds, options=[
        Option("create", "Enter the Channel Name", OptionType.INTEGER),
        Option("delete", "Enter the Channel Name", OptionType.INTEGER)
    ]
)
async def makechannel(inter, channelname):
    guild = ctx.guild
    member = ctx.author
    name = 'Custom Channels'
    category = discord.utils.get(ctx.guild.categories, name=name)
    overwrites = {
        guild.default_role: discord.PermissionOverwrite(read_messages=False),
        member: discord.PermissionOverwrite(manage_channels=True , read_messages=True),
    }
    channel = await guild.create_text_channel(channelname, overwrites=overwrites, category=category)
    channel = await guild.create_voice_channel(channelname, overwrites=overwrites, category=category)
    await ctx.channel.purge(limit=1)

if i create more options how would i assign those to an other async def or is that not possible ?

boreal ravine
#

Q: anyone know of code to make it so that I send a message in a discord server channel every hour to beat my friend in the Mee6 money game
A: 1. Make a timer for 1 hour in google. 2. Make a timer for 1 hour IRL.

misty stream
#

how would i do that ?

boreal ravine
misty stream
#

true but this looks way better

#

cause you get like a option menu Xd

cloud dawn