#discord-bots

1 messages · Page 842 of 1

sick birch
#

it didn't find the channel then

#

also i suggest typehint channel to discord.TextChannel

#

like:

@bot.command(...)
async def slowmode(ctx, args, channel: discord.TextChannel):
  ...
#

that way if channel is None then use ctx.channel

#
@bot.command(...)
async def slowmode(ctx, args, channel: discord.TextChannel):
  channel = channel or ctx.channel
  # do whatever with channel
boreal ravine
#

bad code

final iron
sick birch
#

Not a problem we're working on fixing it

boreal ravine
#

definitely

sick birch
#

I'm seeing a lot of type-uncertainty, meaning you think a variable is a certain type when its not

maiden fable
#

Who knows ¯_(ツ)_/¯

sick birch
#

no, oldsm will be an integer, args will be a string

maiden fable
#

I ain't really following it's development, both figuratively and literally

sick birch
#

so you're basically trying to do:

5 + "+5"
#

well you need them to be integers

#

otherwise you can't do math on it

#

and you won't be able to do int(args) either

#

actually

#

!e

print(int("+5"))
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

5
sick birch
#

o actually this might be good

#

!e

print(int("-5"))
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

-5
sick birch
#

this is good, typecast args to int in your function definition

#

then add whatever that is (regardless of sign) to the old slowmode

#
@bot.command(...)
async def slowmode(ctx: commands.Context, channel: discord.TextChannel, time: int):
  channel = channel or ctx.channel
  # set slowmode to channel.slowmode_delay + time
autumn trench
#

im trying to react the 🎲 to a message, but i keep getting an "unknown emoji" error

#
message = await ctx.send(f'Your roll is: {random.randrange(range)}')
    await message.add_reaction("<:game_die:>")
#

am i giving it the wrong emoji name?

quick gust
#

remove the <>

sick birch
autumn trench
#

so it works for custom, but not discord emotes? nikothink

quick gust
sick birch
#
add_reaction('🎲')
quick gust
#

but without the <> since its not a custom emoji

sick birch
#

let me check if you can because i don't remember

pliant gulch
#

\:emojiname: to get the unicode char for it and you can just copy paste that in

quick gust
#

just :game_die: should work

quick gust
#

or yeah, you can also get the unicode

autumn trench
quick gust
autumn trench
#

i wonder why :game_die: didnt hmmtera

slate swan
sick birch
#

From the docs,
In case you want to use emoji that come from a message, you already get their code points in the content without needing to do anything special. You cannot send ':thumbsup:' style shorthands.

#

yeah I don't think it likes multi line like that

autumn trench
#

well, thanks for the help! nikoThumbsUp

pliant gulch
autumn trench
#

i have a new problem nikoNervous

sick birch
#

let's hear it

quick gust
autumn trench
#

im trying to make a dice rolling command, which is what y'all just helped me with

#
@slash.slash(name='roll',description='Roll a dice, click on the button when you want to finalize your roll.',guild_ids=[917640265475440681])
async def _003(ctx,range : int):
    message = await ctx.send(f'Your roll is: {random.randrange(range)}')
    await message.add_reaction("🎲")

    def check(reaction, user):
        return user == ctx.author and str(reaction.emoji) in ["🎲"]
        # This makes sure nobody except the command sender can interact with the "menu"

    while True:
        message = await message.edit(f'Your roll is: {random.randrange(range)}')
        try:
            reaction, user = await bot.wait_for("reaction_add", timeout=60, check=check)
```the goal is to have it so that the user clicks on the emote to stop the message from rolling, but im getting this error: `TypeError: SlashMessage.edit() takes 1 positional argument but 2 were given`
sick birch
#

you don't need to check +/-

#

int() will automatically make it a positive or negative integer

#

just add that since a positive + a positive is normal addition, positive + negative is subtraction so it works out perfectly for us

#

i see

slate swan
#

this is unicode?

slate swan
#

huh

sick birch
#

can we see the code?

autumn trench
#

thank you

sick birch
#

did that fix it?

autumn trench
#

i didnt get an error shrug

sick birch
autumn trench
#

i think i just need to have it wait a bit before it changes the number

sick birch
#

that first if statement won't work

#

"+" or "-" will always be true

#
if args.startswith("-") or args.startswith("+")
#

!e

print("+" or "-")
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

+
sick birch
#

it'll always be plus so it will never subtract

#

nah i understand where you're coming from though

#

since it's close to english, if args startswith plus or minus

#

unfortunately it's if args startswith plus or args startswith minus

#

also you can reduce

    if not channel:
      achannel = ctx.channel
    else:
      achannel = channel

to one line:

channel = channel or ctx.channel
#

and instead of

@bot.command(aliases=['sm'])
async def slowmode(ctx, args: str, channel: disnake.TextChannel=None):
  change = int(args)

you can do

@bot.command(aliases=['sm'])
async def slowmode(ctx, args: int, channel: disnake.TextChannel=None):
autumn trench
sick birch
#

oh that's unfortunate

sick birch
#

won't work for our purposes

autumn trench
#

i dont think i'll be able to change the message fast enough for it to be a real roll

sick birch
#

if it starts with +/- then int(args)

autumn trench
#

plus the wait_for check wasnt working cryloaf

sick birch
#
@bot.command(aliases=['sm'])
async def slowmode(ctx, args: str, channel: disnake.TextChannel=None):
  channel = channel or ctx.channel
  if args.startswith("-") or args.startswith("-"):
    change = int(args)
    # do stuff
  else:
    change = int(args)
    # do stuff
``` @slate swan
jade tartan
#

