#discord-bots

1 messages · Page 18 of 1

hardy urchin
#

a code block

#

thank you, that's cool, i am first use it.

#

a code block

silk fulcrum
#

!d discord.app_commands.AppCommand.options

unkempt canyonBOT
silk fulcrum
#

takes list of Argument

unkempt canyonBOT
slate swan
#

ah

#

guys how make edit last send message of the bot

#

look bot send "hi"

#

i want edit "hi"

silk fulcrum
#

!d discord.Message.edit

unkempt canyonBOT
#

await edit(*, content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
slate swan
#

!!!

#

@silk fulcrum he want's to edit the last message his bot sent

#

ye

#

👍 Clap

silk fulcrum
#
if msg.user.id == my_id:
    self.last_msg = msg```
slate swan
#

o

#

what this do

#

cmon master can't you do some better psuedocode than that!

#

he doing his best

silk fulcrum
#

im lafy

slate swan
#

E

slate swan
#

o it set msg to last message of bot

#

right???

silk fulcrum
#

right

slate swan
#

but the id???

#

i put it????

silk fulcrum
slate swan
#

🤯

#

ye then my_id == 98393383883

#

right or i so dumb

silk fulcrum
slate swan
#

o

#

i will just use it

silk fulcrum
#

im lazy to explain further

#

NO

slate swan
#

it effetion

#

Why it coool

silk fulcrum
#

it is not even python code

slate swan
#

it's not valid as-is

silk fulcrum
#

syntax error

slate swan
#

it take id then check if id is the bot the send

#

Do you know basic python?

#

So any one make it no errors :( gun TES_flushed_eyes

slate swan
#

yestarday*

#

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

silk fulcrum
slate swan
#

Docs of python is trash

#

I don't think you should jump into bots after learning for one day

slate swan
slate swan
slate swan
#

want try the game :)

#

dm :)

#

What?

#

No don't DM me

#

I make a game by the bot

#

by python

#

in 2 days

silk fulcrum
# unkempt canyon

when someone here sent me this, as beginner I pressed Beginner on the left panel and then didn't know what to do

slate swan
#

without know anything in python

fresh iron
slate swan
fresh iron
#

wym how has that never happened to you before

slate swan
silk fulcrum
slate swan
slate swan
silk fulcrum
slate swan
slate swan
dusky pine
silk fulcrum
#

well probably it won't say 103

#

and probably it won't appear cus that's not an error

#

but who cares

#

2.0

slate swan
#

@slate swan you like the bot :)

vocal snow
#

pip install git+https://github.com/Rapptz/discord.py

slate swan
#

it's good :)

#

@silk fulcrum can you rate my bot :)

slate swan
#

if you want lol

silk fulcrum
slate swan
silk fulcrum
#

2.0 is still in beta

slate swan
#

@silk fulcrum Don't do it bro he's gonna put you in timeout like me

#

he was mean to me

#

No y9

silk fulcrum
#

but he said hell give nitro

slate swan
#

was keep spam

#

He was keep spam

#

NO

#

and error the bot

#

sorry bro that's not my fault

#

and i was neeed restart all the bot to fix it

slate swan
#

what it should do

#

It will errord dummy

#

I don't know

#

o

#

whoa don't call me that word

#

what word?

#

does dummy word is bad?

#

sus

#

can you rate it without nitro

#

i want gift it to my gf

#

:(

hardy urchin
#

I am a python new user, how can i user python to build discord-bot.

vale wing
#

User is not a verb is the issue

silk fulcrum
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.

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
#

LOL 😭

slate swan
vale wing
#

Resources won't help you to rickroll someone with base64

slate swan
#

LOL

slate swan
#

done

silk fulcrum
hardy urchin
slate swan
#

I wanna make my own API wrapper but I'm too lazy to learn websockets

silk fulcrum
vale wing
#

Yesterday I was experimenting in #bot-commands and here's my creation (this is the last offtopic message here by me for today I promise) py import base64;[print(chr(int(base64.urlsafe_b64decode(s+"="))>>69),end="") for s in 'NDYwNDMwNzMyMDc5NzkwNDA4MzM1MzY=NTk2MTk4NzY4NDYyMjkyNzA4MjI5MTI=Njk2NTQ5MDU2MjIzMjcyNjY5MDIwMTY=NTk2MTk4NzY4NDYyMjkyNzA4MjI5MTI=NjcyOTM3MjIzODA4OTI0NDQyOTUxNjg=MTg4ODk0NjU5MzE0Nzg1ODA4NTQ3ODQ=NjA4MDA0Njg0NjY5NDY2ODIxMjYzMzY=NjU1MjI4MzQ5NDk4MTYzMjczNDAwMzI=NjQ5MzI1MzkxMzk0NTc2MjE2ODgzMjA=NjQ5MzI1MzkxMzk0NTc2MjE2ODgzMjA=NTcyNTg2OTM2MDQ3OTQ0NDgyMTYwNjQ=MTg4ODk0NjU5MzE0Nzg1ODA4NTQ3ODQ=NjA4MDA0Njg0NjY5NDY2ODIxMjYzMzY=NjE5ODEwNjAwODc2NjQwOTM0Mjk3NjA=Njk2NTQ5MDU2MjIzMjcyNjY5MDIwMTY=NTk2MTk4NzY4NDYyMjkyNzA4MjI5MTI=MTg4ODk0NjU5MzE0Nzg1ODA4NTQ3ODQ=NzE0MjU3OTMwNTM0MDMzODM4NTcxNTI=NjU1MjI4MzQ5NDk4MTYzMjczNDAwMzI=NjkwNjQ2MDk4MTE5Njg1NjEyNTAzMDQ=MTg4ODk0NjU5MzE0Nzg1ODA4NTQ3ODQ=NjkwNjQ2MDk4MTE5Njg1NjEyNTAzMDQ=NjYxMTMxMzA3NjAxNzUwMzI5OTE3NDQ='.split("=") if len(s)>0]

slate swan
slate swan
silk fulcrum
#

lmao okay

vale wing
slate swan
#

bored java is such a pain

vale wing
#

at least I managed to make it connect to ws and send identity

#

It could even send heartbeat

slate swan
#

I made a rest client but nothing more than that

silk fulcrum
#

try creating minecraft server on ubuntu 18.04, I promise you it will be a lot fun :lemao: 💀

slate swan
#

which is probably the easiest part

silk fulcrum
#

maybe you forgot * 100

vale wing
#

Idk I once tried doing that and from what I remember it's not hard at all

#

Just my VPS with 1gb couldn't handle it lmao

silk fulcrum
#

maybe that's cus of my region :lmaop:

#

bruh i miss my nitro so much

vale wing
#

My region is Russia and that's like hardest region to survive for a programmer rn

silk fulcrum
#

are u seriously from russia?

vale wing
#

Yes

silk fulcrum
#

!ot these memes are going too far

unkempt canyonBOT
vale wing
#

Yeah

hardy urchin
#

As a new python user, where should i learn python?

slate swan
vale wing
#

What I meant was we're just disconnected from most of services cause they just decline our cards

vale wing
#

They have quite many courses especially about python

silk fulcrum
#

oh yeah that site, i remember how I was solving every task there in 0.27ms

hardy urchin
vale wing
hardy urchin
slate swan
#

e

silk fulcrum
#

code? or full traceback?

slate swan
#

you used ['something'] on a list

#

what's example ( i mean the data type of example )? and what are you trying to archive?

silk fulcrum
#

dict*

#

Oh wait now I see

#

it should be {ranking['data'][0]['currenttierpatched']}

#

since ranking['data'] is a list

placid skiff
#

you are using the dict as a 2 dimensional dict, something like this:
my_dict = {'data': ['currenttierpatched': "platinum 1"],}

silk fulcrum
#

it's a requests.get

#

formatted with .json

placid skiff
#

I see

#

uhm yeah in data essentially you have a list of dicts so is as master said

silk fulcrum
#

haven't noticed those little []

placid skiff
#

it's the first index of the list

#

you have a dict which stores a list which stores another dict

silk fulcrum
#

absolutely

placid skiff
#

if you want to iterate through that list it will be something like:
for elements in ranking['data']: #yourstuff

#

well it's a dict so elements is fine

silk fulcrum
#

that's a dict me dumb

#

yeah

placid skiff
silk fulcrum
#

homie :uwu:

vale wing
#

So I want to do a system that would automatically create issues on github if the bot faces an exception and now I want to make the exceptions that are caught in on_error uniquely identifiable

silk fulcrum
#

i think I help here a lot is cus this is the only place I talk to people this summer

vale wing
#

I mean they aren't really getting caught

placid skiff
vale wing
#

But I can use sys.exc_info() and get the data I need

vale wing
#

I was thinking about something like

placid skiff
#

btw you can even use something like this id(object) and it will return an unique ID of that object

vale wing
#

!e py import sys try: raise KeyError() except Exception as e: t, v, tb = sys.exc_info() print(f"{hash(t)}-{hash(v)}")

unkempt canyonBOT
#

@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

8776030874708-8776030293518
placid skiff
#

that's fair too ig

vale wing
#

Hash would be better ig

#

As it should be the same ig?

placid skiff
#

i don't really now, i will try it on my powershell

#

Mhh nope i have a different result

vale wing
#

!e py import sys for i in range(30): try: raise KeyError() except Exception as e: t, v, tb = sys.exc_info() print(f"{hash(t)}-{hash(v)}")

unkempt canyonBOT
#

@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 8744021622356-8744021041678
002 | 8744021622356-8744021041684
003 | 8744021622356-8744021041678
004 | 8744021622356-8744021041684
005 | 8744021622356-8744021041678
006 | 8744021622356-8744021041684
007 | 8744021622356-8744021041678
008 | 8744021622356-8744021041684
009 | 8744021622356-8744021041678
010 | 8744021622356-8744021041684
011 | 8744021622356-8744021041678
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/asezejivik.txt?noredirect

vale wing
#

Ok it doesn't get preserved between the runs

placid skiff
#

it change for every exception

vale wing
#

Ah even for every exception

#

Yeah notice how it's like half ending with 78 and other 84 wtf

#

Ok I got another idea

placid skiff
#

This function returns a tuple of three values that give information about the exception that is currently being handled. The information returned is specific both to the current thread and to the current stack frame. If the current stack frame is not handling an exception, the information is taken from the calling stack frame, or its caller, and so on until a stack frame is found that is handling an exception. Here, “handling an exception” is defined as “executing an except clause.” For any stack frame, only information about the exception being currently handled is accessible.

vale wing
#

!e py import sys for i in range(30): try: raise KeyError() except Exception as e: t, v, tb = sys.exc_info() print(hash(t.__name__))

unkempt canyonBOT
#

@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | -8528757346533736868
002 | -8528757346533736868
003 | -8528757346533736868
004 | -8528757346533736868
005 | -8528757346533736868
006 | -8528757346533736868
007 | -8528757346533736868
008 | -8528757346533736868
009 | -8528757346533736868
010 | -8528757346533736868
011 | -8528757346533736868
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/woxuhasuqo.txt?noredirect

vale wing
#

String hashes should always be the same right?

#

But just identifying the exceptions by class name hash isn't useful

placid skiff
#

I think that it is the current thread, so it is something related to the actual execution ig

#

or maybe the actual except block

vale wing
#

Ok I got another beautiful idea I will just use inspect to get all exception classes then sort them by name and give each a number

placid skiff
vale wing
#

wtf did I smoke

placid skiff
#

well actually that is the best solution i think

#

!e

print(id(KeyError))
unkempt canyonBOT
#

@placid skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.

139668861134144
placid skiff
#

Mh neither this will work ig

#

it's machine related or something like that

vale wing
#

!e py import inspect import sys exceptions = inspect.getmembers(__builtins__, lambda x: inspect.isclass(x) and issubclass(x, BaseException)) exceptions.sort(key=lambda x: x[0]) ordered_exceptions = {e[0]: i for i, e in enumerate(exceptions)} print(ordered_exceptions)

unkempt canyonBOT
#

@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

{'ArithmeticError': 0, 'AssertionError': 1, 'AttributeError': 2, 'BaseException': 3, 'BaseExceptionGroup': 4, 'BlockingIOError': 5, 'BrokenPipeError': 6, 'BufferError': 7, 'BytesWarning': 8, 'ChildProcessError': 9, 'ConnectionAbortedError': 10, 'ConnectionError': 11, 'ConnectionRefusedError': 12, 'ConnectionResetError': 13, 'DeprecationWarning': 14, 'EOFError': 15, 'EncodingWarning': 16, 'EnvironmentError': 17, 'Exception': 18, 'ExceptionGroup': 19, 'FileExistsError': 20, 'FileNotFoundError': 21, 'FloatingPointError': 22, 'FutureWarning': 23, 'GeneratorExit': 24, 'IOError': 25, 'ImportError': 26, 'ImportWarning': 27, 'IndentationError': 28, 'IndexError': 29, 'InterruptedError': 30, 'IsADirectoryError': 31, 'KeyError': 32, 'KeyboardInterrupt': 33, 'LookupError': 34, 'MemoryError': 35, 'ModuleNotFoundError': 36, 'NameError': 37, 'NotADirectoryError': 38, 'NotImplementedError': 39, 'OSError': 40, 'OverflowError': 41, 'PendingDeprecationWarning': 42, 'PermissionError': 43, 'ProcessLookupEr
... (truncated - too long)

Full output: https://paste.pythondiscord.com/idequzapal.txt?noredirect

vale wing
#

Nice

#

Tho if I create new errors it will break

vale wing
#

Actually maybe they will work

placid skiff
#

so before doing all of that you just check if the class has a subclass and if it is give and id to that too

vale wing
#

I thought id is based on location of object

#

!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`.
placid skiff
#

it is, watch

#

!e

class Uwu():
  def __init__(self):
    pass

my_uwu = Uwu()
print(id(my_uwu), id(Uwu))
unkempt canyonBOT
#

@placid skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.

140545396765776 94187746169984
glad cradle
placid skiff
#

!e

for i in range(5):
  print(id(KeyError))
#

!e

for i in range(5):
  print(id(KeyError))
vale wing
#

Now we have flooded the channel with ids lmao

placid skiff
#

Uhm nope it changes on different runs

#

that's strange, with the shell it doesn't

#

even if I rerun it

vale wing
#

So it's memory based

glad cradle
#

it's probably linked to memory addresses and more

placid skiff
#

Bruh you want to solve this shit? get the memory address lmao

#

with C or assembly

glad cradle
#

!e

import hashlib

x  = hashlib.sha256(KeyError.__name__.encode('utf-8')).hexdigest()

print(x)
unkempt canyonBOT
#

@glad cradle :white_check_mark: Your 3.11 eval job has completed with return code 0.

f0f0edf867a4213fae7f94050498c643a345fdb204e65919cc0c35116e5916e5
glad cradle
#

!e

import hashlib

x  = hashlib.sha256(KeyError.__name__.encode('utf-8')).hexdigest()

print(x)
unkempt canyonBOT
#

@glad cradle :white_check_mark: Your 3.11 eval job has completed with return code 0.

f0f0edf867a4213fae7f94050498c643a345fdb204e65919cc0c35116e5916e5
glad cradle
#

maybe this could work?

#

@vale wing

vale wing
#

Base64 could also work and yk what I will just do that

glad cradle
sweet aspen
#

I’m guessing there’s no good way to format or colour text on the mobile app?

little lava
#

Anyone knows about send respond to only specific text channel?

i google a lot and tried this code but this seems not working.

await channel.send('hello')```
crystal glen
#

Is there a way to fix this?

#
@client.command()
async def ascii(ctx, *, text: str):
    await ctx.send(pyfiglet.figlet_format(text))
sweet aspen
crystal glen
little lava
silk fulcrum
#

no quotes

crystal glen
#

!code

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.

cold sonnet
#

and time.sleep blocks your bot for a minute making you disconnect

little lava
#

ok i will try it

cold sonnet
#

import asyncio
use await asyncio.sleep()

#

instead of time

crystal glen
sweet aspen
#

is the mobile app unable to use ansi or css?

cold sonnet
slate swan
cold sonnet
#

asyncio won't

#

it's the point of asyncio

sweet aspen
crystal glen
cold sonnet
#

fix what

sweet aspen
#

Is there anyway to show one thing on noble and another on desktop?

slate swan
crystal glen
crystal glen
little lava
# crystal glen Send your code

This is simply just a EC2 server controller.
translated to slash command from normal "!" trigger

from discord.ext import commands
import asyncio
import os
import time
import boto3
# required py-cord extension by pip3 install py-cord

client = commands.Bot(command_prefix="!")
ec2 = boto3.resource("ec2", region_name="ap-northeast-1")
instance = ec2.Instance("i-0441ff1241243123")


@client.event
async def on_ready():
    print("Logged in as")
    print("client.user.name")
    print("----------------")
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Server"))

@client.slash_command(description="Server start")
async def start(ctx):
    if message.channel.id == 100461054634937:
    if InstanceStart():
        await ctx.respond(f"{ctx.user.mention} Please wait, Server is about to start...")
        time.sleep(60)
        await ctx.respond(f"{ctx.user.mention} Server has been started successfully!")
    else:
        await ctx.respond(f"{ctx.user.mention} An error occurred. Please contact administrator.")



def InstanceStart():
    try:
        instance.start()
        return True
    except:
        return False```
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.

crystal glen
#

And tell me what you want to do.

little lava
#

oops, sorry

import discord
from discord.ext import commands
import asyncio
import os
import time
import boto3
# required py-cord extension by pip3 install py-cord

client = commands.Bot(command_prefix="!")
ec2 = boto3.resource("ec2", region_name="ap-northeast-1")
instance = ec2.Instance("i-0441ff1241243123")


@client.event
async def on_ready():
    print("Logged in as")
    print("client.user.name")
    print("----------------")
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Server"))

@client.slash_command(description="Server start")
async def start(ctx):
    if message.channel.id == 100461054634937:
    if InstanceStart():
        await ctx.respond(f"{ctx.user.mention} Please wait, Server is about to start...")
        time.sleep(60)
        await ctx.respond(f"{ctx.user.mention} Server has been started successfully!")
    else:
        await ctx.respond(f"{ctx.user.mention} An error occurred. Please contact administrator.")



def InstanceStart():
    try:
        instance.start()
        return True
    except:
        return False
#

i wanna respond the text only in "10046105463493755" channel

#

with slash command enabled

crystal glen
#

You want to send the bot's message in a specified channel?

little lava
#

yes only respond in that channel

#

others are ignored

crystal glen
#
channel = client.get_channel(10046105463493755)
await channel.send(response)
#

try this

little lava
#

ok i will try this now

crystal glen
#

Oh wait

#

You mean, You only want the bot to your in that channel?

#

Bruh my bad...

little lava
#

its ok

crystal glen
#
@client.command()
async def start(ctx):
    if ctx.channel.id != 10046105463493755:
        return
    #code here
vocal snow
#

!=

little lava
#

wow this just works very smoothly!

Thank you so much!! @crystal glen and @vocal snow

crystal glen
#

You're welcome ❤️

#

How do I delete the member's message that ran the command

#

For example I do ?ping
And then it deletes my message and send the ping?

silk fulcrum
#

await ctx.message.delete

crystal glen
#
# image to ascii
@client.command()
async def ascii_image(ctx, *, image_url: str):
    # delete the author's message
    await ctx.message.delete()
    # get the image
    async with aiohttp.ClientSession() as session:
        async with session.get(image_url) as resp:
            image = await resp.read()
    # convert the image to ascii
    ascii_image = pyfiglet.figlet_format_ascii(image)
    # send the ascii image
    await ctx.send(f"{ascii_image}")

Will this work? 🥲

crystal glen
#

What link should I put

silk fulcrum
#

idk

#

of my avatar? lmao

crystal glen
crystal glen
crystal glen
silk fulcrum
#

!pypi pyfiglet

unkempt canyonBOT
crystal glen
#

Why do I think It only works for text

silk fulcrum
#

because it does?

crystal glen
#

Wdym 😢

crystal glen
silk fulcrum
#

idk

slate swan
crystal glen
#

Somone get it to work for me 😢

#

idk what library to use

sweet aspen
#

hello again. is there a way where if someone sends a message in one channel itll add it to another channel with the users id, or does it have to be via the bot?

vale wing
#

Problem with jishaku or libraries incompatibilities

silk fulcrum
#

you opened an aiohttp session somewhere and didnt close it

#

close session

#

:lemao:

vale wing
#

That session is only a warning, not the main issue ig

silk fulcrum
#

prbbly

crystal glen
#

WHAT DO YOU MEANNNNNNNNNNNNNNN

slate swan
hushed galleon
vale wing
silk fulcrum
#

i dont really get what you want

crystal glen
#
@client.command()
async def play(ctx, *, url: str):
    try:
        url = ctx.message.content.split()[1]
        voice_client = await ctx.message.author.voice.channel.connect()
        voice_clients[ctx.message.author.id] = voice_client

        loop = asyncio.get_event_loop()
        data = await loop.run_in_executor(None, lambda: yt_dl.download([url]))

        song = data["url"]
        player = discord.FFmpegPCMAudio(song, **ffmpeg_options)

        voice_client.play(player)
    except Exception as e:
        print(e)
        await ctx.send("Error: {}".format(e))

Please someone get this working for me pleaseeeeeeeeeeee

slate swan
#

Master @silk fulcrum

silk fulcrum
#

me

slate swan
silk fulcrum
crystal glen
#

you do it then

#

Or tell me how to make a music bot

#

I'm tired of it 😢

silk fulcrum
slate swan
#

Ohh fuck

crystal glen
vale wing
slate swan
sweet aspen
slate swan
#

..

#

i swear it existed

silk fulcrum
#

shku

slate swan
#

they removed the a from jishaku

silk fulcrum
#

jishkuwu

slate swan
#

ye

crystal glen
#

Please help ☝️

#

Tell me how to make a music bot

vale wing
#

What unique features does jishaku have anyway

slate swan
slate swan
vale wing
#

Lmao

slate swan
#

other things include playing music/sound from an URI etc

vale wing
#

Just make eval by yourself

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)
crystal glen
#

