#discord-bots

1 messages · Page 1059 of 1

vale wing
#

It's like deleting channel and recreating it

slate swan
#

@vale wing how would I make it get the ID of the channel?

#

how do you make that

vale wing
#

@slate swan use @tasks.loop to create a loop and in loop just call clone method of channel object and then delete the original one

#

!d discord.ext.tasks.loop

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
#

!d discord.TextChannel.clone

unkempt canyonBOT
#

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

Clones this channel. This creates a channel with the same properties
as this channel.

You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to
do this...
vale wing
unkempt canyonBOT
vale wing
#

OOP 😀

vale wing
#

Yes

slate swan
# vale wing Yes

channel = discord.utils.find(lambda x: x.permissions_for(guild.default_role).send_messages, guild.text_channels)

            if channel.permissions_for(channel.id).view_channel:
#

like that? @vale wing

vale wing
#

Um

#

Not really

slate swan
#

How then?

#

@vale wing

slate swan
slate swan
slate swan
#

!d discord.TextChannel

unkempt canyonBOT
slate swan
slate swan
#

no

keen mural
#

how can i make it so if someone does a certain amount of cmds in a certain amount of time they get put on cooldown for a certain amount of time

slate swan
slate swan
slate swan
keen mural
slate swan
#

i know its possible i dont know how but like is there a way to make a command that can only be triggered by like one person

slate swan
# keen mural what is that

a temporary data load, that checks for the amount of cmds for a particular person and puts them on cooldown

slate swan
keen mural
#

!d discord.ext.commands.cooldown

unkempt canyonBOT
#

@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