Please?

pliant gulch
#

Otherwise you'd be setting negatives

sick birch
sick birch
#

figure out what the change would be and if it's less than 0 set it to 0

frank tartan
#

how can i restart my bot by doing something like !restart

umbral night
#

@client.has_permissions(manage_channels=True)
AttributeError: 'Bot' object has no attribute 'has_permissions'

#

how do i fix this

frank tartan
umbral night
#

sorry im tired

slate swan
#

f what datatype is a channel if i want to take it as an option in slash commands

frank tartan
#

how can i restart my bot by doing something like !restart

jade tartan
#

Can i dm you?

supple thorn
umbral night
#

from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'channel'

#

fixed it

#

im stupid

jade tartan
#

I want it to where itll create a profile like this one give me one minute ill show u a screenshot

umbral night
#

nvm broke it again

jade tartan
#

like this @supple thorn

umbral night
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'channel'

how do i fix this

sullen plaza
supple thorn
jade tartan
#

Nah am way shorter but thats not the case rn

umbral night
#

u live in new zealand?

jade tartan
#

Yes

umbral night
jade tartan
#

How do u know?

umbral night
supple thorn
#

You're a female named thomas?

umbral night
#

you kind of leaked it

jade tartan
#

Nope i actually did that by accident

#

but yk am getting dms from guys tho

hasty axle
#

hey guys i needed help again. So i want to make a command which can only be used every 15 minutes how do i do that?

jade tartan
#

thinking i am female

umbral night
jade tartan
#

import commands because your running ur command

umbral night
#

oh

#

import os
import discord
from discord.ext import commands
import asyncio

supple thorn
umbral night
#

already have it?

hasty axle
supple thorn
#

Fuck i forgot the tag

jade tartan
umbral night
jade tartan
#

Did you mention the channel?

umbral night
jade tartan
umbral night
#

wdym

supple thorn
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/master/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/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.

A command can only have a single cooldown.
umbral night
#

just make an embed

#

add fields or inline=false

jade tartan
#

Could you help me with one?

hasty axle
jade tartan
#

so i can continue it

supple thorn
jade tartan
#

?

umbral night
#

ah

#

yeah i dont know how to do that rn

#

still learning

#

@supple thorn

#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'channel'```
#

i get this error when i try run my lock command