What about a bot using spotify?

vale wing
#

moment

vale wing
#

And if it is some sort of scraper which breaks ToS no

vocal snow
#

spotify does have an API but they don't hand over audio

crystal glen
#

I WANNA MAKE A MUSIC BOT, HOW DO I DO IT

vocal snow
#

buy the copyrights first

#

then play the music you own :D

crystal glen
#

Okay, I wanna make a sound maker bot

#

I wanna play funny sounds

#

How do I do it?

vale wing
#

First do the sound making system itself and then integrate it into a bot

crystal glen
#

?fart, The bot should join the voice and play a fart sound

vale wing
#

The first part isn't related to this channel's topic

crystal glen
#

What library should I use?

vale wing
#

Sound generation hm

#

Read some articles about sound generation first, it's not that easy ig

vocal snow
slate swan
#

do you even load the cog

vale wing
#

i mean you could just download certain files

crystal glen
#
# play a sound from a file
@client.command()
async def play(ctx, *, url: str):
    if not ctx.voice_client:
        await ctx.author.voice.channel.connect()
    await ctx.send(f"Now playing {url}")
    source = discord.FFmpegPCMAudio(url)
    ctx.voice_client.play(source)
    ctx.voice_client.source = source
robust fulcrum
#

I bored . Can anyone give me idea why type of bot should i make || i cant make rpg or game bot ||

