#discord-bots

1 messages ยท Page 759 of 1

honest vessel
#

that explains why he had to ask about that attribute tho

slate swan
#

Some people are just.....born different

honest vessel
#

lol

cloud dawn
#

Most of us suggest Nextcord or Disnake

#

Some also Hikari

slate swan
slate swan
cloud dawn
slate swan
sage otter
cloud dawn
devout iris
#

For pfps

cloud dawn
devout iris
#

Why not ๐Ÿคทโ€โ™‚๏ธ

sage otter
#

Hikari is a pretty nice library tho. I prefer tanjun over lightbulb tbh.

slate swan
cloud dawn
#

External process okay but not combined.

devout iris
#

i c

cloud dawn
# devout iris Ah yes

I would make an API that handles the request and off-loads it to another process since it is highly blocking.

#

You are using an API for Discord wdym?

slate swan
#

you mean a wrapper?

slate swan
#

api wrapper

#

Lmao, nvm my message

#

an api isnt the same as a api wrapper

slate swan
#

idk why you said and api tbh

slate swan
vale wing
slate swan
#

logs can prove me right tho

#

lol

#

No comments

devout iris
vale wing
#

I think PIL would be enough wouldn't it

devout iris
#

i didn't use any API

slate swan
vale wing
#

Epic combo

slate swan
#

Its not ideal always lmao

devout iris
vale wing
#

Cv can be a bit uh too heavy

devout iris
#

Yea so heavy

slate swan
devout iris
#

Wdym?

slate swan
#

Use an API as pandabweer said

honest vessel
#

so who are coders form here that runs disnake? admins or regulars?

slate swan
#

wut

devout iris
slate swan
devout iris
#

Ah :///

#

i didn't make any api

honest vessel
#

@slate swanthem who runs disnake, i heard is from this community but are they normal discord users or mostly admins?

slate swan
#

wdym by run disnake

honest vessel
#

those who contribute

slate swan
slate swan
honest vessel
#

runs the fork

slate swan
#

wdym run the fork?

final iron
slate swan
#

Lol

final iron
#

What is going on

slate swan
honest vessel
#

yes maintain, sorry bad english

slate swan
#

to many

honest vessel
#

anyone has link for disnake discord, i might join there now when i moved over from discordpy

slate swan
honest vessel
#

ty brother

slate swan
#

yw

#

Disnake server has less than 1k members?

#

yes

#

weird

#

not really

#

its just underrated

#

Yeah

#

which some forks are really overrated

#

pycord

devout iris
slate swan
slim ibex
#

nextcord > all

slate swan
slim ibex
slate swan
slate swan
#

i like my dpy forks but the statements that danny have said are true

slate swan
slim ibex
honest vessel
#

guys no need for fight over forks..

#

lets be diplomatic, they all has pros n cons

slate swan
#

guys its obvious just go with discord.rb

slim ibex
#

not tryna fight just trying to state nextcord is my preferred

slate swan
slate swan
slate swan
slate swan
#

why would it

#

Woah

slim ibex
slate swan
#

its a api wrapper

slate swan
honest vessel
slate swan
honest vessel
#

more like namedropping

slate swan
#

Lmao

#

discord rb is to bare tho

#

you have to use a bare endpoint to add a reaction

honest vessel
#

use my fork, i changed all discord. into d.

#

will nvr be updated code

slate swan
#

||@slate swan Ruby sucks, make a discord API wrapper in Assembly x86||

honest vessel
#

how about GO?

slate swan
#

but ruby doesnt suck

slate swan
#

Ruby is nicepithink

slate swan
honest vessel
#

is GO doing good? i nvr used it but i knew a guy made a irc bot in it while i did in python

slate swan
#

GO?

slate swan
honest vessel
#

googles own language

slate swan
#

Never tried it welp

#

go is dead

honest vessel
#

its like pythonish

slate swan
honest vessel
slate swan
#

go is just dead

slate swan
devout iris
#

is there any lib for discord.go lel?

slate swan
#

I-

#

discord.go bruh

potent spear
#

apologize?

honest vessel
slate swan
slim ibex
#

discord.cobol

honest vessel
#

discord.cpp tho? ๐Ÿ˜€

slate swan
#

no

devout iris
#
print("hello world")

Like that

#

Rainbow colors

slate swan
#

imagine making a bot in cpp

slate swan
slate swan
honest vessel
slate swan
honest vessel
#

my point ๐Ÿ˜„

slate swan
slate swan
honest vessel
#

decleration n decleration and files n files n codes of codes for simplest shit ever

slim plover
slate swan
slate swan
honest vessel
#

asm n cpp is complicated

devout iris
slate swan
#

Nvm

honest vessel
#

but fun learning smash the stacks n shit

slate swan
#

Welp

#

Use binaries, doesnt matter smhh

#

minecraft command syntaxpithink

#

Lmao

honest vessel
#

lua

slate swan
#

no

#

lua is like ruby

honest vessel
#

lua is for World of warcraft

slate swan
#

LMAO

honest vessel
#

or no use

slate swan
slate swan
honest vessel
#

html with hardcaded styles โค๏ธ written in notepad

slate swan
#

Welp

honest vessel
#

good old times

slim ibex
honest vessel
#

whats uwu?

slate swan
#

yall dont program in cmd?

slate swan
honest vessel
#

DOS

slate swan
slate swan
slim ibex
#

imagine not programming in binary ๐Ÿ˜ฌ

honest vessel
#

@slate swani might be lil older ๐Ÿ˜›

#