supple thorn
broken cave
umbral night
# supple thorn Whats your code
@client.command()
@commands.has_permissions(manage_channels=True)
async def lock(self, ctx, *, reason='none'):
  channel = ctx.channel
  overwrite = channel.overwrites_for(ctx.guild.default_role)
  overwrite.send_messages = False
  await channel.set_permissions(ctx.guild.default_role, overwrite=overwrite)

  embed=discord.Embed(title=f'locked', description=f'reason: {reason}')

  await channel.send(embed=embed)```
unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

umbral night
#
# lock channel command
@client.command()
@commands.has_permissions(manage_channels=True)
async def lock(self, ctx, *, reason='none'):
  channel = ctx.channel
  overwrite = channel.overwrites_for(ctx.guild.default_role)
  overwrite.send_messages = False
  await channel.set_permissions(ctx.guild.default_role, overwrite=overwrite)

  embed=discord.Embed(title=f'locked', description=f'reason: {reason}')

  await channel.send(embed=embed)
#

oh cool, always wondered how to do that

broken cave
supple thorn
#

Looking at the client.command() decorator its not in a cog

supple thorn
umbral night
#

omfg

#

i need to go to bed

supple thorn
#

Do you mean like the soccer game in dank memer's work command?

supple thorn
broken cave
umbral night
#
# lock channel command
@client.command()
@commands.has_permissions(manage_channels=True)
async def lock(ctx, *, reason='none'):
  channel = ctx.channel
  overwrite = channel.overwrites_for(ctx.guild.default_role)
  overwrite.send_messages = False
  await channel.set_permissions(ctx.guild.default_role, overwrite=overwrite)

  embed=discord.Embed(title=f'locked', description=f'reason: {reason}')

  await channel.send(embed=embed)

can somebody simplify this for me please

broken cave
#

help me bitches

jade tartan
broken cave
#

bruh

supple thorn
#

But nevermind

broken cave
#

ok i didn't know that

#

im impatient

umbral night
#

make it shorter if possible

broken cave
#

help me :(

umbral night
#

im still learning dpy

umbral night
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.

umbral night
#

help yourself

#

🙂

broken cave
#

fuck off

umbral night
#

bruh what

broken cave
#

dude why can't you elaborate

umbral night
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.

broken cave
#

all these mfs lead to errors

umbral night
#

all the elaboration you'll need

broken cave
#

the fuck man

slate swan
#

watch your language kiddo

broken cave
#

I do

#

but i can't help my madness

slate swan
#

to bad sounds like a you problem

#

Hey. How do I make the bot send specific messages (e.g. NSFW materials) on NSFW channels only? I tried reading the Documentation but I can't figure out anything.

#

we like to keel it civil here

broken cave
#

bruh

#

ok now help me

torn sail
unkempt canyonBOT
#

@discord.ext.commands.is_nsfw()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the channel is a NSFW channel.

This check raises a special exception, [`NSFWChannelRequired`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NSFWChannelRequired "discord.ext.commands.NSFWChannelRequired") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`NSFWChannelRequired`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NSFWChannelRequired "discord.ext.commands.NSFWChannelRequired") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure"). DM channels will also now pass this check.
broken cave
#

HELP ME

#

HELP ME

#

:c

slate swan
#

no one here is forced to help you yk

supple thorn
broken cave
umbral night
slate swan
supple thorn
slate swan
#

lol

supple thorn
#

@umbral night she has what you need

broken cave
supple thorn
slate swan
#

LMAO

broken cave
#

why

umbral night
broken cave
#

uwu

#

Ok nevermind

slate swan
# umbral night how

useless variable better type hints return types no need for embed class instances etc if youre going by memory optimization

weary sierra
#

How to fix?

slate swan
umbral night
# slate swan useless variable better type hints return types no need for embed class instance...

can u simplify it the best u can for me please lol

# lock channel command
@client.command()
@commands.has_permissions(manage_channels=True)
async def lock(ctx, *, reason='none'):
  channel = ctx.channel
  overwrite = channel.overwrites_for(ctx.guild.default_role)
  overwrite.send_messages = False
  await channel.set_permissions(ctx.guild.default_role, overwrite=overwrite)

  embed=discord.Embed(title=f'locked', description=f'reason: {reason}')

  await channel.send(embed=embed)
weary sierra
#

I barely know python idk what a int is

slate swan
#

a solid number is an int a decimal is a float

weary sierra
#

How do I fix it

slate swan
#

!e

print("lol"[1])
unkempt canyonBOT
#

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

o
slate swan
#

python counts from 0

broken cave
#

how do i convert js code to py

slate swan
#

doubt you can

#

thats like changing a person to another person

#

you cant theyre both unique

slate swan
# torn sail !d discord.ext.commands.is_nsfw

I tried using it like this but it doesn't send any in both SFW and NSFW channels. What did I do wrong?

@bot.command()
async def nsfw(ctx):
  if discord.ext.commands.is_nsfw() == True:
    ctx.send("NSFW material URL")
  else:
    return
#

Sorry, I'm still a beginner.

slate swan
#

Oh wait.

umbral night
#

if discord.ext.commands.is_nsfw

slate swan
#

My code didn't have any typo. But it still didn't worked.,

#

reason 1 lol

torn sail
slate swan
#

decos are functions.

#

I mean, those things that you put "@" in front?

#

yes

#

those are decorators which are functions

#
def deco():
    def method():
        ...

is how theyre done

#

Oh ok ok. Thanks.

pliant gulch
umbral night
#

how do you specify a role

slate swan
umbral night
slate swan
#

get it? or

pliant gulch
#

Decorators are basically just syntactic sugar for deco(args)(wrapped)

slate swan
umbral night
#

(ctx.guild.default_role) instead of this, how could I specify a role ive created

umbral night
slate swan
slate swan
unkempt canyonBOT
#
NEGATORY.

No documentation found for the requested symbol.

slate swan
#

Lmao

umbral night
#

f

slate swan
#

!d discord.Guild.get_role

unkempt canyonBOT
umbral night
#

where do i put the role id?

#

after the slash?

slate swan
#

inside the methods params

slate swan
umbral night
#

ah ok

slate swan
#

/ makes all arguments before it positional

umbral night
#

what

slate swan
#

just like * which makes all arguments after keyword

umbral night
#

lmao

#

so do i replace role_id with the id?

slate swan
#

yes

umbral night
#

im so confused

#

oh ok

slate swan
#

its an example

#

and it will always return none if you add a string aka you do "1234567890"

umbral night
#

is a string something you put in quotes?

slate swan
#

or would that raise an error as a bad arg im not sure

slate swan
umbral night
#

ohhhhhh

umbral night
#

just the plain id

slate swan
#
role = discord.Guild.get_role(role_id)
'''Role id should be an integer (aka without quotes)'''
slate swan
umbral night
#

ty both sm

slate swan
#

so he wouldnt get confused

slate swan
#

🏃‍♂️ why bot instance tho?

#

gosh im an idiot no you dont need it

umbral night
#
overwrite = channel.overwrites_for(ctx.guild.default_role)
slate swan
#

it accepts a guild obj jeez ashley correct me😖

umbral night
#

wait sorry

slate swan
umbral night
#
@client.command()
@commands.has_permissions(manage_channels=True)
async def lock(ctx, *, reason='none'):
  channel = ctx.channel
  overwrite = channel.overwrites_for(ctx.guild.default_role)
  overwrite.send_messages = True
  await channel.set_permissions(ctx.guild.default_role, overwrite=overwrite)

  embed=discord.Embed(title=f'locked', description=f'reason: {reason}')

  await channel.send(embed=embed)
slate swan
umbral night
#

instead of the default role

slate swan
#

ctx.guild would be a discord.Guild object.

#

yup

umbral night
#

OH

slate swan
#

basic oop

#

🥂 really recommended to learn some OOP before trying bots

#

and async programming :(

umbral night
#

so like this?

(ctx.guild.get_role(role_id))
slate swan
#

without the extra parenthesis

#

if its just raw

#

yes that would work, role_id must be an integer

slate swan
#

@slate swan long timeeeee

umbral night
#

what is that

slate swan
#

Brackets

slate swan
umbral night
#

oh

slate swan
umbral night
#
(ctx.guild.get_role1234567890)
#

like that?

slate swan
slate swan
umbral night
#

outermost?

#

outer?

slate swan
#

(ctx.guild.get_role(role_id))

slate swan
#

useless var

umbral night
#

so this?
overwrite = channel.overwrites_for ctx.guild.get_role(role_id)

#

would that make sense

#

or do i need to keep the 'outermost' brackets

slate swan
#
role = discord.utils.get(ctx.message.guild.roles, id = int("1233445333")``` 😳
umbral night
#