slate swan
#

you can use soundcloud api as long as you just load the songs in cache

vale wing
#

It's very sussy

vocal snow
#

if url points to a valid audio file sure

vale wing
#

If the url is streamable I think

crystal glen
#

What should be the url?

vale wing
#

Straight link to the file

crystal glen
#

Any suggestions?

vocal snow
#

there isn't any need to manually set the source attr

robust fulcrum
vale wing
#

Nerd bot

crystal glen
vocal snow
vale wing
#

It would argue with every statement and say "um, actually" at the beginning

robust fulcrum
vocal snow
robust fulcrum
#

Hmm i need DB ig?

vale wing
#

For example if you say "sky is blue" it will reply with "um, actually, sky isn't blue 🤓"

vocal snow
robust fulcrum
#

And i need to use datetime module

vale wing
#

!pypi pendulum is better imo

unkempt canyonBOT
robust fulcrum
#

Ok

slate swan
#

jishaku is a cog...

vocal snow
robust fulcrum
crystal glen
slate swan
#

🗿 because you need to `bot.load_extension('jishaku')

#

also make sure that you uninstall discord.py and its jishaku

vocal snow
robust fulcrum
vale wing
#

Ok time to create nerd bot ig 🤓

robust fulcrum
#

What nerd

#

🤨

vocal snow
vocal snow
#

but the implementation is up to you

robust fulcrum
slate swan
vale wing
#

Alright cya

slate swan
#

yes because jishaku has the same namespace as jishkucord
and pycord and discord.py both use discord namespace

slate swan
#

remove it from your requirements.txt

robust fulcrum
#

Dite

vocal snow
#

😭 date

crystal glen
#
@client.command()
async def play(ctx, *, filename: str):
    await ctx.send(f"Playing {filename}")
    voice = get(client.voice_clients, guild=ctx.guild)
    if voice and voice.is_playing():
        voice.stop()
    voice = await ctx.author.voice.channel.connect()
    source = discord.FFmpegPCMAudio(filename)
    voice.play(source)
    await ctx.send(f"Now playing {filename}")
    await ctx.send(f"Disconnecting...")
    await voice.disconnect()
    await ctx.send(f"Disconnected")

get is not defined

robust fulcrum
#

Ok

#

That's very weird bot

crystal glen
#

and all the other libraries u used

cold sonnet
#

🤮

vocal snow
#

Even better, use guild.voice_client directly

crystal glen
# vocal snow Even better, use guild.voice_client directly
@client.command()
async def play(ctx, *, filename: str):
    await ctx.send(f"Playing {filename}")
    voice = ctx.guild.voice_client
    if voice and voice.is_playing():
        voice.stop()
    voice = await ctx.author.voice.channel.connect()
    source = discord.FFmpegPCMAudio(filename)
    voice.play(source)
slate swan
#

well the panel will do it for you ( unless they have some weird configs )
and just mention the libraries you use there

crystal glen
#

So like this?

slate swan
crystal glen
#

Bruh

crystal glen
slate swan
#

add the name of the libraries you use there

slate swan
crystal glen
#

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

#

wtf do u mean ffmpeg was not founddddddddddd

slate swan
#

py-cord

slate swan
#

all the other libraries you use

#

for example if i use aiohttp and sketch-py for a project this would be my requirements.txt ```
aiohttp
sketch-py