i just asked in disnake discord what is NSFL

slate swan
#

no

#

discord mods are mostly 50>

#

Lol

slim ibex
slate swan
#

Lmao

honest vessel
#

not mods

slate swan
#

lol

honest vessel
#

my age personal variable tho

#

we can say its unixtime 0

#

jk not that old

slate swan
#

your talking to yourself rn its funny

honest vessel
slate swan
#

happens just know im always lurking

honest vessel
slate swan
#

lol

honest vessel
#

@honest vesselHows ya day been?

slate swan
honest vessel
slim ibex
#

bros talking to himself

slate swan
#

fr

honest vessel
#

๐Ÿ˜„

final iron
#

Donate me command ideas please

honest vessel
#

I am special dont mind me.

final iron
#

Im running out of ideas

slate swan
#

or the weather

honest vessel
#

make a radio

#

what i did

final iron
#

Is copyright legally binding?

honest vessel
#

bot -> voicechat functions | db -> add remove webstations, and swap channels and see a list of channels

#

webradios are public n very legal

#

its basicly u open a browser n listen to webradio

final iron
#

But are you allowed to stream them through your bot

#

That's the real question

honest vessel
#

ofc i am

slate swan
#

if the song is copyright no

honest vessel
#

is it illegal turn radio on at work?

slate swan
#

no

honest vessel
#

then no

#

if i ripped songs that would be illegal

#

like ytdl

#

why i think outofbox n make webradio functions

pliant gulch
#

It all depends on the content your bot is streaming

slate swan
pliant gulch
#

So as long as they allow/have licenses that allow you to redistrubte/stream

#

Perfectly legal case^

slate swan
#

^

honest vessel
#

thing is i nvr safe actual music, i tho save song titles cause we have function like .dj ss (saves song being listenined to at a personal db list)

pliant gulch
#

Nothing wrong with not saving the music, even better probably

#

But the problem stems at whether or not you have the rights to stream

honest vessel
#

@pliant gulchsee it this way, i am in a car... turning music on those in my car hears it...

slate swan
#

copyright laws lol

honest vessel
#

i dont download any music

#

copyright in car?

slate swan
pliant gulch
honest vessel
#

its like i turn radio on at work

pliant gulch
#

Completely different in legality

slate swan
#

they ask for permission

honest vessel
slate swan
#

yes

pliant gulch
honest vessel
#

am just a listener

#

n my discord homies are in my car

pliant gulch
#

But your bot is streaming the audio/music

#

Specifically in youtubes case their ToS says no bots

#

I'm not sure about radios though

slate swan
#

theirs a difference between listening and streaming it lol

honest vessel
#

in the car

pliant gulch
#

The radio from your car is streaming the audio from the radio, your bot streams the audio from the radio

#

Do you see the difference here

#

Like it's perfectly legal for me to watch a youtube video, on the other hand I cannot stream the video via third source

#

As per their ToS

#

Its quite simple,

slate swan
#

your listening to it in a car which has a radio which the songs come from a radio station which a radio station asks the artist or team for permission

honest vessel
#

this is my radioplayer

#

i have no hardware

pliant gulch
#

So your bot somehow runs without hardware

honest vessel
#

but what happend,

honest vessel
#

youtube stream is diffrent cause copyright

#

radio pay for play songs

final iron
# honest vessel but what happend,

Not to accuse you of anything but one of the biggest causes of that is when you use a modded discord client and reply to a deleted message

slate swan
pliant gulch
pliant gulch
#

Same would go along for whatever radio you are utilising here

slate swan
pliant gulch
#

If it's allowed by their policy/ToS perfectly legal and fine

#

Otherwise your in greywater

#

Your not streaming radio audio through a radio

#

Your streaming audio from the radio from the bot

honest vessel
#

well i think its a grayzone then

#

cause i understand ytdl not nice for yt

honest vessel
#

basicly

pliant gulch
#

Sure, if the phone has the licensing to permit it

honest vessel
#

i dont host a website n take all their listneers n cost bandwidth

pliant gulch
#

Your radio in your car, has a license from the radio company to play

#

Otherwise the car company wouldn't sell it together

honest vessel
#

ofc my pohe has rights to play radio

#

its build't in even

pliant gulch
#

Sure you can plug it into a big speaker and listen to it

#

The issue though is streaming said audio back into the internet or other unauthorised places defined by the licensing agreement

honest vessel
#

my first idea was to play only nocopyrigthed music for streamers and others on discord

pliant gulch
#

Basically going back to the grey water

honest vessel
#

i think its a gray zone tho

#

i think they dont care aslong i dont make money or steal bandwith

pliant gulch
honest vessel
#

i dont think i doing naything bad or wrong tho

pliant gulch
#

Don't donwload it through youtube etc

#

Just go to the main website they have iirc

honest vessel
#

but i quitted that cause so unclear copyright rules

#

some call it noncopyright but if u make money its copyright

pliant gulch
#

Are you making money??

final iron
#

Streaming podcasts would be interesting

honest vessel
#

i pay for bot host

pliant gulch
#

Do you have anything in your bot that can make money off of

honest vessel
#

no

pliant gulch
honest vessel
#

its a small place like 10 users n sometimes we listen to alls diffrent radios

#

@pliant gulchi ment youtube songs, some are hosted by lets say nocopyrightsongs, but in small text its not copyright free, if u make money u gotta pay

#

it can be same channel but diffrent rules

#

very gray

pliant gulch
#

๐Ÿ˜• Noncopyright doesn't have youtube songs they have songs

#