thanks

jade tartan
#

Hi does any one know to make the bot ask questions and then after all question is answered it will post the results in dms, in an embed

slate swan
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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

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

This function returns the **first event that meets the requirements**...
slate swan
#

🙃

jade tartan
slate swan
#

know to make the bot ask questions and then after all question is answered

#

what are you planning to do to get those answers?

jade tartan
slate swan
#

you mean modals?

pliant gulch
slate swan
#

use the discord.Embed object and construct the embed?

slate swan
pliant gulch
#

🤠

slate swan
#

GatewayBot.cache.get_role(id) 🤲 hail hikari

pliant gulch
#

Naw Rin, rin.Role.cache.get(id)

slate swan
#

so basically, just enter the snowflake and get the object 😎 smart move

#

wait how does that work? <a role object>.cache.get(id)?

pliant gulch
slate swan
#

so ill assume most of the models have a cache property>

jade tartan
#

How do you make it have this?

slate swan
#

its an embed description

#

and it mentions a member using Member.mention

pliant gulch
#

Caching is due for a refactor soon, I’ll be cleaning it up prob

jade tartan
#
async def embed(ctx):
    embed=discord.Embed(title="Profile", description="", color=0xFF5733)
    await ctx.send(embed=embed)
jade tartan
#

Like that?

jade tartan
#

ok

jade tartan
# supple thorn ```f"{ctx.author.mention}"```
async def start(ctx):
    embed=discord.Embed(title="Profile", 
    description=f"{ctx.author.mention} /n/n ✅Verified 18+✅", color=0xFF5733, inline="true")
    await ctx.send(embed=embed)```
#

to make this

slate swan
#

!d discord.Embed

unkempt canyonBOT
#

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

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

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

New in version 2.0.

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

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

it isnt

jade tartan
#

?

slate swan
#

inline isnt a valid parameter

jade tartan
#

ok well i thought that would make it start a new line

quick gust
slate swan
#

!d discord.Embed.add_field

unkempt canyonBOT
#

add_field(*, name, value, inline=True)```
Adds a field to the embed object.

This function returns the class instance to allow for fluent-style chaining.
slate swan
quick gust
#

no u

slate swan
#

smh

jade tartan
#

ohh sorry this shows u that i know alot of python when i dont even know what i am trying to accomplish out of the embed

#

lol if that make sense

jade tartan
#

ok that worked now how do i move verified 18+ text to the centre?

brittle axle
#

try it though

slate swan
#

ew spaces

slate swan
brittle axle
slate swan
#

first see the docs before helping wtf

slate swan
jade tartan
#

wont look as tidy

brittle axle
#

i use inline = True in my bot -_-

quick gust
slate swan
jade tartan
brittle axle
slate swan
#

!d discord.Embed

vale wing
#

😳 wtf

unkempt canyonBOT
#

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

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

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

New in version 2.0.

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

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

yea thats valid in a field

slate swan
brittle axle
vale wing
#

Wtf guys

jade tartan
slate swan
brittle axle
vale wing
jade tartan
#

ohh the inline

slate swan
#

DUde what are you thinking your confusing me

#

add_field --> inline=True

vale wing
#

!e

a = True
print(type(a))```
unkempt canyonBOT
#

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

<class 'bool'>
slate swan
#

header --> inline="true" this is what I know

slate swan
brittle axle
slate swan
brittle axle
#

bro if you dont know even that go refresh on some python

jade tartan
#

Any way lets get back to the topic

brittle axle
slate swan
#

^^

brittle axle
slate swan
#

flexing?

brittle axle
slate swan
#

I did not even see its not in a field I saw inline="ture" and I said it

#

here's ashley cring about it

slate swan
slate swan
#

I ain't your pal or shit show some respect

vale wing
#

"ture"

slate swan
#

just to clear the confusion

slate swan
vale wing
#

Understandable

brittle axle
slate swan
#

just do what you are doing I'll leave

brittle axle
slate swan
slate swan
slate swan
#

idk but this invisible spacing works - ᲼

#

<᲼>

#

the space between these triangle stuff whatever

#

copy paste that

jade tartan
#
async def start(ctx, User):
    embed=discord.Embed(title='Profile',
    description= User=f"{ctx.author.mention} /n/n :white_check_mark:Verified 18+:white_check_mark:", color=0xFF5733, inline="true")
    await ctx.send(embed=embed)
#

I want it to start User: and then {ctx.author.mention} is this right?

heavy folio
#

description = User = ?

small igloo
#

'str' object does not support item assignment


def update_farm(user, i, waht):
    user = str(user)
    gni = check_farm_decoded_all(user)
    gni[i] = waht
    cur.execute("UPDATE farm set DECODED = ? where NAME = ?", (gni,user))
    conn.commit()```