crystal glen
slate swan
crystal glen
# slate swan its not added to path then
@client.command()
async def slaw(ctx):
    voice = ctx.voice_client
    voice = await ctx.author.voice.channel.connect()
    voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source="D:\Desktop\Haryad Bot\s.mp3"))
#

Will this work?

#

Well it doesn't

#

But how do I make it to work

#

How do I fix this again? Make a real directory?

hardy yoke
#

why use requests and aiohttp lol
also those discord imports are mostly redundant

slate swan
#

i wanna bleach my eyes after those imports

slate swan
#

where you have you ffmpeg.exe

crystal glen
slate swan
#

you need to use / for path

#

\ => escape character

crystal glen
#
@client.command()
async def slaw(ctx):
    voice = ctx.voice_client
    voice = await ctx.author.voice.channel.connect()
    voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source="D:\Desktop\Haryad Bot\s.mp3"))
#

It connects but doesn't play the soundddddddddd

#

nvm it works now...

vale wing
#

Ah yes

crystal glen
crystal glen
slate swan
#

How to fix this?

vale wing
#

Thanks nerd bot

slate swan
vale wing
#

In 1.7 it's avatar_url

slate swan
#

how do i fix?

vale wing
#

Don't use discord_slash simply

#

Use a fork or dpy 2.0