Youtube is a hosting platform for them

#

If you, I don't know; take the time to pick out a mp4 and a license from their website

honest vessel
#

omg stop be so specific how i talk

pliant gulch
#

Maybe you'd get somewhere, instead of complaining

honest vessel
#

point is same

#

u the one complaining ๐Ÿ˜„

#

I just told a guy he can make a webradio player like i did

pliant gulch
#

Not sure where I was complaining

#

Simply explaining the legality of the topic is complaining now I gues???

#

๐Ÿค”

keen talon
final iron
#

Is there a default policy that applies if a website doesn't have their policy listed?

honest vessel
#

no its my english

pliant gulch
keen talon
#

Not officially, but yes there are some

honest vessel
#

but yall are right its a grayzznoe but - their commercial aint blocked etc

#

its not illegal for me to record it n play it at my friends house

#

or is it?

#

maybe that is, but if stream its fine

#

cause nto savedn realtime

pliant gulch
#

Whatever man you take it however you want lol

#

Seems like you haven't read a single thing I said

honest vessel
#

i atleast gave one inspiration of podcasts

#

@pliant gulchi did but i just wanna say it prob is a grayzone

#

i cant answer it

#

i think its more about if $ in it

#

steaming netflix on voicechat is prob not good.

#

but netflix is locked radio is public

#

oh 5 listeners sue me 5 millions usd

#

i think its all fine, they can ipblock bot if any

#

@pliant gulchi get arguments but i think its same both same

#

if any i give that radio new followers

pliant gulch
#

You do you ยฏ_(ใƒ„)_/ยฏ

slate swan
#

string (str) => ""
???? (??) => []

#

How was it called? ^^`

rancid inlet
#

A while back I heard that the developer of discord.py was going to stop developing because discord was changing their API in a few unfriendly ways. Anyone know the latest developments on this? Is discord.py getting abandoned soon? Is the new API going to cause issues?

slim ibex
#

!pypi nextcord

unkempt canyonBOT
slim ibex
#

!pypi disnake

unkempt canyonBOT
slim ibex
#

!pypi pincer

unkempt canyonBOT
wispy spade
rancid inlet
#

Makes sense, thanks @wispy spade @slim ibex

slate swan
#

he had many responsibilities which he didnt want to keep on going with

#

he doesnt want to comeback but so many forks with bad implementation are just calling him to fix all these messes forks have made but he doesnt want to comeback

fresh orchid
unkempt canyonBOT
fresh orchid
#

Or is it py-cord

final iron
#

Basically froze my computer for 5 minutes

#

Was doing this [''.join(element) for element in list(permutations(data))] to a list of like 25k indexes

slate swan
#

dang

final iron
#

Lets just say I overlooked that bit

#

I copied all these in to a file

#

And started doing that list comp on it

#

Was not a good idea

slate swan
#

yeah thats allot of elements

honest vessel
#

guess whois back ur fav

final iron
#

It is quite a bit

honest vessel
#

oki.miiiii

slate swan
final iron
#

I'm making an anagram command

slate swan
#

nice

final iron
#

So I need a ton of words

honest vessel
#

whats the thing with japanese besides be japanese`?

slate swan
#

bro wut

honest vessel
#