i friggin tired
heavy folio
#

!d discord.Embed

unkempt canyonBOT
#

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

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

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

New in version 2.0.

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

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
heavy folio
#
  1. inline isnt a kwarg in Embed(), it is in Embed.add_field()
  2. inline takes a bool not str
jade tartan
heavy folio
#

that's not how python works

small igloo
heavy folio
#

you put that in a string

#

use f strings when

small igloo
heavy folio
#

f"User: {author.mention}"

small igloo
small igloo
# heavy folio show full traceback
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\User\Downloads\PycharmProjects\main.py\main.py", line 742, in farm
    database.update_farm(name, idk, str(e))
  File "C:\Users\User\Downloads\PycharmProjects\main.py\database.py", line 809, in update_farm
    gni[i] = waht
TypeError: 'str' object does not support item assignment

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\User\Downloads\PycharmProjects\main.py\main.py", line 178, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\discord\ext\commands\bot.py", line 994, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 894, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 176, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'str' object does not support item assignment
``` dis
heavy folio
jade tartan
#
async def start(ctx):
    embed=discord.Embed(title='Profile',
    description= "User: + "{ctx.author.mention} /n/n ✅Verified 18+✅", color=0xFF5733, inline="true")
    await ctx.send(embed=embed)
heavy folio
#

oh

heavy folio
supple thorn
heavy folio
#

and it's \n not /n

jade tartan
small igloo
small igloo
heavy folio
supple thorn
#

Yeah told you

heavy folio
#

i just said inline isnt a kwarg in Embed()

#

dont use + "

small igloo
supple thorn
jade tartan
#

i mean vision

supple thorn
jade tartan
#

i cant see from far away tho

#

only up close

supple thorn
#

Probably thats why

heavy folio
small igloo
jade tartan
#

description= f"User: + "{ctx.author.mention} \n\n ✅Verified 18+✅", color=0xFF5733, inline= true)

small igloo
heavy folio
#

for the last time im saying inline isnt a kwarg in Embed()

heavy folio
heavy folio
#

now the error explains it all

small igloo
jade tartan
#

hold up

small igloo
supple thorn
jade tartan
hoary cargo
supple thorn
#

And you dont need a + if you are already using a f string

small igloo
supple thorn
#

Just remove the second quote

small igloo
heavy folio
#

@small igloo

#

you get your error now?

small igloo
small igloo
supple thorn
#

I like its style

small igloo
heavy folio
#

you basically cant do "string"["something"] = something

jade tartan
#

i think i fixed it by my self

heavy folio
jade tartan
#

there dawg

small igloo
supple thorn
hoary cargo
heavy folio
#

firstly do you understand your error now

jade tartan
#

i just needed a hint but i seemed to have got it already

small igloo
heavy folio
slate swan
small igloo
small igloo
slate swan
small igloo
slate swan
small igloo
slate swan
hoary cargo
#

Even damn worse

heavy folio
small igloo
heavy folio
#

alr so that's not how you do it

#

you gotta execute a query and commit it, this isnt like json or something

small igloo
hoary cargo
small igloo
slate swan
small igloo
hoary cargo
small igloo
heavy folio
small igloo
hoary cargo
heavy folio
jade tartan
#

How do i make a text in the embed in the centre?

small igloo
supple thorn
heavy folio
quick gust
heavy folio
#

eh shit i meant asqlite by danny

slate swan
heavy folio
maiden fable
#

What's even happening here 👀

small igloo
small igloo
maiden fable
maiden fable
#

Smh

heavy folio
maiden fable
jade tartan
#

How do i make a text in the embed in the center?

slate swan
#

there's no point in telling people to go to the appropriate channels

#

they won't

small igloo
slate swan
heavy folio
maiden fable
heavy folio
maiden fable
small igloo
unkempt canyonBOT
hoary cargo
slate swan
small igloo
heavy folio
maiden fable
heavy folio
#
                          e
maiden fable
#

Different platforms format differently

supple thorn
#

Thats really black

slate swan
onyx ridge
#

im confused on how to make my code solve direct porportion

heavy folio
onyx ridge
#

help

small igloo
hoary cargo
#

\u200b MR_uncanny_16

heavy folio
quick gust
supple thorn
slate swan
slate swan
onyx ridge
hoary cargo
small igloo
slate swan
small igloo
small igloo
slate swan
hoary cargo
#

Ot channels are fake made by aliens

slate swan
quick gust
#

!ot

unkempt canyonBOT
small igloo
hoary cargo
small igloo
hoary cargo
#

HmmLeave my job here is done
Helped all the planet

jade tartan
#

description= f"User: {ctx.author.mention}, value="**➤ Name:** `✅Verified 18+✅`\n **➤, color=0xFF5733, inline="True") How does that look?

hoary cargo
#

Remove " " from True

jade tartan
#

done doesnt help

quick gust
#

that hurt my brain

#

show the full embed structure

#

embed doesn't have a value, or online kwarg

jade tartan
#
async def start(ctx):
    embed=discord.Embed(title='Profile',
    description= f"User: {ctx.author.mention}, value="**➤ Name:** `✅Verified 18+✅`\n **➤, color=0xFF5733, inline=True)
    await ctx.send(embed=embed)
#

???

vivid marsh
#

Is it even worth trying to code a discord bot in python since from what I heard python is no longer supported with discord?

jade tartan
#

Well am trying to make this like center on the embed

jade tartan
#

The verified

velvet tinsel
#

Do you mean that discord.py is no longer maintained or

vivid marsh
#

Yeah

manic wing
#

just use disnake, its literally discord but better

velvet tinsel
#

Or hikari

jade tartan
manic wing
#

use \u200b

manic wing
slate swan
#

hey i need sum help w discord im working on a bot and sometimes it sends alot of text anyway to count that text and if its above disc's limit to send it into a txt file?

vivid marsh
manic wing
#

lots of libraries have continued on the work of discord.py

vivid marsh
#

Ok thanks didn’t wanna put a lot of time in it and have to switch it over lol

slate swan
#
  except:
       await ctx.send(now_plus_30m = now + datetime.timedelta(minutes = 30))```