slate swan
hardy yoke
#

discord_slash isn't needed anymore

vale wing
#

Fork like disnake or nextcord

slate swan
hardy yoke
#

every relevant python library supports slash commands now

vale wing
#

Not the kwarg name

slate swan
#

this is wut i downloaded how would i have the fixed version of this code?

from discord_components import *

from discord.ext import commands
from discord_slash.context import ComponentContext
from discord_slash import SlashContext, SlashCommand
from discord_slash.model import ButtonStyle
from discord_slash.utils.manage_components import create_button, create_actionrow, create_select, create_select_option, wait_for_component

hardy yoke
hardy yoke
vale wing
slate swan
#

i just dowloaded this file but i was getting errors

vale wing
#

I don't help people who copypaste the code without even knowing how to code

slate swan
#

bruh

hardy yoke
slate swan
vale wing
#

!d discord.Embed.set_thumbnail

slate swan
#

What is kwarg?

unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing `None` removes the thumbnail.
hardy yoke
vale wing
slate swan
#

bro help me bro please

vale wing
#

func(positional_argument, key_word_argument=10)

hardy yoke
crystal glen
#
@client.command()
async def play(ctx, filename: str):
    voice = ctx.voice_client
    voice = await ctx.author.voice.channel.connect()
    voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"))

How it disconnects from the channel after it's finished?

vale wing
#

await voice.disconnect() iirc?

slate swan
#

Still no

#

Whyyy

hardy yoke
#

use avatar_url

crystal glen
vale wing
#

Man I can just give you the correct version but you need to understand that

slate swan
vale wing
#

You can parse the function to there

#

I forgot if it can be a coro or not

crystal glen
#

Can u just spoonfeed me?

vale wing
#

Nah I am not a spoonfeeder

slate swan
hardy yoke
crystal glen
vale wing
#

!d discord.VoiceClient.play

unkempt canyonBOT
#

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

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

If an error happens while the audio player is running, the exception is caught and the audio player is then stopped. If no after callback is passed, any caught exception will be logged using the library logger.

Changed in version 2.0: Instead of writing to `sys.stderr`, the library’s logger is used.
vale wing
#

Are docs a joke for you

crystal glen
#
voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"), after=await voice.disconnect())
#

So this?

hardy yoke
vale wing
hardy yoke
#

replace avatar.url with avatar_url

you: user.avatar.url

??

vale wing
#

Also you could make a loop that would check if the vc is playing currently and disconnect if it's not

#

Because I am unsure if you can parse a coro to after

crystal glen
vale wing
#

Ok you can't

crystal glen
#

Please help me 😢

vale wing
#

!d discord.VoiceClient.is_playing then use a loop that would check for this

unkempt canyonBOT
vale wing
#

And by loop I mean @tasks.loop

crystal glen
#

Bruh this is so complicated for me

vale wing
#

!d discord.ext.tasks.loop examples are on top

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
vale wing
#

Both for cogs and non cogs just find the suitable for you

crystal glen
#

Why do I need to do all this just to disconnect after playing the sound?

vale wing
#

Because you can't parse a coroutine

vocal snow
#

VoiceClient.play has an after function

#

An after kwarg that takes a callable rather

vale wing
#

The problem is you can't parse a coroutine to there

slate swan
#

guys who can test my bot in 3 mins??

vale wing
#

You can run it with run_coroutine_threadsafe tho

crystal glen
vale wing
#

Ig that's the method

vocal snow
#

You can schedule a coro there with asyncio.create_task

vale wing
#

You still need to await it

vocal snow
#

No

vale wing
#

Tasks need to be awaited aren't they

crystal glen
#

what are you guys talking about, Again?

vale wing
#

Some async stuff don't mind

vocal snow
vale wing
#

Ok one sec

vocal snow
#

But for disconnecting a "fire and forget" would be fine

slate swan
#