why u like japaneses`?

slate swan
#

!ot ๐Ÿ˜ณ

unkempt canyonBOT
honest vessel
#

simplfy

#

@slate swanu def needs to join me

slate swan
#

๐Ÿšถ

oblique cobalt
slate swan
oblique cobalt
#

that is called list

slate swan
#

How do I dissolve the list?

oblique cobalt
#

dissolve ? what do you mean

slate swan
#

how is this dpy related๐Ÿงโ€โ™‚๏ธ

oblique cobalt
slate swan
#

?

#

like...

oblique cobalt
honest vessel
#

del discord

slate swan
#

your checking if a int is in a list of ints what about it

slate swan
honest vessel
#

wat is it real

slate swan
#
list = [id1, id2]

if ctx.author.id in list:
slate swan
honest vessel
#

just thinking now how i unimport a lib?

slate swan
#

list is a class

slate swan
slate swan
#

not hard to call it a

oblique cobalt
slate swan
#

or b

oblique cobalt
#

good point

velvet tinsel
#

evening okimii

velvet tinsel
#

it shadows it

oblique cobalt
#

yeah but im saying that when u use symbols directly, it gets original one

slate swan
cloud dawn
velvet tinsel
#

*visible confusion*

pliant gulch
#

!e True = False

unkempt canyonBOT
#

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

001 |   File "<string>", line 1
002 |     True = False
003 |     ^^^^
004 | SyntaxError: cannot assign to True
velvet tinsel
#

you can assign stuff to variables that shadows names of builtins and stuff

devout iris
#

How to add reaction to message?

#

i mean i need emoji names how to add emoji names

slate swan
devout iris
#

await message.add_reaction(":thumbsup;")

#

Will it work?

slate swan
#

message is?

cloud dawn
#

If "message" is a message object then yes.

devout iris
slate swan
#

that has?

devout iris
#

it is just for example

slate swan
#

ah

devout iris
#

i just am asking will it work? Only emoji name

#

With ":"

slate swan
#

:angry:

#

like this?

devout iris
slate swan
#

yeah

devout iris
#

Alright thx :)

slate swan
#

!d discord.Message.add_reaction

unkempt canyonBOT
#

await add_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
velvet tinsel
#

okimii going god mode ๐Ÿ˜ค

slate swan
#

nopithink

velvet tinsel
#

yes

slate swan
#

no

velvet tinsel
#

yes

slate swan
#

no

velvet tinsel
#

yes

slate swan
#

finepithink

velvet tinsel
#

do you want me to selfbot and then say yes whenever you say no

slate swan
#

no pls

oblique cobalt
slate swan
velvet tinsel
#

I'm gonna die

slate swan
#

๐Ÿง‘โ€๐Ÿฆฏ

velvet tinsel
slate swan
#

reports

#

jk

velvet tinsel
#
import disnake
from disnake.ext import commands

bot = commands.Bot(command_prefix=".", help_command=None)


@bot.event
async def on_ready():
  print("ok")

@bot.listen()
async def on_message(message):
  if message.author.id == 637458038915203127 and "no" in message.content:
    await message.reply("yes")

will this work?

velvet tinsel
#

nesting it ๐Ÿ™‚

slate swan
#

no pls

velvet tinsel
#

hehe

slate swan
#

good

velvet tinsel
#

fixed

#

lemme improve on it

#

wait I cant nvm

#

idk what

slate swan
#

you can

velvet tinsel
#

panda help okimii help

slate swan
#

just subclass the Bot class๐Ÿง 

velvet tinsel
oblique cobalt
slate swan
velvet tinsel
oblique cobalt
slate swan
#

oh i didnt even read what he was trying to do๐Ÿ˜ญ

oblique cobalt
slate swan
cloud dawn
#

Just because you can doesn't mean you should

slate swan
#

so it will have everything that the client class has and more

oblique cobalt
#

cause they do and abuse ppls lives with t sadly :(

velvet tinsel
#

whoopsie daisies

devout iris
#

Can i add reaction to embed with embed.add_reaction() ???

oblique cobalt
velvet tinsel
devout iris
#

Wut

#

Smh

velvet tinsel
oblique cobalt
#

you cant add reaction to embed, but u can to message itself

slate swan
velvet tinsel
#

oh, you mean you can't do discord.Embed(...).add_reaction(...)?

oblique cobalt
#

yes but man said embed.add_reaction

velvet tinsel
#

what

#

now you're confusing me

oblique cobalt
#

what

slate swan
#

its a coro

velvet tinsel
#

make your mind(s) up

devout iris
#

Everyone confusing me ROFL

velvet tinsel
devout iris
#

How can i add multi emojis?

#

A few reactions for a message

velvet tinsel
slate swan
#

i think you can add a list im not sure

velvet tinsel
slate swan
graceful halo
#

HI I just want ot know where I would go to learn pythonI don't know anything as of know and am trying to decipher old code

velvet tinsel
#

he forgot to put len()

slate swan
#

lollllll

velvet tinsel
#

done

velvet tinsel
#

I told him

velvet tinsel
slate swan
#

theres nothing lol

oblique cobalt
#

nothing like that exists and besides, embed is in message, so adding reaction to embed basically means you want to add reaction to message

slate swan
#

embed is a instance of a msg

oblique cobalt
graceful halo
#

can someone help me please

oblique cobalt
graceful halo
#

I asked earlier no one responded

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.

graceful halo
flat solstice
#

So this might be a bit of a abstract explanation but I think if I start adding in lots of my code it will cause more confusion.

I have a lists (key_words) and 'thing'. I want to know if anything from my list appears in the 'thing' so I'm doing if key_words in message.embeds[0].title: (the latter being the 'thing'. Is there a way to know which item of the list triggers the code to execute the code within the if statement? Or would I need to break it down and check each item of the list individually?

velvet tinsel
devout iris
#

should i return this or add an "if" ? (i have 4 emojis so idk)

flat solstice
# velvet tinsel can you show us the full code?
@commands.command()
@commands.has_permissions(administrator = True)
async def moderation_logs(self, ctx):
    snowyjaguar = self.bot.get_user(self.bot.config.developerid)
    key_words = ["WARN", "MUTE", "UNMUTE", "KICK", "BAN", "UNBAN"] # Add in Captilised versions of each word to account for the Dyno logs
    checked_logs = []
    case_count = 0
    last_checked = 0
    moderation = self.bot.get_channel(id = 885569667861717042)
    clifford_log = self.bot.get_channel(id = 500768218257031168)

    with moderation.channel.typing():
        messages = await clifford_log.channel.history(oldest_first = True, limit = None, after = last_checked).flatten() # 10000
        for message in messages[0:]: # Making bot search history chronologically
            if all([
                message.id not in checked_logs, 
                message.author.id == 776782769312628746, 
                len(message.embeds) > 0, 
                key_words in message.embeds[0].title, 
            ]):
                    embed = discord.Embed(title = f"Case {case_count} | {action}", colour = self.bot.config.error_colour, timestamp = message.timestamp)
                    embed.set_author(name = f"{message.embeds[0].fields[0].value} | {message.embeds[0].fields[0].value.id}", icon_url = message.embeds[0].fields[0].value.avatar_url)
                    embed.set_footer(text = f"{message.embeds[0].fields[1].value} | {message.embeds[0].fields[1].value.id}", icon_url = {message.embeds[0].fields[1].value.avatar_url})
                    embed.add_field(name = "Offender", value = message.embeds[0].fields[0].value, inline = True)
                    embed.add_field(name = "Moderator", value = message.embeds[0].fields[1].value, inline = True)
                    if message.embeds[0].fields[3]:
                        embed.add_field(name = "Duration", value = message.embeds[0].fields[3].value)
                    if message.embeds[0].fields[2]:
                        embed.add_field(name = "Reason", value = message.embeds[0].fields[2].value)
                    checked_logs.append(message.id)

                    await moderation.send(embed = embed)
        await snowyjaguar.send(f"`{len(messages)}` were checked in {clifford_log.mention}, `{case_count}` logs were logged in {moderation.mention}")```