I created this cmd But the embed is sent not with the timestamp or whtever this code line does
Any help?
hoary cargo
#

Do you even know what that does? MR_uncanny_10

slate swan
slate swan
#

Ok lemme be straight I just want a timestamp for 30 minutes
Like this:

#

Every time i run the cmd it should start from current time

boreal ravine
#

You forgot to await something

#

Show code and the full error

#

did you await that?

#

await it then..

maiden fable
boreal ravine
#

send(content=..., embed=...)

#

!d asyncio.run you can use this

unkempt canyonBOT
#

asyncio.run(coro, *, debug=False)```
Execute the [coroutine](https://docs.python.org/3/glossary.html#term-coroutine) *coro* and return the result.

This function runs the passed coroutine, taking care of managing the asyncio event loop, *finalizing asynchronous generators*, and closing the threadpool.

This function cannot be called when another asyncio event loop is running in the same thread.

If *debug* is `True`, the event loop will be run in debug mode.

This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once.

Example...
boreal ravine
#

Run the async function using asyncio.run

slate swan
#

Hello

honest shoal
#

hello

jade tartan
#

Ok what am trying to do i am trying to have an embed and have my bot ask questions. but then at the end it should send the results? if that make sense?

slate swan
#

How do I make it so that my delete channel command only works in a certain category

#

@bot.command()
async def close(ctx):
    await ctx.channel.delete()
    await ctx.send("Successfully deleted the channel!")```
honest shoal
#

mhm, why are you doing ctx.channel.delete()?

slate swan
#

So it deletes the channel your on

honest shoal
#

ok so you don't want to delete the channel by id

slate swan
#

Can I have link for short time timestamp creator?

slate swan
#

Send

#

Short time

#

:-:

#

Creating a short time timestamp

#

O mb

honest shoal
#

@slate swan you can use a list

slate swan
#

Wdym

#

I was thinking would if statement work

honest shoal
#

yes it will but with list you can have more than 1 categories whitelisted

slate swan
#

I only want 1

slate swan
#

@honest shoal if channel.id (id): await ctx.delete() else: await ctx.send(“channel cannot be deleted”)

#

Would that work?

#

Na In (id) I’ll put the id

honest shoal
#

yes

honest shoal
slate swan
#

Ok

#

Variable?

honest shoal
#

no first you need to get the category

slate swan
honest shoal
unkempt canyonBOT
#

property categories: List[discord.channel.CategoryChannel]```
A list of categories that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
honest shoal
slate swan
honest shoal
#

yes

boreal ravine
honest shoal
#

there's an error in it

boreal ravine
#

remove the now_plus_30m

slate swan
#

Ok

slate swan
boreal ravine
#

maybe ¯_(ツ)_/¯

#

try it and see

slate swan
#

How do I set so a user can only use !open channel command once

#

So they can’t have multiple channels at once

boreal ravine
slate swan
#

Oh kk

slate swan
boreal ravine
#

yes

slate swan
#

Isnt*

#

It’s only the code line

#

cam amypme help me

maiden fable
#

With?

maiden fable
slate swan
#

i'm making a bot that reads apis and sends the parsed output but sometimes the response can be a lil long anyway i can read if its at disc's limit and if it is send as a txt file?

maiden fable
#

The send method has a file kwarg

#

!d discord.abc.Messageable.send

unkempt canyonBOT
#

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

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
slate swan
#

yes but how do i read

maiden fable
#

Pass in an instance of discord.File

slate swan
#

it and how do i turn resposne content into a txt file?

heavy folio
#
from io import BytesIO

content = "the_text_to_send_as_a_file"
buffer = BytesIO(content.encode('utf-8'))
file = discord.File(buffer, filename='text.txt')
await ctx.send(file=file)
maiden fable
#

Indeed that. Thanks invalid-user!

heavy folio
#

from dpy server

slate swan
#

and how do i read the content of the resposne and calculate how long it is and see if its above the

#

limit

maiden fable
#

u can use len()

heavy folio
#

check if len(content) > 2000: write in txt

slate swan
#

love u

heavy folio
#

no thanks

slate swan
#

stuf

maiden fable
#

Lmao

slate swan
#

Still does not work

#

After I put parenthesis before (now and between the last two )’) it says the code line when I run the cmd

#

@bot.command()
async def close(ctx):
if CategoryChannel.id :
await ctx.delete()
else:
await ctx.send("failed")

How do you define category id

#

Anybody having short time timestamp for 30 minutes from now?

maiden fable
slate swan
#

Um

#

Any help?
It says f-string expected ‘}’

#

In the console

outer flint
#

when setting as command, how can I restrict it to X servers? thinko

vocal snow
slate swan
#
@bot.command()
async def close(ctx):
  if CategoryChannel.id :
   await ctx.delete()
  else:
   await ctx.send("failed")```