aw :(

vale wing
#

Last time I used it the task just executed everything not awaitable and stopped

crystal glen
#
@client.command()
async def play(ctx, filename: str):
    voice = ctx.voice_client
    voice = await ctx.author.voice.channel.connect()
    voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"), after=await voice.disconnect())

I just need to disconnect after it finishes talking

stiff flicker
#

can som1 help me with nextcord

vale wing
maiden fable
hardy yoke
slate swan
stiff flicker
# hardy yoke just ask

i wrote down a simple code using nextcord it also has a ping command embed , so now idk why its not working it doesen't shoows any type of error it just da command doesen't works

hardy yoke
#

send code

vale wing
#

See

crystal glen
#
@client.command()
async def play(ctx, filename: str):
    voice = ctx.voice_client
    voice = await ctx.author.voice.channel.connect()
    voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"))
    while voice.is_playing():
        await asyncio.sleep(1)
    await voice.disconnect()
#

CO-PILOT DID ITTTTTTTTTT

vale wing
#

Non awaited tasks don't execute awaitable statements inside

vocal snow
#

What

hardy yoke
#

isn't while blocking?

crystal glen
#

Thank you github co-pilot

#

ilysm

vale wing
#

Tasks need to be awaited see

#

So for that you just use this

vocal snow
#

You could not await it and pass control to the event loop and it would be fine

vale wing
#

The what

#

I forgot the loop or smth

#

Ah yes sorry

#

!e ```py
import asyncio
async def stuff():
await asyncio.sleep(1)
print("Stuff")

async def main():
asyncio.run_coroutine_threadsafe(stuff(), asyncio.get_event_loop())

asyncio.run(main())```

unkempt canyonBOT
#

@vale wing :warning: Your 3.11 eval job has completed with return code 0.

[No output]
vale wing
#

Ok weird

vocal snow
#

!e ```py
import asyncio

async def f():
print(2)

async def t():
print(1)
await f()

async def main():
asyncio.create_task(t())

asyncio.run(main())

unkempt canyonBOT
#

@vocal snow :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 1
002 | 2
vale wing
#

Ah yes I am not waiting in the main that's the issue

vocal snow
#

I'm on mobile apologies for the 2 space indents

vale wing
#

And I was fricking sure that tasks need to be awaited because of me using sleep

#

Sorry man

vocal snow
#

Only God knows how asyncio works

#

And maybe andy but i cant understand him

stiff flicker
#

!e

unkempt canyonBOT
#
Missing required argument

code

#
Command Help

!eval [python_version] <code, ...>
Can also use: e

*Run Python code and get the results.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside of them.

By default your code is run on Python's 3.11 beta release, to assist with testing. If you run into issues related to this Python version, you can request the bot to use Python 3.10 by specifying the python_version arg and setting it to 3.10.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*

stiff flicker
#

!eval 3

import nextcord
from nextcord.ext import commands
from flask import Flask
from threading import Thread


bot = commands.Bot(commands_prefix = "r!")
bot.remove_command('help')


@bot.event
async def on_ready():
    print("""
____   _____  __
|  _ \ / _ \ \/ /
| |_) | | | \  / 
|  _ <| |_| /  \ 
|_| \_\\___/_/\_\
 
 
 """)


@bot.command()
async def ping(ctx):
    embed = nextcord.embed(name ="Pong!", description = f"``{round(bot.latency * 1000)}``Ms")

    await ctx.send(embed = embed)





bot.run(sex.token)
unkempt canyonBOT
#

@stiff flicker :x: Your 3.10 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'nextcord'
slate swan
#

This?

#

Please help

#

Send the full code so i can end this suffering

#

You would need to send your full code.

vocal snow
#

And not as a screenshot preferably

slate swan
#
@client.command()
async def whois(ctx, user: discord.Member=None):
  r = random.randrange(0, 255)
  g = random.randrange(0, 255)
  b = random.randrange(0, 255)
  embed = discord.Embed(color = discord.Colour.from_rgb(r, g, b,), timestamp = ctx.message.created_at)
  embed.set_author(name = f"User Info - {user}")
  embed.set_thumbnail(url=user.avatar_url),
  embed.set_footer(text=f"Requested by - {ctx.author}", url_icon=ctx.author.avatar.url),
    
  embed.add_field(name="ID",value=user.id,inline=False),
  embed.add_field(name="Name",value=user.display_name)

  embed.add_field(name="Created at",value=user.created_at,inline=False)
  embed.addfield(name="Joined at",value=user.joined_at,inline=False)

  embed.add_field(name="Bot?",value=user.bot,inline=False)

  ctx.send(embed=embed)
crystal glen
#
@client.command()
async def list(ctx):
    await ctx.message.delete()
    for file in os.listdir(f"D:/Desktop/Haryad Bot/sounds"):
        if file.endswith(".mp3"):
            await ctx.send(f"{file}")

How to send them all at once and not seperate?

#

As a list

slate swan
crystal glen
#

Python should be able to do it tho

slate swan
slate swan
slate swan
crystal glen
placid verge
crystal glen
#
list.append([file:-4])

How do I do this properly?

#
@client.command()
async def list(ctx):
    await ctx.message.delete()
    list = []
    for file in os.listdir(f"D:/Desktop/Haryad Bot/sounds"):
        list.append([file:-4])
    await ctx.send(f"{list}")```
slate swan
#

@tawdry karma Me dying

ivory spire
#

Can someone help me test something rq so I can see if my discord bot is working properly?

#

dm me

slate swan
#

Sure

magic pond
#
class HelpView(discord.ui.View):
    def __init__(self, user):
        super().__init__(timeout=120)
        self.user = user
        self.action = None
        self.add_item(HelpSelect(self))

    async def interaction_check(self, interaction) -> bool:
        return interaction.user.id == self.user.id

    @discord.ui.button(
        emoji=":doubleLeft:",
        custom_id="first-page",
        row=1,
        style=discord.ButtonStyle.blurple,
    )
    async def double_left(self, button, interaction):
        self.action = "first-page"
        self.stop()

    @discord.ui.button(
        emoji=":Left:",
        custom_id="page-1",
        row=1,
        style=discord.ButtonStyle.blurple,
    )
    async def left(self, button, interaction):
        self.action = "page-1"
        self.stop()

    @discord.ui.button(
        emoji=":Lock:",
        custom_id="stop", 
        row=1, 
        style=discord.ButtonStyle.blurple
    )
    async def _stop(self, button, interaction):
        self.action = "stop"
        self.stop()

    @discord.ui.button(
        emoji=":Right:",
        custom_id="page+1",
        row=1,
        style=discord.ButtonStyle.blurple,
    )
    async def right(self, button, interaction):
        self.action = "page+1"
        self.stop()

    @discord.ui.button(
        emoji=":doubleRight:",
        custom_id="last-page",
        row=1,
        style=discord.ButtonStyle.blurple,
    )
    async def double_right(self, button, interaction):
        self.action = "last-page"
        self.stop()
#

is this correct ?
the reactions are not being added to the embed

tawdry karma
#

ping

tawdry karma
slate swan
#

lol

#

me code 24/7 ours

tawdry karma
#

Lmao

vocal snow
magic pond
#

yes

#

it was working before but its not working now

pearl shoal
#

i haave a question if client = commands.Bot

vocal snow
pearl shoal
#

then can we not make the bot reply to a normal message like

#

if user_message.lower() == 'hi":

#

await message.channel.send(f'hello')

#

can we?

magic pond
# vocal snow How are you sending the view
        helps = {
            "1": embed_1,
            "2": embed_2,
            "3": embed_3,
            "4": embed_4,
            "5": embed_5,
            "6": embed_6,
            "7": embed_7,
            "home": embed_1,
            "fun": embed_2,
            "image": embed_3,
            "moderation": embed_4,
            "information": embed_5,
            "economy": embed_6,
            "setup": embed_7,
        }
        if command_name is None:

            cur_page = 1
            view = HelpView(ctx.author)
            view.children[0].disabled = True
            view.children[1].disabled = True
          
            message = await ctx.send(embed=helps["1"], view=view)
            while True:
                wait = await view.wait()
                if wait is True:
                    for child in view.children:
                        child.disabled = True
                    view.timeout = 1
                    await message.edit(view=view)
                    return

                action = view.action
                new_view = HelpView(ctx.author)

                if action == "stop":
                    for child in view.children:
                        child.disabled = True
                    view.timeout = 1
                    await message.edit(view=view)
                    return
zealous jay
#

or do some kind of str manipulation

#

does"\n" .join(list) work?

shrewd apex
#

whats view.action i dont remember there being such a var?

shrewd apex
zealous jay
#

oh like that

#

sry lemon_sweat

#

Because you dont har any commands?

#

try !help, its a default command

#

oh you deactivated it

vale wing
#

Hello guys I have an issue

#

My bot acts dumb

slate swan
#

Give more context... Is this a pypi thing?

glad cradle
#

yes, it is

paper sluice
vale wing
slate swan
#
  1. Did you install the jsk using pip?
  2. Did you load the extension to your code?
slate swan
vale wing
#

One of my 3 am ideas implemented

glad cradle
slate swan
#

Nerdbot

cold sonnet
#
class Month(ui.Select):
    def __init__(self, ctx):
        self.ctx = ctx
        ...

    async def callback(self, interaction):
        await interaction.response.defer()
        if not interaction.author == self.ctx.author:
            return await self.ctx.send(f"**{interaction.author}, nem te.**")

    @commands.cooldown(1, 360, commands.BucketType.user)
    @commands.command(aliases=["birthday"])
    async def birth(self, ctx):
        ...
        await ctx.send("**A hónap amiben születtél...**", view=View(Month(ctx)))
``` why is the if statement in the callback ignored
#

my bot doesn't work >:c

zealous jay
#
@client.command()
async def list(ctx):
    files = []
    await ctx.message.delete()
    for file in os.listdir(f"D:/Desktop/Haryad Bot/sounds"):
        if file.endswith(".mp3"):
            files.append(file)
        files_list = '\n'.join(files)
        await ctx.send(f"{files_list}") 

@crystal glen

vale wing
#

< 50 lines of code

#

No wonder why it's so dumb

#

I gotta write 5000 so it's a true nerd

#

in one file

#

I wasn't talking about your code sorry lol

vale wing
slate swan
vale wing
#

Damn the bot got smarter suddenly

magic pond
#
class HelpView(discord.ui.View):
    def __init__(self, user):
        super().__init__(timeout=120)
        self.user = user
        self.action = None
        self.add_item(HelpSelect(self))

    async def interaction_check(self, interaction) -> bool:
        return interaction.user.id == self.user.id

    @discord.ui.button(
        emoji=":doubleLeft:",
        custom_id="first-page",
        row=1,
        style=discord.ButtonStyle.blurple,
    )
    async def double_left(self, button, interaction):
        self.action = "first-page"
        self.stop()

    @discord.ui.button(
        emoji=":Left:",
        custom_id="page-1",
        row=1,
        style=discord.ButtonStyle.blurple,
    )
    async def left(self, button, interaction):
        self.action = "page-1"
        self.stop()

    @discord.ui.button(
        emoji=":Lock:",
        custom_id="stop", 
        row=1, 
        style=discord.ButtonStyle.blurple
    )
    async def _stop(self, button, interaction):
        self.action = "stop"
        self.stop()

    @discord.ui.button(
        emoji=":Right:",
        custom_id="page+1",
        row=1,
        style=discord.ButtonStyle.blurple,
    )
    async def right(self, button, interaction):
        self.action = "page+1"
        self.stop()

    @discord.ui.button(
        emoji=":doubleRight:",
        custom_id="last-page",
        row=1,
        style=discord.ButtonStyle.blurple,
    )
    async def double_right(self, button, interaction):
        self.action = "last-page"
        self.stop()

is this correct ?
the buttons are not being added to the embed

#

cud someone help me

vale wing
#

@slate swan what functionality do you need from jishaku

slate swan
#

Well thats me out, sorry, I don't use pypi, nor have I used jishaku, I don't want to just keep randomly guessing at what you need to do and currently working so cant fire up my test box to do some testing to help you.

shell wing
#

Any sample code for timeout users ??

dusky pine
#

first of all why do you gotta redefine bot

vale wing
shell wing
zealous jay
#

and wheres the line that makes it run with the token

dusky pine
#

and have you actually registered the jishaku extension?

#

bot.load_extension("jishaku") after creating ur bot object

cold sonnet
dusky pine
cold sonnet
#

which one

dusky pine
#

Month? UI objects?

cold sonnet
#

self.ctx doesn't change

#

oh Month

#

no

#

callback is called on every interaction

#

self.ctx doesn't change, neither does the Month object

#

but somehow the if statement is never True

dusky pine
#

probably just store the initial author ID in another variable

cold sonnet
#

self.ctx.author

#

do I send the whole thing

shell wing
cold sonnet
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

cold sonnet
vale wing
cold sonnet
#

the if statements in the callbacks of Month and Day are both ignored

vale wing
#

Copypasters protection haha

dry urchin
#
[2022-08-04 15:45:45] [ERROR   ] discord.ui.view: Ignoring exception in view <View timeout=180.0 children=2> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Yeah' emoji=<PartialEmoji animated=False name='p_thumbsup' id=1003403273966977114> row=None>
Traceback (most recent call last):
  File "C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 423, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\***\PycharmProjects\syno\main.py", line 74, in yesButton_callback
    await interaction.response.send_message(
  File "C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\interactions.py", line 724, in send_message
    self._parent._state.store_view(view, entity_id)
  File "C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\state.py", line 371, in store_view
    self._view_store.add_view(view, message_id)
  File "C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 546, in add_view
    view._start_listening_from_store(self)
AttributeError: 'NoneType' object has no attribute '_start_listening_from_store'
shell wing
#

dont u have a easy to read and use code ?

vale wing
#

Nah my code is pretty good

dry urchin
vale wing
dusky pine
#

not all pieces of code are compatible with every project :P

vale wing
#

Just reading it on github won't really help

vale wing
#

But he asked for sample code, I gave him sample code lol

#

It's just probably not really sample

dusky pine
#

that piece of code may rely on a specific project's utility functions, classes, helpers, etc

cold sonnet
#

Imma make this b work someday somehow

vale wing
#

Of that button callback

slate swan
#

How can i make my python bot 24/7

vale wing
#

@slate swan

#

If you need help with its setup I have a couple of guides

dry urchin
# vale wing Could you show your code
    async def yesButton_callback(interaction):
        embed = Embed(title=f"![checkmarktick](https://cdn.discordapp.com/emojis/1003405974704496660.webp?size=128 "checkmarktick") banned {member.display_name}", colour=0x36393E)
        embed.set_footer(text=f"requested by {ctx.author}", icon_url=ctx.author.avatar)
        await interaction.message.delete(delay=5)
        await interaction.response.send_message(
            content=f'![checkmarktick](https://cdn.discordapp.com/emojis/1003405974704496660.webp?size=128 "checkmarktick") banned **{member.display_name}** | "{reason}"', view=None)
        try:
            await member.send(f"![icons_ban](https://cdn.discordapp.com/emojis/1004761087629086850.webp?size=128 "icons_ban") you were banned from **{member.guild}** for the reason: {reason}")
        except:
            pass
slate swan
#

How can i do it?

vale wing
#

Just don't parse view kwarg at all @dry urchin

slate swan
#

What i gonna do?

vale wing
#

Not you

vale wing
dry urchin
vale wing
#

I don't see it anywhere in your code

slate swan
dry urchin
vale wing
#

Amazon AWS provides free tier VPS for 1 year

vale wing
slate swan
#

I dont have one

dry urchin
slate swan
#

Im 14

solar pine
#

How do I get the nickname of the author without passing an arg?

vale wing
slate swan
#

They not gonna do it

vale wing
#

Well sad

solar pine
#
# Raid score command
@commands.command()
async def score(self, ctx:commands.Context):
  worksheet = await gs.get_worksheet()

  author = ?
vale wing
#

Usually it's ctx.author.display_name

slate swan
#

@vale wing is there other way?

vale wing
solar pine
#

I don't yeah, not using beta

slate swan
#

it still exists

vale wing
#

Well good then

#

I don't remember in what version it was added gotta check the docs

solar pine
#

I can use the display_name for the User class

vale wing
#

!d discord.Member.display_name

unkempt canyonBOT
#

property display_name```
Returns the user’s display name.

For regular users this is just their username, but if they have a guild specific nickname then that is returned instead.
slate swan
#

1.5 mb, not sure

solar pine
#

Wait does ctx.author give a user class?

vale wing
slate swan
#

Help

slate swan
vale wing
solar pine
#

Oh, right, it's confusing

vale wing
#

@slate swan if your bot isn't very expensive to run I could put it on my server

solar pine
#

Thanks

slate swan
#

Can i use discloud?

vale wing
#

Idk

slate swan
#

@vale wing

#

Can you fic my code that i send earlier

#

Can someone fix please

vale wing
#

url=user.avatar_url simply

slate swan
#

I already put it

vale wing
#

Well error says you didn't

slate swan
#

Waht is the difference?

slate swan
#

you need to restart the bot too.

#

also in the footer, its icon_url, not url_icon

#

cool!

#

Help me @slate swan

#

Please

#

what;s the issue?

dry urchin
#

let's say I want it for 5mins

slate swan
dry urchin
#

I alrdy did datetime.datetime.utcnow() +

vale wing
#
from datetime import timedelta
...
await member.timeout(duration=timedelta(days=5))```
slate swan
vale wing
#

!d datetime.timedelta for more info

unkempt canyonBOT
#

class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)```
All arguments are optional and default to `0`. Arguments may be integers or floats, and may be positive or negative.

Only *days*, *seconds* and *microseconds* are stored internally. Arguments are converted to those units...
dry urchin
#

ty

slate swan
slate swan
#

Im so dumb

#

I didn't find it

dry urchin
#

@vale wing

    elif isinstance(error, commands.MissingPermissions):
        member = ctx.author
        await member.timeout_for(duration=timedelta(minutes=5), reason="ran ban command when they don't have perms")
        owner = bot.get_user(ctx.guild.owner.id)
        await owner.send(f"![timer](https://cdn.discordapp.com/emojis/1004771748291563602.webp?size=128 "timer") I have timed out **{ctx.author}** for 5m because they ran my ban command without perms.")
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'timeout_for'
vale wing
#

What library do you have

#

!d discord.Member.timeout

unkempt canyonBOT
#

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

Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").

You must have the [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members "discord.Permissions.moderate_members") permission to use this.

This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.edit "discord.Member.edit").
dry urchin
#