potent spear
devout iris
#

Can i change presence with command?!?!?

potent spear
devout iris
potent spear
#

change_presence
is the method you're looking for in the docs

#

yup, now check the arguments of that method in the docs and voila

oblique cobalt
potent spear
#

also true, the indentation is just wrong

devout iris
devout iris
oblique cobalt
devout iris
velvet tinsel
# devout iris

!d commands.Bot.change_presence || I'm bad at these commands

unkempt canyonBOT
#
Certainly not.

No documentation found for the requested symbol.

velvet tinsel
#

well

potent spear
#

let me guess, you have a wait_for, and depending on the user 's reaction, you want to change the presence of a bot?

oblique cobalt
devout iris
velvet tinsel
#

you did miss an activity kwarg

potent spear
velvet tinsel
#

what are you trying to do?

oblique cobalt
devout iris
#

A sec

potent spear
velvet tinsel
oblique cobalt
devout iris
potent spear
oblique cobalt
velvet tinsel
#

don't you need a activity kwarg to change presence?

oblique cobalt
devout iris
#

Hmmm

flat solstice
# potent spear can you simplify your code? 90% of the stuff is pretty much unrelated to your qu...

is this better?```py
key_words = ["WARN", "MUTE", "UNMUTE", "KICK", "BAN", "UNBAN"] # Add in Captilised versions of each word to account for the Dyno logs
checked_logs = []
case_count = 0
last_checked = 0
moderation = self.bot.get_channel(id = 885569667861717042)
clifford_log = self.bot.get_channel(id = 500768218257031168)

with moderation.channel.typing():
messages = await clifford_log.channel.history(oldest_first = True, limit = None, after = last_checked).flatten() # 10000
for message in messages[0:]: # Making bot search history chronologically
if all([
message.id not in checked_logs,
message.author.id == 776782769312628746,
len(message.embeds) > 0,
key_words in message.embeds[0].title,
]):
# Make a embed
checked_logs.append(message.id)

 await moderation.send(embed = embed)```
velvet tinsel
devout iris
oblique cobalt
devout iris
#

Ah okay

potent spear
devout iris
#

But if i add await it is being red :/

velvet tinsel
oblique cobalt
potent spear
oblique cobalt
velvet tinsel
#

I mean wait_for is something you'll probably need to know?

#

it's possibly inevitable not to use it when developing a discord bot

oblique cobalt
#

@devout iris yeah just return called change_presence and you can await it eventually, or better return the status to what to change, then change_presence outside check and set that

velvet tinsel
#

unless of course...you made one, it doesn't work, you give up.

velvet tinsel
oblique cobalt
#

doesnt wait_for return what check returns as far as i remember ?

oblique cobalt
flat solstice
# velvet tinsel why....why?

why what? why am I doing it that way or why do I want to know what causes the if statement to trigger or something else

slate swan
#

!e print(len("messages = await clifford_log.channel.history(oldest_first = True, limit = None, after = last_checked).flatten()"))

unkempt canyonBOT
#

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

112
slate swan
#

yep it breaks pep8

flat solstice
slate swan
#

the limit of char are 72 iirc

velvet tinsel
#

clifford the big red dog

#

I remember reading it when I was like 3 or 4

I think he died in the end

slate swan
#

its a kids show

velvet tinsel
#

ik

#

thats why I said I watched it when I was 3 or 4

slate swan
#

why would he die

velvet tinsel
#

idk

slate swan
#

๐Ÿ˜ญ

velvet tinsel
#

I think he got deported actually

#

my memories are messed up

slate swan
#

bruh wut

velvet tinsel
#

I remember hurting myself when I was singing tellytubbies

it was disturbing

#

and curious george poisoning himself

slate swan
#

!ot

unkempt canyonBOT
slate swan
velvet tinsel
#

I

devout iris
#

i think that's okay

velvet tinsel
devout iris
#

wtf is the problem

velvet tinsel
#

the PEP8

devout iris
#

what is the PEP8

velvet tinsel
#

also did you define activity somewhere?

devout iris
#

sure

velvet tinsel
unkempt canyonBOT
#

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:
โ€ข PEP 8 document
โ€ข Our PEP 8 song! :notes:

velvet tinsel
devout iris
potent spear
velvet tinsel
slate swan
#

hey, im using discord.py to interact with my bot, tho i just need to send a message and dont need the whole waiting until an event happens. is it possible to somehow only send a message and not wait? ive tried searching for this but couldnt find anything

devout iris
velvet tinsel
#

ok

devout iris
#

for every status

velvet tinsel
cedar stream
#

Hi

velvet tinsel
cedar stream
#

Hyd

velvet tinsel
cedar stream
#

Same

devout iris
velvet tinsel
devout iris
#

i didn't understand :/

velvet tinsel
#

uh

#

just await bot.change_presence(activity=discord.Game(name="i dont know"))

slate swan
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

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

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

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

use the kwarg

velvet tinsel
#

@slate swan ....

#

what are you on about

slate swan
velvet tinsel
slate swan
# cedar stream Wdym

right now client.run(token) keeps running until it receives an event like on_message, but i have a twitter listener that when a tweet gets placed it needs to post the tweet, so i dont need discord.py to wait for an event to happen, but just to send a message