How do you define category id
slate swan
vocal snow
#

im so confused at what im looking at

#

could you paste the code instead of an image

slate swan
#

kk wait

slate swan
# vocal snow could you paste the code instead of an image
async def heist(ctx, arg, arg1, arg2):
  channel = ctx.channel
  await ctx.send('<@&939441511433658389> \n :dot::money: **Dank Industries Heist Starting!** :money::dot:')
  try:
    hEmbed = discord.Embed(title=f"⏣ {arg}", description=f"Sponsor: {arg1} \n f"min_after = time.time() + 30*60" \n Requirements: \n \n:dot:Grab **Heist Ping** role to get ponged! \n:dot:Withdraw coins: `pls withdraw 2000` \n:dot:Use a life saver.")
    hEmbed.set_footer(text=f"Thank the grinders too")
    await ctx.send(embed = hEmbed)```
#
@bot.command()
async def close(ctx):
  if CategoryChannel.id :
   await ctx.delete()
  else:
   await ctx.send("failed")```

How do you define category id
boreal ravine
slate swan
boreal ravine
#

that is spoonfeeding

slate swan
#

k

slate swan
slate swan
boreal ravine
slate swan
boreal ravine
#

what is it?

boreal ravine
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.

boreal ravine
#

you're not using it correctly

slate swan
tacit token
#
@client.event()
async def on_member_update(ctx, before, after):
    with open('log.json', 'r', encoding='utf-8') as f:
        guilds_dict = json.load(f)
        if before.display_name != after.display_name:
            embed = discord.Embed(title="Nickname change",
                          colour=after.colour,
                          timestamp=datetime.utcnow())

            fields = [("Before", before.display_name, False),
                      ("After", after.display_name, False)]

            for name, value, inline in fields:
                embed.add_field(name=name, value=value, inline=inline)

            channel_id = guilds_dict[str(ctx.guild.id)]
            await client.get_channel(int(channel_id)).send(embed=embed)

        elif before.roles != after.roles:
            embed = discord.Embed(title="Role updates",
                          colour=after.colour,
                          timestamp=datetime.utcnow())

            fields = [("Before", ", ".join([r.mention for r in before.roles]), False),
                      ("After", ", ".join([r.mention for r in after.roles]), False)]

            for name, value, inline in fields:
                embed.add_field(name=name, value=value, inline=inline)

            channel_id = guilds_dict[str(ctx.guild.id)]
            await client.get_channel(int(channel_id)).send(embed=embed)

Error:
@client.event()
TypeError: Client.event() missing 1 required positional argument: 'coro'

maiden fable
#

remove the ()

#

from event deco

scarlet aurora
#

what the

maiden fable
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

tacit token
maiden fable
#

remove the ctx arg

scarlet aurora
#

Why do I get this error?

maiden fable
#

hover over the red line

tacit token
maiden fable
tacit token
#

my timestamp work

tacit token
maiden fable
scarlet aurora
#

ok

maiden fable
#

!d discord.utils.format_dt

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.9)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
maiden fable
tacit token
#

how?channel_id = guilds_dict[str(ctx.guild.id)]

maiden fable
tacit token
#

member not definied

maiden fable
tacit token
#

not work

#

the bot run but not send anything

#

wait

#

not work yeah

slate swan
#

i need some help

#

How to add reaction to a embed the bot sent

#

can you help me

maiden fable
#

i need some question

slate swan
#

i have an error

slate swan
#

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "java"

tacit token
maiden fable
slate swan
drowsy thunder
#

What is wrong with this code its doesnt work

maiden fable
#

indent

slate swan
maiden fable
#

!indent

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

slate swan
#

let me see

tacit token
drowsy thunder
tacit token
#

pm me

drowsy thunder
slate swan
# slate swan Code?

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "java"

slate swan
#

?

slate swan
# slate swan After the embed.set_footer(text=“....”)