pycord

vale wing
#

Then why is it discord.ext.commands...

dry urchin
#

oh

zealous jay
#

thir party libraries 😫

vale wing
#

Disnake is actually better than dpy imo

zealous jay
#

why?

silk fulcrum
#

because he built a bot on it

vale wing
#

More user friendly in terms of slash commands

zealous jay
#

lmao

#

Wdym slash commands are easy af on the new d.py

silk fulcrum
vale wing
#

Those tree.sync dpy has

silk fulcrum
#

bruh is that hard

vale wing
#

That's not hard but like I gotta write it in every single bot

zealous jay
#

so how is it on disnake

#

it syncs on all servers?

silk fulcrum
#

lmao you have to write import disnake in every single bot

vale wing
#

There's no even need to call any functions to sync the tree in disnake

zealous jay
#

but that sucks what if i want them on a particular server

vale wing
zealous jay
#

no way

vale wing
zealous jay
#

so you actually have to write more on disnake

#

well idk this is kinda pointless

vale wing
#

What the hell discord

silk fulcrum
#

lmmmao

slate swan
vale wing
silk fulcrum
#

yeah

slate swan
#

Does someone know how to get this badge on my bot?

#

add a slash command to ur bot

#

I did already

placid willow
slate swan
#

Do i have to restart my bot or kick the bot from the server and invite it again?