A cooldown allows a command to only be used a specific amount
of times in a specific time frame. These cooldowns can be based
either on a per-guild, per-channel, per-user, per-role or global basis.
Denoted by the third argument of `type` which must be of enum
type [`BucketType`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType")...
slate swan
#

its for a single command

#

it'll put a cooldown on a single command though

vocal snow
#

I interpreted "certain amount of cmds" as one command, multiple times

keen mural
#

thx

slate swan
#

What does this mean
AttributeError: 'Role' object has no attribute '_roles'

paper sluice
#

that 'Role' object has no attribute '_roles' ....

slate swan
#

meaning?

paper sluice
#

class.attribute

slate swan
#

does discord.utils.get(ctx.guild.roles, name="everyone") get the ID for the @ everyone role?

#

@paper sluice ?

heavy shard
#

it should be "everyone" with "@" at the beginning

azure scroll
vale wing
#

20th May

visual island
slate swan
#

you can also use the guild id lol

slate swan
#

no?

#

iirc.

#

the everyone role uses the guilds id thats just how discord made it

#
f"<@{Guild.id}>"

e.g

#

why isnt this working

channel1 = discord.utils.get(ctx.guild.roles, name="@everyone")
channel_id = channel1.id
heavy shard
#

channel?

slate swan
#

?

heavy shard
#

shouldn't it be role1 = ...

slate swan
#

wait im so dumb

pallid meadow
#

Unless you can fetch everyone role like that

slate swan
#

I needa get the channel not role id

#

how do I get the channel ID

pallid meadow
#

Umm

#

Well are you trying to hardcode this or

slate swan
#

I guess so

pallid meadow
#

Bc if so you can just copy the channel id from discord and use bot.get_channel(id)

slate swan
#

I want to get the first viewable channel

#

like from the @ everyone role ^

pallid meadow
#

Okay

slate swan
#

so the first channel that everyone can view then I want to get the channel ID of that channel

pallid meadow
#

You would then have to look at the permission overwrites for each channel

#

Check if the guilds default role is allowed in the channel

#

If it is then that’s the first viewable channel.

slate swan
#

How

pallid meadow
#

you need to get the guild object

#

Then you can get the channels with said guild object

slate swan
#

can I see some actual psudeocode

#

my brain is all over the place to visualize this

pallid meadow
#

I’m on mobile right now I can’t really type out code

slate swan
#

can you try? even if the indentation is wrong its all good

#
channel2 = discord.utils.get(ctx.guild.roles, name="@everyone")
channel1 = discord.utils.find(lambda x: x.permissions_for(channel2).send_messages, guild.text_channels)
            
channel_id = channel1.id
#

@heavy shard

heavy shard
#

it's okay, just change channel2 to role for readability

slate swan
#

still saying 'NoneType' object has no attribute 'roles'

heavy shard
#

guild is None? are you doing it in private message?

slate swan
#

in a servers channel

heavy shard
#

is it in a command? can you show the code?

warped mirage
#

Guys can someone help me make a warning system tbf or refer me somewhere

vale wing
#

You get everyone role like this

slate swan
#

im so confused

vale wing
#

!d discord.Guild.default_role

unkempt canyonBOT
slate swan
#

so I do name="default_role"

vale wing
#

ctx.guild.default_role

#

You want the first channel you can send the messages in right?

vale wing
#
channel = discord.utils.find(lambda x: x.permissions_for(ctx.guild.default_role).read_messages, ctx.guild.text_channels)```
Kinda spoonfeeding but since you couldn't fully figure it out by yourself here it is
slate swan
#

I was so close

#

so is my channel2 no longer needed

vale wing
#

Yes

#

It's everyone role and you get it like I showed

slate swan
#

Wtf im still getting
'NoneType' object has no attribute 'text_channels'

vale wing
#

You probably use it in DMs

slate swan
#

im not

vale wing
#

Do you have intents enabled

slate swan
#

are they needed?

vale wing
#

Default ones are I think

warped mirage
#

Guys any good warning systems ?

vale wing
#

!d discord.Intents.guilds

unkempt canyonBOT
vale wing
#

I don't think you need anything more

slate swan
#

now im getting Role' object has no attribute '_roles'

vale wing
#

Full traceback please

slate swan
#

im done with this

vale wing
#

That thing is fixable you probably mistyped something

warped mirage
slate swan
#

its to late for this 🤣

warped mirage
#

I’m using a cog

vale wing
#

@warped mirage do yk how to use databases generally

warped mirage
#

Yes but no at the same time well it’s hard to explain . Do I use 1 database for entire bot ?

vale wing
#

Yes why not

warped mirage
#

I use aiosqlite for my levelling system .

vale wing
#

You can use it for warnings as well

#

Just create another table

warped mirage
#

The actual code tho tbf

#

Idk xd ima think about it

vale wing
#

You mean CREATE TABLE statement?

warped mirage
#

Nah the actual warning system with remove well everything

vale wing
#

Erm

#

The warnings system is in the same bot with the levelling system?

#

Doesn't really matter anyways just execute CREATE TABLE IF NOT EXISTS

#

It is not a destructive action

warped mirage
#

I’m using a cog file atm so ima do basics I guess

vale wing
#

It doesn't really matter do you use cogs or not

warped mirage
#

Like I need the basic of the code

#

guys is this valid for py py guild_id : {member.id: [count, [(admin_id, reason)]]}

desert heart
#

Are you asking if it's syntactically valid Python code?

#

For that, you could just fire up an interpreter and try to execute the code to see if you get a syntax error or not.

warped mirage
#

ok thank u

placid skiff
#

it's valid but it is not the proper way D_D

warped mirage
#

ye its for my warning system

placid skiff
#

var: {type: [type, [(type, type)]]} this one is right, where type are the types of the variables, not the variables themself

slate swan
placid skiff
#

~~Nooo don't ask it ~~ Phoenixchan_crying

slate swan
wet crystal
#

Can someone explain what a converter is and does?
Im having a hard time understanding the docs since I am not native.

placid skiff
placid skiff
loud junco
slate swan
wet crystal
loud junco
loud junco
slate swan
loud junco
#

but they dont even learn sql syntax

#

maybe thats why they are stuck

#

just like those pepo who dont even know print() and they want to build a discord bot

slate swan
loud junco
#

they dont even know any of them

loud junco
#

but they are all gone from here now

#

when they realise its not as easy as importing random packages like what those hacker movie does

heavy shard
#

print("Hello", end=" World!")

loud junco
#

💀

#

but why 🤣

slate swan
loud junco
#

my brain crashed after looking at that

heavy shard
#

hint: deafault end is "\n"

slate swan
loud junco
#

my brain crashed

slate swan
#

sigh

loud junco
#

tons of end is going to mess up everything

#

🤣

loud junco
#

!e
print(end=" World!")

unkempt canyonBOT
#

@loud junco :white_check_mark: Your eval job has completed with return code 0.

 World!
loud junco
#

here u go

#

@uncut portal

uncut portal
#

Cheers, I probably typed it out wrong. I am on my phone

loud junco
#

LOL

#

writing codes on phone is just suffering

heavy shard
#

some people code their bots on a phone

loud junco
uncut portal
loud junco
#

AHEM

slate swan
#

and I swear it wasn't hard

loud junco
uncut portal
#

The keyboard is just clunky for symbols

slate swan
loud junco
#

the whole typing sh!t just faks ur code up

slate swan
loud junco
#

and combine all the line together

slate swan
loud junco
#

for example:

line 1 will goes to the end of line 2 for no reason

#

and line 2 will merge with line 3 and 4 for no reason

slate swan
#

cant argue

#

it made indenting hard but it was fine overall

loud junco
#

and line 5 will be in middle of line 3 for no reason

slate swan
#

not really

loud junco
slate swan
#

non-indenting code....?

loud junco
#

that means

#

tons of print and process but without if statement and loop

slate swan
#

well

loud junco
#

idk what is it call

placid skiff
#

Bruh i spent last Friday tryin' to fix a problem and today I found that there was no problems but the encode I used to read the file was wrong D_D

heavy shard
#

"Roses are red, violets are blue, indented block expected, in line 22"

wet crystal
#
@bot.command()
async def joined(ctx, *, member: discord.Member):
    await ctx.send('{0} joined on {0.joined_at}'.format(member))

What is the " * " for?
(in "joined(ctx, *, member: discord.Member)"

placid skiff
#

I am so freakin blind
I could finish this project like Friday

wet crystal
loud junco
#

💀

placid skiff
#

!d f-string

#

!f-string

#

!f-strings

unkempt canyonBOT
#

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

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

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

placid skiff
#

i did it lel

wet crystal
#

ik what f-strings are

#

im using them all the time

loud junco
wet crystal
#

but what is the * for?

wet crystal
visual island
loud junco
visual island
#

But note that if you type !joined @user test, it will raise MemberNotFound, as discord.py could not convert @user test to an existing member. So, it's better if you don't include the * (except for member nicknames that contains space in it).

wet crystal
#

but why did they show code that returns a error in the docs?

visual island
#

It returns an error for specific cases only, if you try to do !joined @user and @user is a valid mention, it will work.

wet crystal
#

why would I need to do this

await ctx.send(embed=embed)

couldnt I just do this

await ctx.send(embed)

If not, why?

fleet timber
#

!f-variable

#

!f-variables

wet crystal
fleet timber
heavy shard
#

ctx.send(embed) will try to send a text, embed=embed says you want to send an embed
if you want to know details, google for "python positional and keyword arguments"

slate swan
unkempt canyonBOT
#

*args and **kwargs

These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names args and kwargs are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (*). If both are used in a function signature, *args must appear before **kwargs.

Single asterisk
*args will ingest an arbitrary amount of positional arguments, and store it in a tuple. If there are parameters after *args in the parameter list with no default value, they will become required keyword arguments by default.

Double asterisk
**kwargs will ingest an arbitrary amount of keyword arguments, and store it in a dictionary. There can be no additional parameters after **kwargs in the parameter list.

Use cases
Decorators (see !tags decorators)
Inheritance (overriding methods)
Future proofing (in the case of the first two bullet points, if the parameters change, your code won't break)
Flexibility (writing functions that behave like dict() or print())

See !tags positional-keyword for information about positional and keyword arguments

terse coyote
#

how many id can be written in commands.has_role()

#

?

slate swan
#

as many you want

slate swan
#

slow 😔

wet crystal
#

Why is every "code a discord bot in python" tutorial using

@client.event
async def ...():
if ...:
  await message.send(...)
elif ...
  ...

instead of

@bot.command
async def ...(ctx):
  ...
await ctx.send(...)

Is there a major difference?

slate swan
#

they are outdated, using on_message for making commands is bad.

#

and not every "code a discord bot in python" is using that, even the worst ones use @bot.command

paper sluice
#

u also need to call command :p

loud junco
slate swan
#

im kinda curious to see whats inside

wet crystal
slate swan
#

ohmi god, thanks

wet crystal
#

np im always there to help

loud junco
#

🤣

slate swan
#

and I'm seriously scarred...

heavy shard
loud junco
slate swan
#

he just said, "ctx equals to commands.Context" and typehinted ctx using colons

#

😭

slate swan
loud junco
#

LOL

#

i still remember doing this

light violet
#

how to get text input in discord py ui

desert cosmos
#

how do we handle already connected to a channel ?

slate swan
light violet
loud junco
light violet
slate swan
light violet
#

disnake would also work

slate swan
#

!d discord.VoiceClient.is_connected

unkempt canyonBOT
unkempt canyonBOT
#
Naw.

No documentation found for the requested symbol.

slate swan
#

wait uhhh, typos

#

!d discord.ui.TextInput

unkempt canyonBOT
#

class discord.ui.TextInput(*, label, style=<TextStyle.short: 1>, custom_id=..., placeholder=None, default=None, required=True, min_length=None, max_length=None, row=None)```
Represents a UI text input.

str(x)
Returns the value of the text input or an empty string if the value is `None`...
slate swan
#

why does everybody get mad at discord for such reasons lmao

loud junco
slate swan
wet crystal
slate swan
#

I randomly clicked on an aiosqlite video of his, and......imagine connecting to the db every command

heavy shard
#

i prefer written tutorials :S

slim crag
#

how can my bot send a message every time it enters a discord server;

dim sentinel
#

I actually need a reliable tutorial explaining discord.py

#

actually i can't understand what's written in docs

#

so any reliable vid?

loud junco
#

!source

unkempt canyonBOT
wet crystal
#

whats that mean

uncut portal
# heavy shard i prefer written tutorials :S

Depends on the content for me really, when I want to learn anything about rust I would always prefer to go for the rust book over some YouTube tutorial however for python because everything is so over the places and there is nothing created by the python organisation I will either read a realpython article or watch a YouTube video

wet crystal
jade tartan
dim sentinel
#

Is that something I am supposed to understand beforehand?

placid skiff
sullen pewter
#

How to only respond to messages in dms

dim sentinel
slate swan
unkempt canyonBOT
#

discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") or when the
[`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") joins a guild.

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

.

#

@dim sentinel

slate swan
dim sentinel
#

thankssssss

slate swan
wet crystal
#

no problem i asked the same question so i might aswell just give you the sam answer

sullen pewter
#

How to only respond to messages in dms

wet crystal
dim sentinel
slate swan
#

!d discord.ChannelType.private

unkempt canyonBOT
wet crystal
dim sentinel
#

aww man

slate swan
#
if isinstance(current_channel_obj, discord.ChannelType.private):
      ...```
sullen pewter
#

But private

#

Is not dms

slate swan
sullen pewter
#

right?

scarlet spear
#

OH HEY SOMEONE HELP ME

slate swan
scarlet spear
sullen pewter
#

!nickname in dms
bot's response: shut up in dms

slate swan
wet crystal
paper sluice
scarlet spear
#

I tried deleting the message, but the discord bot did not send embed in log the channel

dim sentinel
scarlet spear
paper sluice
slate swan
paper sluice
scarlet spear
slate swan
scarlet spear
#

WAIT

#

it's the same, I tried deleting the message, but the bot did not send any embed to the log channel

wet crystal
scarlet spear
#

it didn't raise any error as well

#
import os
import discord
from discord.ext import commands
from datetime import datetime

client = commands.Bot(command_prefix='-')
white = discord.Color.from_rgb(255,255,255)

class ChannelGetter:
    def __init__(self, id_):
        self.id_ = id_
        self.channel = None
    
    def __get__(self, obj, objtype = None):
        self.channel = self.channel or client.get_channel(self.id_)
        return self.channel

class Channels:
  manager_report = ChannelGetter(978183282824986655)
  mod_report = ChannelGetter(978166822027292702)
  helper_report = ChannelGetter(978168038505476116)

# Log in
@client.event
async def on_ready():
  print("Successfully logged in as {0.user}"
  .format(client))

# Clear
@client.command(aliases = ["clear"])
@commands.has_permissions(manage_messages = True)
async def purge(ctx,amount=2):
  await ctx.channel.purge(limit = amount)

  user = ctx.author
  
  if amount == 2:
    embedsus = discord.Embed(title="Clear Messages | Peace Bot", description=f"The latest message has been deleted from this channel.", color = white)
    await ctx.send(embed=embedsus)
  elif amount == 1:
    emb = discord.Embed(title="Clear Message | Peace Bot", description=f"You have deleted the command you sent.", color = white)
    await ctx.send(embed=emb)
  else:
    embed = discord.Embed(title="Clear Message | Peace Bot", description=f"{amount} messages has been deleted from this channel", color = white)
    await ctx.send(embed=embed)

  repEmbed = discord.Embed(title=f"Clear Messages | Manager System", description=f"Channel: {ctx.channel.mention}\nPurge Amount = {amount}\nRequested by {user.mention}", timestamp = datetime.now(), color = white)

  await Channels.manager_report.send(embed=repEmbed)


# Message delete
@client.event
async def on_message_delete(ctx):
  embed = discord.Embed(title = f"Message Deleted | Moderation System", description = f"Deleted Message: {ctx.content}\nMember: {ctx.author.mention}\nLocation: {ctx.channel.mention}", timestamp = datetime.now(), color = white)

  await Channels.mod_report.send(embed=embed)
  
  

  
bot_token = os.environ['TOKEN']
client.run(bot_token)



#

full code\

slender night
#

What do you want?

scarlet spear
#

here

sullen pewter
scarlet spear
#

it didn't raise any error as well

slate swan
scarlet spear
loud junco
#

💫
😵

slim crag
#

@slate swan thanks

scarlet spear
#

I made a test server u can come and help me

paper sluice
paper sluice
#

so it wont send message

slate swan
scarlet spear
slender night
#

@scarlet spear there is a on_message_delete event in dpy.

scarlet spear
slender night
#

What library are you using?

slate swan
scarlet spear
paper sluice
scarlet spear
slender night
slender night
#

...

scarlet spear
#

MY WHOLE LIFE IS A LIE

slate swan
#

poor ryuga

paper sluice
sullen pewter
scarlet spear
#

I WROTE THAT FOR 1 HOUR AND I CAN JUST WRITE THAT

#

HEY WHAT THE

slender night
sullen pewter
sullen pewter
#

If it was lucas your code is a mistake

slender night
sullen pewter
paper sluice
wet crystal
#
import discord
from discord.ext import commands

TOKEN = "Token"

bot = commands.Bot(command_prefix='*')
client = discord.Client()

@bot.event
async def on_ready():
    print(f'{client} has booted up succesfully!')

@bot.command()
async def vouch(ctx):
    embed=discord.Embed(
        title="Thats the title", description="This is the description", color=0x45b6fe
    )
    channel = bot.get_channel("my channel id")
    await ctx.channel.send(embed=embed)
    
bot.run(TOKEN)

why doesnt this send the embed to the choosen cahnnel?

sullen pewter
#

Learn OOP

slender night
slim crag
wet crystal
#

not the 1 where i commanded in

slender night
#

!d discord.on_message_delete

unkempt canyonBOT
#

discord.on_message_delete(message)```
Called when a message is deleted. If the message is not found in the
internal message cache, then this event will not be called.
Messages might not be in cache if the message is too old
or the client is participating in high traffic guilds.

If this occurs increase the [`max_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") parameter
or use the [`on_raw_message_delete()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_message_delete "discord.on_raw_message_delete") event instead.

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

now this doesn't work

sullen pewter
sullen pewter
paper sluice
slender night
scarlet spear
slender night
#

Can you show me your code

paper sluice
paper sluice
sullen pewter
scarlet spear
slender night
#

Time doesn't matter.

scarlet spear
#

I wrote 700 lines of code

#

and I even write code for schools

slender night
#

It doesn't matter.

sullen pewter
#

Lines don't matter

slender night
#

Concepts matter

scarlet spear
#

and I'm 14 years old too

slender night
sullen pewter
#

age doesn't matter

slender night
#

How dos that matter?

sullen pewter
#

My grandpa writes code he's 78

wet crystal
cloud dawn
#

@sullen pewter, @slender night If you guys don't want to help him don't respond.

scarlet spear
loud junco
scarlet spear
#

here is the error

loud junco
#

im not going to judge

scarlet spear
#
import os
import discord
from discord.ext import commands
from datetime import datetime

client = commands.Bot(command_prefix='-')
white = discord.Color.from_rgb(255,255,255)

manager_report = client.get_channel(978183282824986655)
moderator_report = client.get_channel(978166822027292702)

# Log in
@client.event
async def on_ready():
  print("Successfully logged in as {0.user}"
  .format(client))

# Clear
@client.command(aliases = ["clear"])
@commands.has_permissions(manage_messages = True)
async def purge(ctx,amount=2):
  await ctx.channel.purge(limit = amount)

  user = ctx.author
  
  if amount == 2:
    embedsus = discord.Embed(title="Clear Messages | Peace Bot", description=f"The latest message has been deleted from this channel.", color = white)
    await ctx.send(embed=embedsus)
  elif amount == 1:
    emb = discord.Embed(title="Clear Message | Peace Bot", description=f"You have deleted the command you sent.", color = white)
    await ctx.send(embed=emb)
  else:
    embed = discord.Embed(title="Clear Message | Peace Bot", description=f"{amount} messages has been deleted from this channel", color = white)
    await ctx.send(embed=embed)

  repEmbed = discord.Embed(title=f"Clear Messages | Manager System", description=f"Channel: {ctx.channel.mention}\nPurge Amount = {amount}\nRequested by {user.mention}", timestamp = datetime.now(), color = white)

  await manager_report.send(embed=repEmbed)


# Message delete
@client.event
async def on_message_delete(ctx):
  embed = discord.Embed(title = f"Message Deleted | Moderation System", description = f"Deleted Message: {ctx.content}\nMember: {ctx.author.mention}\nLocation: {ctx.channel.mention}", timestamp = datetime.now(), color = white)

  await moderator_report.send(embed=embed)
  

  
bot_token = os.environ['TOKEN']
client.run(bot_token)



loud junco
#

i learnt python for 3 years and still go back to basic
its called not being ego

scarlet spear
#

my project must be done within this week

slender night
#

Get the channel inside of a function and use await.

cloud dawn
wet crystal
slender night
cloud dawn
loud junco
scarlet spear
#

ok now the clear functions work, but the delete message log doesn't work, it didn't show any error as well

#
import os
import discord
from discord.ext import commands
from datetime import datetime

client = commands.Bot(command_prefix='-')
white = discord.Color.from_rgb(255,255,255)

# Log in
@client.event
async def on_ready():
  print("Successfully logged in as {0.user}"
  .format(client))

# Clear
@client.command(aliases = ["clear"])
@commands.has_permissions(manage_messages = True)
async def purge(ctx,amount=2):
  await ctx.channel.purge(limit = amount)

  user = ctx.author
  manager_report = client.get_channel(978183282824986655)
  
  if amount == 2:
    embedsus = discord.Embed(title="Clear Messages | Peace Bot", description=f"The latest message has been deleted from this channel.", color = white)
    await ctx.send(embed=embedsus)
  elif amount == 1:
    emb = discord.Embed(title="Clear Message | Peace Bot", description=f"You have deleted the command you sent.", color = white)
    await ctx.send(embed=emb)
  else:
    embed = discord.Embed(title="Clear Message | Peace Bot", description=f"{amount} messages has been deleted from this channel", color = white)
    await ctx.send(embed=embed)

  repEmbed = discord.Embed(title=f"Clear Messages | Manager System", description=f"Channel: {ctx.channel.mention}\nPurge Amount = {amount}\nRequested by {user.mention}", timestamp = datetime.now(), color = white)

  await manager_report.send(embed=repEmbed)


# Message delete
@client.event
async def on_message_delete(ctx):

  moderator_report = client.get_channel(978166822027292702)
  
  embed = discord.Embed(title = f"Message Deleted | Moderation System", description = f"Deleted Message: {ctx.content}\nMember: {ctx.author.mention}\nLocation: {ctx.channel.mention}", timestamp = datetime.now(), color = white)

  await moderator_report.send(embed=embed)
  

  
bot_token = os.environ['TOKEN']
client.run(bot_token)



#

full code above^^^

paper sluice
cloud dawn
#

Shrey try'na slide

scarlet spear
#

YES THANK YOU I LOVE U\

slender night
#

Whart

paper sluice
wet crystal
sullen pewter
#

I kill

paper sluice
#

ctrl+c or just close the tab

loud junco
cloud dawn
#

Shutdown pc

loud junco
#

💀

paper sluice
#

burn the pc

sullen pewter
supple thorn
slender night
supple thorn
#

If you really want to make sure

loud junco
cloud dawn
sullen pewter
#

definitely

loud junco
cloud dawn
loud junco
wet crystal
wet crystal
sullen pewter
#

is the way to go

loud junco
paper sluice
wet crystal
loud junco
wet crystal
cloud dawn
#

🔫

loud junco
#

alright stop already
its getting ot

heavy shard
#

try sand in cogs

loud junco
#

just throw away this pc and buy a new one
it will stop the bot

sullen pewter
wet crystal
cloud dawn
#

ot intensifies

slate swan
#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

scarlet spear
#

@slate swan can u come into my DM

loud junco
wet crystal
slate swan
supple thorn
#

Lmao

sullen pewter
#

💀

loud junco
scarlet spear
supple thorn
cloud dawn
scarlet spear
sullen pewter
slate swan
loud junco
wet crystal
loud junco
#

we told him to throw away the pc
and shut down the pc

cloud dawn
supple thorn
loud junco
sullen pewter
scarlet spear
dull terrace
#

I'm doing the verification process, how long does discord expect you to store data?

wet crystal
dull terrace
wet crystal
wet crystal
scarlet spear
slate swan
cloud dawn
dull terrace
slate swan
cloud dawn
dull terrace
#

not sure what it is for things like IDs

loud junco
slate swan
#

anyways bai bai, i got an exam

wet crystal
paper sluice
loud junco
slate swan
#

thankee

supple thorn
#

Hello ashley

loud junco
#

what exam
school?

supple thorn
#

Bye ashley

wet crystal
paper sluice
scarlet spear
loud junco
paper sluice
#

nice

loud junco
#

:D

supple thorn
#

Oh that's why

scarlet spear
#

Hello

supple thorn
#

Jotqiane

paper sluice
wet crystal
supple thorn
paper sluice
wet crystal
# supple thorn No

Everything about your account tells me your serious

Name: CokeCane
About me:
🤸‍♀️

🦽 🏌️‍♂️

well...

wet crystal
wet crystal
#

CokeCane

#

lol

supple thorn
#

Technically iamSkev

loud junco
#

my bio is cringe

paper sluice
#

shit ur 14, u didnt see anything .....

loud junco
loud junco
supple thorn
paper sluice
loud junco
supple thorn
loud junco
#

eh no

#

its ducky all the time

supple thorn
#

My avatar has been the same one for 4 years

loud junco
#

LOL

#

sarth is here
hihihi

slate swan
#

!sf 381799048228896788

unkempt canyonBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

slate swan
loud junco
#

why cokecane

#

and what is !sf

wet crystal
slate swan
#

sf means snowflake

loud junco
#

huh

slate swan
#

you can get the creation datetime of a object using its snowflake ( i.e. its ID)

loud junco
slate swan
unkempt canyonBOT
#
No way, José.

No documentation found for the requested symbol.

loud junco
#

🤣

slate swan
#

eh

#

was it discord.Snowflake?

loud junco
#

how i know

#

🤣

dull terrace
#

this good?

loud junco
#

no lemme write it for u

dull terrace
#

but this is discords policy 7739monkathink

loud junco
#

if you dont use this app for one year, I will remove you from this entire database that you will never be able to join again or create again. If you try to use an alt to create, I will get your ip and ip ban you

dull terrace
#

can i get some mod controls to ip ban you hydro

jade tartan
loud junco
loud junco
#

is there free hosting that u dont get rate limited

#

except hosting with pc

cloud dawn
#

I think the only bot that doesn't have ratelimit is Clyde.

loud junco
#

?

cloud dawn
#

Well you asked for a hosting that doesn't have ratelimit.

#

That just doesn't exist.

loud junco
#

but clyde is a bot

loud junco
#

u will get rate limited even on vps?

cloud dawn
dusky pine
#

every bot will get rate limited

#

it isn't even related to bots; it's the API

slate swan
#

I'm creating a slash command, and once the bot is started, is it possible to change the choices in an argument in a command?

loud junco
#

how rate limited works tho

dusky pine
sullen pewter
#
nickname = input()
print(nickname)```
How to do this in dpy
dusky pine
loud junco
#

he wants input

sullen pewter
#

yes

dusky pine
#

like, ask the user and wait for a response?

loud junco
sullen pewter
#

like
nickname:lil s

loud junco
#

AHEM

sullen pewter
#

yes

sullen pewter
loud junco
slate swan
#

!d discord.Client.wait_for

loud junco
slate swan
#

What's the best way of reloading a slash command without restarting the bot?

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way...
slate swan
sullen pewter
#
@client.command()
async def sync(ctx):
  await client.tree.sync(guild=discord.Object(id=844747238445023242))
  await ctx.message.delete()
  print("Synced!")```
dull terrace
#

Does waiting for verification stop bot invites if you hit 100 if you need none of the intents?

sullen pewter
#

@slate swan

slate swan
slate swan
sullen pewter
#

It updates slash commands

sullen pewter
slate swan
#

if its discord-py-slash-comamnds im out

#

alright, lemme see the docs

dull terrace
#

My bot is at 85 servers after 7 days and im pretty sure it's gonna hit 100 before they get back to me with verification 7739monkathink

sullen pewter
#

like:

#

bot: What would you like your nickname to be?
user: nickname

slate swan
slate swan
jade tartan
slate swan
#

every Library has its own way of doing this so idk, Haven't used pycord/any discord.py related library in months

sullen pewter
slate swan
slate swan
sullen pewter
#

yes

#

seen them 5+ times

slate swan
slate swan
sullen pewter
#

I just want bot to get users nickname after bot sends a message but if the bot doesn't the command won't work

slate swan
#

well

sullen pewter
#

Is it impossible?

slate swan
#
try :
   event = await bot.wait_for("event name")
except asyncio.TimeoutError:
    # the event was not triggered
``` you recieve messages with on_message event so "message" would be the event name here
sullen pewter
#

ty

slate swan
#
await commands.sync_commands(["MyCommand"])
await commands.reload_extension("MyCog")
```Ìs this right if I want to reload one command?
#

no

dull terrace
#

My bot already got verified eyesintensify like 20 mins after i submitted request

#

love discord

loud junco
#

i still need to wait for another 7 months

slate swan
# slate swan no

reload the cog first, then use commandw.sync_comammds, which takes ApplicationCommand objects as arg

dull terrace
#

they must prioritise based on growth speed

dull terrace
loud junco
#

im 16 but im december boi

paper sluice
loud junco
#

im still underage

dusky pine
#

@dull terrace

Finished my new bot, link in about me!
you don't have an about me 😔

paper sluice
dusky pine
dusky pine
#

ion see it

slate swan
dull terrace
#

does that not show?

dusky pine
#

no not for me

#

lemme refresh

dull terrace
#

weird

dusky pine
#

still doesn't show

loud junco
loud junco
loud junco
slate swan
loud junco
#

now my bot is in 100 server

#

im technically not 16 yet

slate swan
#

If you got some trustable friend who's older than 16 you can transfer the ownership to them and they can verify

robust fulcrum
#

Guys do anyone know how can we use perresoctive api in discord. Py
There is no tutorial so i asking here

shrewd apex
slate swan
#

well then grow up

robust fulcrum
loud junco
#

waiting for 7 months

shrewd apex
robust fulcrum
flint isle
#

what are the messages that are hidden to other users and are just one user called again

placid skiff
#

uhm do you mean ephemeral message?

flint isle
#

yes lmao. can you call the disnake doc using the bot?

robust fulcrum
#

Do message components work in ctx?

flint isle
#

what components do you mean

placid skiff
#

!d disnake.ApplicationCommandInteraction.send

unkempt canyonBOT
#

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

Sends a message using either [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message") or [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").

If the interaction hasn’t been responded to yet, this method will call [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message"). Otherwise, it will call [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").

Note

This method does not return a [`Message`](https://docs.disnake.dev/en/latest/api.html#disnake.Message "disnake.Message") object. If you need a message object, use [`original_message()`](https://docs.disnake.dev/en/latest/api.html#disnake.ApplicationCommandInteraction.original_message "disnake.ApplicationCommandInteraction.original_message") to fetch it, or use [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send") directly instead of this method if you’re sending a followup message.
robust fulcrum
#

Bruh buttons

placid skiff
#

!d disnake.InteractionResponse.send_message or generally this

unkempt canyonBOT
#

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

Responds to this interaction by sending a message.
flint isle
#

um... i added another slash command to my disnake bot and all of the slash commands dissapeared

slate swan
quaint epoch
#

im 13

slate swan
#

I'm 14

quaint epoch
#

don't tell anyone, but i made a discord account, 7 days before my b day on Oct 21st where i turned 13

#

shhhh

flint isle
#

im 18 now lol

slate swan
slate swan
#

😐

slate swan
trail agate
slate swan
#

imagine

loud junco
slate swan
#

i just finished school

#

No way

#

lol

#

Ash told that ur 13-14

#

im not

#

im older lol

#

..

#

im 15🧍

#

Bday date?

#

jan 24

loud junco
#

finished ||primary|| school

slate swan
#

Wait 11 actually

#

ash just says im a child cuz shes 16😔

loud junco
#

WHAWHAHWAWA

slate swan
#

Weird

loud junco
#

u r also a child to me then

slate swan
loud junco
#

hi child

slate swan
#

the audacity in this chat 😔

loud junco
#

we are protecting u ||from nothing||

slate swan
#

wow, thank you

loud junco
#

np

#

😉

slate swan
#

😐

#

🙏

loud junco
slate swan
#

😮‍💨

flint isle
#

how can i kill a bot instance thats on my other system since im not home rn

scarlet spear
#

are u the ashley in my class?

#

I didn't know u have discord

#

u said u only use iMessage

robust fulcrum
#

Guys can anyone help me make that bot deletes bad words using perresoctive api
Pls help

jagged adder
#

hiya yall, im currently trying to work out how to run different instances of my bot on 2 diff servers. ie, so inputs on one wont interact with story progression on the other server. any help would be much appreciated!

flint isle
maiden fable
flint isle
#

but dont ask me XD cause idk how it works or how to

jagged adder
#

from what i could find sharding is usually only necessary for large numbers of servers (or guilds i think is the other name for servers)

jagged adder
#

if anyone here knows about creating multiple instances of a bot that run independent of each other on different servers, some help/experience would be much appreciated

maiden fable
#

Auto sharded bot

jagged adder
#

so i will need to set up sharding?

slate swan
#

"auto" 🚶‍♂️

maiden fable
#

Just change commands.Bot to commands.AutoShardedBot

slate swan
#

!d discord.ext.commands.AutoShardedBot

unkempt canyonBOT
#

class discord.ext.commands.AutoShardedBot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
This is similar to [`Bot`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") except that it is inherited from
[`discord.AutoShardedClient`](https://discordpy.readthedocs.io/en/latest/api.html#discord.AutoShardedClient "discord.AutoShardedClient") instead.
slate swan
#

use this class... as hunter said

flint isle
maiden fable
#

Stop button....?

slate swan
flint isle
#

nope never heard of it

slate swan
#

or just reset the token ;-;

maiden fable
#

If u use an eval, just do !eval exit()

jagged adder
slate swan
flint isle
maiden fable
#

Reset the token @flint isle

slate swan
flint isle
#

ok lmao

#

hmm how do i add eval while im at it?

slate swan
#

for me, i use jishaku
its a discord.py debugging extension

#

!pip jishaku

unkempt canyonBOT
cloud dawn
unkempt canyonBOT
#

@cloud dawn :x: Your eval job has completed with return code 1.

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

sys.exit() 🚶‍♂️

flint isle
#

hmm would that break if i use disnake...

jagged adder
slate swan
unkempt canyonBOT
slate swan
jagged adder
#

soz for what might seem obvious lol

#

ah ok

minor totem
slate swan
#

oh i didnt see that message, that has something to with blocking functions

cloud dawn
slate swan
#

!blocking @jagged adder

unkempt canyonBOT
#

Why do we need asynchronous programming?
Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.

What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:

import discord

# Bunch of bot code

async def ping(ctx):
    await ctx.send("Pong!")

What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.

async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!

minor totem
#

This is not an issue with blocking either

flint isle
#

lol i had issues with multiple bot instances because apparently i accadentally deleted my logoff command

jagged adder
minor totem
#

It might, it might not, it depends on how discord.py decides to create the shards.

jagged adder
#

or that creating a seperate instance wont fix the issue of the code pulling inputs from server 1

minor totem
#

Sharding is not about several bot instances, it's about several connections. If you have a variable you store on the cog, that will still be shared.

ripe blaze
#

I know it may be a dumb question, but do I need to register app commands?

minor totem
#

Which library are you using?

ripe blaze
#

discordpy

green bluff
ripe blaze
#

yeah

cloud dawn
minor totem
#

Then yes, you need to sync the command tree

green bluff
#

You would have to use the tree.sync attribute of client / bot

cloud dawn
#

You only need to manually sync with dpy other forks have auto syncing.

green bluff
#

because forks are more complicated to learn and the help you can receive is minimal

minor totem
#

I'd disagree? thinkmon

cloud dawn
maiden fable
unkempt canyonBOT
#

quit(code=None)``````py

exit(code=None)```
Objects that when printed, print a message like “Use quit() or Ctrl-D
(i.e. EOF) to exit”, and when called, raise [`SystemExit`](https://docs.python.org/3/library/exceptions.html#SystemExit "SystemExit") with the
specified exit code.
cloud dawn
forest parcel
#

Ok I'm making a discord bot message that tells the numbers in a users message if it starts with %ecofnum. Now whenever I type something like "%ecofnum 22". The bot stutters. What I mean is the bot says 2 and then 22. Here's the code:

robust fulcrum
#
   if age1 > 18:
                age2 = adult
        else age2 = adolscent

Guys i am getting an error will anyone help me fix?

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

ripe blaze
minor totem
cloud dawn
jade tartan
minor totem
jade tartan
#

or assign automatic roles

#

to the user

forest parcel
minor totem
cloud dawn
minor totem
#

Yeah why is there a loop haha

jade tartan
cloud dawn
jade tartan
#

Do i need to use discord utils?

wraith lion
#

hello do anyone know any meme api

cloud dawn
#

!e ```py
content = "%ecofnum 22"
string = ""

for x in content:
if x.isdigit():
print(f"Found {x}, appending to content")
string = string + x
print(string)

unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

001 | Found 2, appending to content
002 | 2
003 | Found 2, appending to content
004 | 22
wraith lion
#

!e print("hello world")

unkempt canyonBOT
#

@wraith lion :white_check_mark: Your eval job has completed with return code 0.

hello world
forest parcel
#

wait

cloud dawn
#

@forest parcelWith this visualization, do you see why it says 2 then 22?

green bluff
forest parcel
cloud dawn
wraith lion
#

oh.

forest parcel
#

i just reused this code for discord

cloud dawn
cloud dawn
forest parcel
#

FINALLY I GET IT

#

thnx it works now

cloud dawn
#

👍

forest parcel
#

now time to add strings to the send message

cloud dawn
#

🥳

green bluff
#

Ah the satisfaction of helping :D

loud junco
#

anyone wanna try my bot?

dusky pine
loud junco
forest parcel
loud junco
#

nono

#

remove the %

cloud dawn
unkempt canyonBOT
#

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

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

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

dusky pine
loud junco
#

:D

green bluff
loud junco
#

u need f in front of ' '

loud junco
green bluff
#

Yeah its just a bad practice

cloud dawn
#

print even allows seperation by comma.

green bluff
cloud dawn
#

!e print("Hello world", ":)")

unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

Hello world :)
slate swan
#

How to reload a single command using sync_commands?

green bluff
#

That’s new

cloud dawn
slate swan
slate swan
green bluff
slate swan
#

Ah

cloud dawn
slate swan
#

🚶‍♂️ yea, i asked them to reload the cog first

slate swan
cloud dawn
#

Yeah okay.

slate swan
#

then you gotta reload the cog and sync too

slate swan
cloud dawn
#

Tbh i just restart my script, I use Client.

slate swan
#

you need to reload first~

cloud dawn
slate swan
#

and your args arent correct

slate swan
slate swan
cloud dawn
#

Let's see "slash" commands as a placeholder.

slate swan
#

how would the bot know that what changes have been made?

#

the command state is still at the old one

cloud dawn
slate swan
#

and they are not restarting the bot*

cloud dawn
#

You can change the code and not re-sync the commands.

#

Since they aren't related. If you change any args/ kwargs/ names/ descriptions however you need to re-sync.

slate swan
# cloud dawn No since it's reloaded afterwards.
# before
@commands.slash_command()
async def command(ctx, arg: str):
  ...
# after
@commands.slash_command()
async def command(ctx, arg: discord.Member):
  ...
``` so you can simply sync the bot app commands before loading the #after part?
cloud dawn
slate swan
#

which is different from other args

cloud dawn
#

That's why slash is very gut, but they still need to add extra typehints.

#

Allow regex.

slate swan
#

a channel typehint for instance

cloud dawn
#

We. Want. Regex

#

Imagine how small bots can be if you could pass regex for input checking...

vocal plover
#

issue with regex is that it can be massively cpu intensive

#

but yeah it would be nice to have

dusky pine
#

vcokltfre u havent changed your status

cloud dawn
#

Not that many people will use regex.

dusky pine
cloud dawn
#

Mine's pretty solid year as well.

cloud dawn
#

Had to check sorry.

robust fulcrum
#

Anyone here know how to add buttons to message in discord.py?

#

I tried many tutorials but they not worked

potent spear
stray carbon
#

is there the event in nextcord
on_slash_command or on_command is for slash cmds too?

vale wing
vale wing
#

And make sure you have 2.0 installed

jagged adder
#

i want to have a class of 'items' which are basically set to true or false statements. how would i go about printing only those shown as true as a line of text? suspect it has something to do with string but could use some help

vale wing
#

!e

a = True
print("yes" if a else "no")```
unkempt canyonBOT
#

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

yes
vale wing
#

This?

potent spear
#

seems more like a list comprehension issue to me

#

[shit for shit in shitlist if shit]

jagged adder
#

im trying to create an 'inventory' of sorts, where i have the items in said inventory and only print those which are active at the time

vale wing
#

Well I couldn't understand from his explanation

potent spear
#

list comp it seems

vale wing
#

Yes

cloud dawn
oblique laurel
jagged adder
potent spear
oblique laurel
#

Lol

vale wing
# jagged adder wdym?

You want to filter out the items that are active and convert the list to string or smth

oblique laurel