here @bot.command()
async def java(ctx):
embed=discord.Embed(title="java", url="https://www.java.com/en/", description="java is an programming language created by James Gosling in 1995 in Indonesia,java is an a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible", color=discord.Color.red())
embed.set_author(name="the reaper", icon_url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTRLn8pIOVf-ZA6DUrwCp9AQMrl1EXS7-dtLOI21WcvsKvA9-g6d-4y6_pT7t-c_H-FP0c&usqp=CAU")
embed.set_thumbnail(url="https://upload.wikimedia.org/wikipedia/el/thumb/d/d0/Java.svg/1200px-Java.svg.png")
embed.timestamp = datetime.datetime.now()
embed.add_field(name="Fun fact", value="java took its name from an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee, a type of coffee from Indonesia.", inline=False)
embed.add_field(name="programs java has contrubite", value="Minecraft,Amazon,Uber,Linkedln,Spotify,Netflix,Google", inline=False)
embed.add_field("java beginners courses", value="12 hours beginner course", inline=True)
embed.set_footer(text="Information requested by: {}".format(ctx.author.display_name))
embed.set_image(url="https://miro.medium.com/max/1400/1*5h3Fv82Gsilyhh2URcIVZA.png")
await ctx.send(embed=embed)

Java tutorial for beginners full course
#Java #tutorial #beginners
⭐️Time Stamps⭐️
#1 (00:00:00) Java tutorial for beginners ☕
#2 (00:20:26) variables ❌
#3 (00:32:58) swap two variables 💱
#4 (00:36:42) user input ⌨️
#5 (00:44:40) expressions 🧮
#6 (00:49:13) GUI intro 🚩
#7 (00:55:01) Math class 📐
#8 (01:01:08) ra...

▶ Play video
tacit token
maiden fable
#

!paste please paste the code here

unkempt canyonBOT
#

Pasting large amounts of code

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

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

slate swan
#

i need some help

#

here

visual island
#

the java command is inside another command

#

put it outside

slate swan
#

what do you mean

visual island
#

un-indent it

slate swan
#

oh okay

#

Yo hello there been quite a while

slate swan
#

I am trying to use sub command but it sends the main command as well as the sub command

slate swan
slate swan
#

Atleast then tell me :-:

visual island
slate swan
#

I did

#

Doesn't work

visual island
#

code?

#

make sure to include parent and subcommand aswell

slate swan
#

sure

#

its absolutely massive including the sub commands tho

#

cuz there are like 14 or so

#

wait lemme send

visual island
#

send the group only then I guess

slate swan
#

oof

#

i put it under wrong decorator ☠️

#

sorry 🙏

#

thx xcrino for helping its now working like a charm

drowsy thunder
#

Help it shows expected a intended block though the code looks like good to go

slate swan
#

bro your token just make it env

buoyant quail
#

learn python basics first

drowsy thunder
#

Using tablet

slate swan
drowsy thunder
slate swan
drowsy thunder
slate swan
drowsy thunder
#

Ok but can you help

slate swan
#

yea

drowsy thunder
#

I am in tablet

slate swan
#

ok send the error message

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

drowsy thunder
buoyant quail
boreal ravine
#

No.

hoary cargo
#

MR_uncanny_10
Probably you should learn python before doing bots

drowsy thunder
#

Bruhh

#

I am in tablet

hoary cargo
#

If you don't know at least the basics don't expect you go too far with your code, indents are some basic knowledge in python

drowsy thunder
#

I am in tablet bruh

hoary cargo
#

Then stop coding on tablet, that's just an excuse

drowsy thunder
#

What

#

The tab stuff is on pc right

boreal ravine
buoyant quail
drowsy thunder
slate swan
#

Is there any way to make a cmd like:
-da 1,000,000 @slate swan
The bot responds with
Successfully added 1,000,000 amount donation fro @slate swan
And if I use the cmd again with different amount
It should add the amount to the previous amount the user donated

slate swan
#

No problem :-:
I asked if it is possible to make like that

buoyant quail
#

ofc possible

slate swan
#

how?

#

I mean I’m not asking the code just asking a example

fiery imp
#

Hi, how to keep calling a function every 5 secs and also keep calling another function every 10secs ???

buoyant quail
#
@commands.command()
async def da(ctx, amount, member: discord.Member):
    #load data from your db
    data[member.id] += int(amount.replace(",", ""))
    #pu data to ur db
    await ctx.send(f"Successfully added {amount} amount donation from {member.mention}")
slate swan
#

db what?

#

Oh data base

buoyant quail
#

yes

slate swan
buoyant quail
#

hmm

#

did you indented it?

slate swan
#

K done

#

Lemme test the cmd now

slate swan
#

Wait wait

slate swan
#

Same

slate swan
#

ANYWAYS

#

WHERE THE CODE?

#

@slate swan also did u know, replit has a discord.py template

supple thorn
slate swan
#
async def da(ctx, amount, member: discord.Member):
  #load the data from your db
  data[member.id] += int(amount.replace(",", ""))
  #pu data to ur db
  await ctx.send(f"Successfully added {amount} amount donation")```
supple thorn
#

Copy it without having a database

desert badger
#
        embed.add_field(
            name = "Language",
            value = f"`{language}`"
        )
``` how can i get the first letter of language to be capitalized ? :)
supple thorn
#

Hi alec

vocal plover
desert badger
#

oke thank

vocal plover
#

np

slate swan
#

@desert badger

vocal plover
slate swan
#

Are u a snake or python

supple thorn
#

Couldnt think of your username at the top of my head so using alec now

desert badger
desert badger
#

:meme:

slate swan
slate swan
supple thorn
#

Since i made them

slate swan
#

Wha-

supple thorn
fresh smelt
#

can someone help me with something | if yes dm me | it's an easy error Im sure that Im having problems with

slate swan
boreal ravine
slate swan
#

Ok

tawdry perch
slate swan
slate swan
tawdry perch
#

that was some high level advertising 👍