vale wing
slate swan
#

depends, if you invited it with application.commands scope or not

slate swan
honest shoal
slate swan
honest shoal
slate swan
honest shoal
#

I don't know about 2.0, did you mention your guild id somewhere to sync the commands instantly?

slate swan
#

No it syncs automatically

#

I only use the guild id for the cogs

sick birch
slate swan
#

wait

silk fulcrum
slate swan
silk fulcrum
#

oh

#

bruh me dumb, i dont know anything about programming im leaving

unkempt canyonBOT
#

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

[No output]
#

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

foobar
silk fulcrum
#

#bot-commands?

silk fulcrum
#

no

#

y'all just 1000000 times better than me

slate swan
silk fulcrum
#

no u are at least 100000 times better than me

#

but that's just my guess

#

probably you are 10000 times better than my guess

slate swan
#

N O

quaint epoch
calm ridge
#

i fixed some of my bot code but im still having some errors

zealous rapids
#

how do I restart my bot

silk fulcrum
zealous rapids
#

ok thanks ill try it

calm ridge
# calm ridge i fixed some of my bot code but im still having some errors
    upload_tweet = api.media_upload(filename, status=tweet_text) #Posts Tweet
, line 3560, in media_upload
    return self.simple_upload(
, line 46, in wrapper
    return method(*args, **kwargs)
, line 3604, in simple_upload
    return self.request(
, line 259, in request
    raise Forbidden(resp)
tweepy.errors.Forbidden: 403 Forbidden

silk fulcrum
#

if it's possible

#

and token also

#

reset token, RN

zealous rapids
#

thank you

silk fulcrum
#

!pypi tweepy

unkempt canyonBOT
quaint epoch
calm ridge
#

damn

#

fuck

quaint epoch
#

swearing aint gonna help

silk fulcrum
calm ridge
#

and i reseted all the keys

silk fulcrum
#

then it's denied for some other reason

#

idk why can it be denied, I never even used twitter in my life :lmao:

calm ridge
#

lol

#

im just struggling with the tweepy part

silk fulcrum
#

well the thing is as I already told that you've got 403 (access denied)

slate swan
#

blocking calls dogepray

shrewd apex
#

env files exist

calm ridge
#

by accident

slate swan
shrewd apex
crystal glen
#
@client.command()
async def nuke(ctx):
    x = ctx.author.voice.channel
    for i in range(10):
        await x.connect()
        asyncio.sleep(1)
        await x.disconnect()

Why it doesn't disconnect and says disconnect is no attribute?

shrewd apex
#

the command name 💀

crystal glen
#

💀

calm ridge
crystal glen
#

I wanna annoy my friends

crystal glen
#

Come on... Tell me

slate swan
crystal glen
#

BRO JUST TELL ME

slate swan
#

tell you what, what even is the tb

crystal glen
#

nvm I found out myself

#
@client.command()
async def nuke(ctx):
    x = ctx.author.voice.channel
    for i in range(10):
        await x.connect()
        asyncio.sleep(1)
        y = ctx.voice_client
        await y.disconnect()
slate swan
#

ok

#

why didnt you see it earlier, at least we didnt have to see what we are seeing pepecri

crystal glen
#

are u guys trying to be funny or smth?

silk fulcrum
slate swan
# silk fulcrum 🆒
  • you are re-defining a variable with fixed values
  • your type hint for opt is actually saying that opt could be None and dict[None] will always return a KeyError exception
    a better way could have been
emojis = {}
def cool_emo(self, option: str) -> Optional[str]:
  return emojis.get(option)

which will return a None if the key isnt found or the key if it is found

zealous rapids
#

im attempting to post memes through a bot but i cant get it to access the folder tey are in

#

they*

#

it cant recognize the path i give it

slate swan
#

HOW TO MAKE BUTTOM BY DISCORD BOT

#

5 HOURS TRY

silk fulcrum
slate swan
#

...?

#

what you said was completely different from wht I did pepecri

silk fulcrum
#

what's wrong?

vocal snow
crystal glen
#

is this valid? ctx.guild.roles

vocal snow
#

Yes

slate swan
crystal glen
#
@client.command()
async def lockdownmode(ctx):
    await ctx.message.delete()
    for channel in ctx.guild.channels:
        await channel.set_permissions(ctx.guild.roles, send_messages=False, read_messages=False, connect=False, speak=False)
    await ctx.send("Lockdown mode enabled")

so this works?

silk fulcrum
vocal snow
crystal glen
slate swan
crystal glen
vocal snow
#

Just do it for everyone role