velvet tinsel
#

I was just demonstrating activity

devout iris
#

my goal is change status with command lmao

#

like ;
!online
!idle etc.

slate swan
#

then use what has been given to you but

velvet tinsel
#

but what

slate swan
#

!d discord.ext.commands.Bot.wait_until_ready

unkempt canyonBOT
#

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

Waits until the clientโ€™s internal cache is all ready.
slate swan
#

use that

velvet tinsel
#

my guy

slate swan
flat solstice
cedar stream
slate swan
cedar stream
potent spear
slate swan
cedar stream
#

Like if you are only sending a message Itโ€™ s probably easier that way

#

Depends on use case

slate swan
flat solstice
# velvet tinsel PEP8 for crying out loud

I've uhh.. never read PEP8, the majority of my python knowledge is self taught and from online courses so ik I've heard of PEP8 and I've likely got parts of it down but I've never read it, guess I'll add it to the top of my to read list

slate swan
#

!pep8

unkempt canyonBOT
#

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:
โ€ข PEP 8 document
โ€ข Our PEP 8 song! :notes:

slate swan
#

you should

flat solstice
#

yeah I googled it already ๐Ÿ‘

slate swan
#

nice

flat solstice
slate swan
potent spear
final iron
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
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/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
final iron
#

Create a task to do whatever you're doing with the twitter api

slate swan
#

i think i wouldnt be able to get it working with a task

final iron
#

Barely ever used them though

slate swan
# final iron Why?

im not sure how it could work since id still need to have some listener running for the tasks right?

final iron
#

No. You can start it when your bot launches

#

There are some examples

#

Check them out

flat solstice
slate swan
potent spear
cedar stream
final iron
#

I understand why you recommended a direct api call

#

But for most people it would be complicated and take a fair bit of time

cedar stream
#

You just do a post request with authorization header

#

Idk how task would work in that case

#

I think they want to send message when something on twitter happens

final iron
#

Assuming its for only 1 channel they could just fetch it

cedar stream
#

Wouldnt be real time

flat solstice
final iron
potent spear
cedar stream
flat solstice
cloud dawn
#
if action := [word for word in key_words if word in message.embeds[0].title]:
    embed = discord.Embed(title = f"Case {case_count} | {action[0]}")
``` why not this?
potent spear
flat solstice
slate swan
#

can i not use % in a str?

#

nvm i can it just glows blue like if it were a built in

final iron
slate swan
final iron
#

Pycharm gives me strong warnings for using bot attributes

slate swan
#

dang

final iron
slate swan
#

LOL

final iron
#

It took me so long to figure out how to use them because pycharm was saying it was wrong

slate swan
#

dang

#

lol

final iron
#

return sorted([package for package in [package_tuple[0] for package_tuple in packages]][:25])

#

Rate the readability

gilded ledge
#

Hi everyone does anyone know if I can program my discord bot with Microsoft Visual Studioslogo_vscode

flat solstice
# potent spear apart from the confusing variable name, I'd say no

you referring to action when you mean confusing variable name, if so it's because this for a supplementary moderation logging system and i'm using action as a umbrella term to cover different moderation actions. hope this makes my reasoning for calling it action more understandable

gilded ledge
#

I am new to it

gilded ledge
#

thanks

slate swan
#

yw

slate swan
#

its a ide so me either

gilded ledge
#

I am just new to the interface I will need help setting that up tomorrow it is so late where I am

slate swan
#

pretty easy no need to even need help imo

final iron
#

vsc is very beginner friendly

gilded ledge
#

really??

slate swan
#

yes

final iron
slate swan
#

and wont eat 1gb of ram like pycharm

gilded ledge
final iron
#

I would still suggest you learn about venvs though

#

Dependencies clashing can be a pain in the ass even for beginners

slate swan
#

still dont know about envs๐Ÿƒ

final iron
#

I just use conda

#

Its dead simple

slate swan
#

i use a py file

final iron
#

Open up terminal, type in conda create <venv name> python=<your python version>

#

At least I think thats how you do it

#

Haven't done it in a while

potent spear
final iron
#

anagram command is actually a pain in the ass

#

I've been working on it for like an hour

sage otter
# final iron I just use conda

Anaconda no good. Itโ€™s a hostile environment for asyncio since it with how the loop works. Itโ€™s really only supposed to be used with data science stuff.

#

if you want a venv go with python-venv Go to project working directory and initialize one and activate it and you're good. ๐Ÿ‘Œ

final iron
slate swan
#

I want to create Ultron in py

#

is that possible?

final iron
#

What is Ultron

slate swan
#

A robot in the Marvel Comics

#

A superior AI made by Hank Pym

final iron
#

In what sense would you want to create it

#

You want to create an ai?

slate swan
#

Yes

final iron
#

Thats quite an advanced project

#

Especially if you want a quite advanced ai

slate swan
#

Ok. Fair enough

half tusk
#

Hello could somebody help me out ? I have a problem with a reaction role code

final iron
half tusk
#

ok

#

First of all the bot doesnt react with the emoji on the message, second when a member reacts it pops up on console that Role not found.

#
@bot.event
async def on_raw_reaction_add(payload):
    message_id = payload.message_id
    if message_id == 933128328360099871:
        guild_id = payload.guild_id
        guild = discord.utils.find(lambda g : g.id == guild_id, bot.guilds)

        if payload.emoji.name == '![verify](https://cdn.discordapp.com/emojis/933126735959044136.webp?size=128 "verify")':
            role = discord.utils.get(guild.roles, id= 931644345113796668) 
        else:
            role = discord.utils.get(guild.roles, name=payload.emoji.name)
        
        if role is not None:
            member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
            if member is not None:
                await member.add_roles(role)
                print("done")
            else:
                print ("Member not found.")
        else:
            print("Role not found.")
magic ore
#

bot.get_guild is more efficient than utils.find here

#

Guild.get_role is also more efficient than the utils.get with the role id

potent spear
half tusk
#

so you dont have clue either?

#

damn bro i see

potent spear
#

ofc I do

half tusk
#

help me out then

potent spear
#

then implement what stocker said

#

only use discord utils for name and other attributes

#

use get_x for the id

magic ore
#

^ this also applies for how you get the member who reacted

#

And also show the full traceback that gets printed

half tusk
#

guys just tell me how to fix the code above i dont wanna use other ways

potent spear
#

if you want to know which line is bad
it's the first else statement

half tusk
#

idk why it doesnt work, this code used to work before

potent spear
#

just check every expression, it isn't too hard to check which line is wrong

half tusk
#

i fixed it

#

it wasnt the first else statement but thanks for help ๐Ÿ’

#

btw stress reduced thanks again bro

full valley
#

How can I restart my discordbot with a command?

meager osprey
#

i wanna make bots but idk how to code, can someone help me/ teach me.

slate swan
#

this shall help you ^

meager osprey
#

ok thx

slate swan
#

yw

#

poor ghost ping to sniper

maiden fable
unkempt canyonBOT
#
Huh? No.

No documentation found for the requested symbol.

potent spear
#

yup, I died

slate swan
maiden fable
#

Bruh

#

There u go @full valley

full valley
potent spear
#

ssst

potent spear
#

then why would you?

#

sometimes, logic is involved yk

full valley
#

For emergencyโ€™s if the bot has a meltdown whilst iโ€™m not online

potent spear
#

well, you can just close it, instead of shutting it down

#

because if you restart it, you might have the same result

full valley
#

I mean itโ€™s not going to break that badly, if itโ€™s still not working after a restart than thereโ€™s something wrong with my code

#

So a restarts fine

potent spear
#

nah, if your code "breaks down" there's generally something wrong
A restart will just one way or the other result in a "meltdown" again

#

best thing to do is maybe have a global error handler and just DM you all the UNHANDLED errors
(because you obviously don't want to get a DM whenever someone uses a command the wrong way by for example not passing an arg)

full valley
#

mhm my error handling is mostly ok, just been a couple times thereโ€™s been no errors, but not functioned as I intended

#

Usually I just look at the out log/error log

potent spear
#

a "remote" shutdown would be your best option tbh

full valley
potent spear
#

yeah, you mean unload the cogs probably, that seems good

full valley
#

yeah

slate swan
#

yeah you can restart cogs

#

!d discord.ext.commands.Bot.reload_extension

unkempt canyonBOT
#

reload_extension(name, *, package=None)```
Atomically reloads an extension.

This replaces the extension with the same extension, only refreshed. This is equivalent to a [`unload_extension()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.unload_extension "discord.ext.commands.Bot.unload_extension") followed by a [`load_extension()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.load_extension "discord.ext.commands.Bot.load_extension") except done in an atomic way. That is, if an operation fails mid-reload then the bot will roll-back to the prior working state.
full valley
slate swan
full valley
#

So how can I essentially just stop the py file, and start it again

full valley
#

Yeah only problem is iโ€™m using a vps

slate swan
#

welp๐Ÿšถ

full valley
slate swan
#

not sure how you can tbh

meager osprey
#

im tired of reading

slate swan
meager osprey
#

its kinda useless

slate swan
full valley
slate swan
#

its useless if you dont read it

meager osprey
#

maybe idk what im reding

#

reading

slate swan
slate swan
#

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

full valley
meager osprey
#

no

slate swan
meager osprey
#

๐Ÿคฃ

#

k

slate swan
meager osprey
#

@slate swan theres like 10 choices to select

slate swan
#

just pick the one that you might like ig

meager osprey
#

all ๐Ÿ˜ฑ

slate swan
#

then get to reading

potent spear
full valley
potent spear
# full valley indeed I am

Have you ever wanted to restart your whole bot just from a command or if some command in your bot is stuck , you would able to restart the bot without physical switching it on and off?

import sys
import os
def restart_program():
    python = sys.executable
    os.execl(python, python, * sys.argv)

@bot.command()
@commands.is_owner()
async def restart(ctx):
    
    await ctx.message.delete()
    message = await ctx.send("Restarting... Allow up to 20 seconds")
    
    restart_program()

This a piece of code will restart your program.

How it exactly works?
what it does:
Fetches the python executable (path got from sys).
After fetching the python executable, it gets directory where the main source file ( your bot's main file) and re-runs the file.
As a result, your bot shuts down and the starts again.

wicked atlas
#

I mean, you could also just use extensions

potent spear
#

he has thought of that ofc, I tried to convince him, but yeah

edgy finch
#

hi

#

im new here

slate swan
#

not

#

true

edgy finch
#

?

slate swan
#

ive seen you beforepithink

edgy finch
#

no

slate swan
#

yespithink

edgy finch
#

no

#

no

slate swan
#

okie

edgy finch
#

it might be someone else

#

how to make bots in python?

slate swan
edgy finch
#

ty

slate swan
#

yw

fervent shard
fervent shard
potent spear
#

you've made an error handler for this specific function, but you're skipping ALL the other errors
make sure you have an else statement in that error handler which prints out other unhandled errors
the error will present itself

full valley
# potent spear Have you ever wanted to restart your whole bot just from a command or if some co...

the Danny bot however on discord.py says this:


Do use:
* run your bot in a process manager such as:
  - systemd
  - openrc (gentoo, devuan)
  - runit (void linux)
  - supervisord
  - upstart (old ubuntu)
  - docker
* manually reboot it 

Do not use:
  - a bash loop (it can eat your C-c by rapidly spawning python and if your bot fails it won't stop it from constantly failing)
  - subprocess.call (you will eat your memory up by not letting your old processes die)
  - os.exec*
#

do not use os.exec?

potent spear
potent spear
#

hold up

#

you have shadowing function names lol

#

you have literally 3 clear_error functions

#

it's not because they have different decorators that they won't shadow each other

fervent shard
# potent spear hold up

what abt this?

def save_warn(ctx, member: discord.Member):
    with open('warns.json', 'r') as f:
         warns = json.load(f)
 
         warns[str(member.id)] += 1
 
    with open('warns.json', 'w') as f:
         json.dump(warns, f)
 
def remove_warn(ctx, member: discord.Member, amount: int):
    with open('warns.json', 'r') as f:
         warns = json.load(f)
 
         warns[str(member.id)] -= amount
 
    with open('warns.json', 'w') as f:
         json.dump(warns, f)
 
def warns_check(member: discord.Member):
    with open('warns.json', 'r') as f:
         warns = json.load(f)
 
         return warns[str(member.id)]```
potent spear
#

doesn't matter that much for now

#

json isn't meant to be a db anyways

fervent shard
#

oh

potent spear
#

your problem are just your error handlers

#

look more into how you make decent ones, because you're basically hiding all your other errors by only printing out 1 'sort'

fervent shard
potent spear
#

I'd suggest you to just look into global error handling tbh

fervent shard
#

a

potent spear
#

since all your error handlers just do the same

#

you obv don't want to make an error handler for every command

#

that's ONLY needed if they're specific, which they are not in your case

#

the only thing that's different about them is the command name in the text, which you can easily code via ctx.command.name

fervent shard
potent spear
#

put all your error handlers in codeblocks for now... they're pretty useless
then try the warn command again, and the error will present itself

potent spear
slate swan
#
    if message.content.startswith("$fire"):
        await message.channel.send(Vehicles["Fire"])
        print(message.author, message.content)
    if message.content.startswith("$police"):
        await message.channel.send(Vehicles["Police"])
        print(message.author, message.content)
    if message.content.startswith("$ambulance"):
        await message.channel.send(Vehicles["Ambulance"])
        print(message.author, message.content)
    if message.content.startswith("$civilian"):
        await message.channel.send(Vehicles["Civilian"])
        print(message.author, message.content)
    if message.content.startswith("$trailers"):
        await message.channel.send(Vehicles["Trailers"])
        print(message.author, message.content)
    if message.content.startswith("$jeeps"):
        await message.channel.send(Vehicles["Jeeps"])
    if message.content.startswith("$buses"):
        await message.channel.send(Vehicles["Buses"])

Is there a more elegant way of doing this?

potent spear
final iron
slate swan
#

commands?

final iron
#

!d discord.ext.commands.command

unkempt canyonBOT
#

@discord.ext.commands.command(name=..., cls=..., **attrs)```
A decorator that transforms a function into a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or if called with [`group()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.group "discord.ext.commands.group"), [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group").

By default the `help` attribute is received automatically from the docstring of the function and is cleaned up with the use of `inspect.cleandoc`. If the docstring is `bytes`, then it is decoded into [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") using utf-8 encoding.

All checks added using the [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") & co. decorators are added into the function. There is no way to supply your own checks through this decorator.
slate swan
#

ahh

#

God bless.

final iron
slate swan
#

hmm is that website down? cant see to connect to it

final iron
#

Works fine for me

slate swan
#

oh now it works

potent spear
#

it was still stealing your cookies and tracking your IP, give it some time

slate swan
#

perfect, thats just the tutorial i needed, thanks guys! @final iron @potent spear โค๏ธ

keen talon
final iron
#

How is this looking?

potent spear
#

I'd add emojis to make it appealing

#

also, the unix format isn't useful for regular users

pliant gulch
#

Unix format seems a bit weird to me

#

I, and most others call it epoch time

final iron
#

I'll change it then

pliant gulch
#

Just a nitpick

final iron
#

I think unix format looks better

pliant gulch
pliant gulch
final iron
#

You mentioned some emojis, which should I add?

potent spear
#

a ๐ŸŸข โฒ๏ธ one of those for uptime

final iron
#

How do you do emojis again?

potent spear
#

haven't used them in a while, can't say

#

probably something like :emoji_name:

#

also, I'd just make a info command, nobody cares just about uptime

#

info should contain stuff like ping uptime, ram, usage, ...

pliant gulch
#

\:emojiname:?

#

If that was what you were asking for

final iron
#

How would I get system resources?

#

I was looking at psutil but its blocking

tiny ibex
#

Heya so I wanna make button roles but everytime the bot starts the old buttons get useless and throw Interaction failed error how can I avoid this

visual dagger
#

will pay someone to make me like a 15 line discord script

unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

visual dagger
#

L

final iron
#

I mentioned that above

pliant gulch
#

uhhh

final iron
#

Its blocking

pliant gulch
#

oh

#

Just run it in executor then

final iron
#

hmm?

pliant gulch
#

It's easy

final iron
#

Which one would I want to use