#discord-bots

1 messages ยท Page 21 of 1

slate swan
#

try last time TES_cat_vibe_sonic

#

me annoying you rude

#

:)

warm tulip
slate swan
#

,

slate swan
silk fulcrum
warm tulip
slate swan
#

1084

silk fulcrum
#

1000 - 7

slate swan
#

993

tidal hawk
#

@slate swan Can you remind me how to use the parent methods in child class? like how do i use add_item() from view class

slate swan
#

lmao

tidal hawk
#

can't use self

slate swan
paper sluice
slate swan
#

i get it slow :(

warm tulip
vocal snow
silk fulcrum
slate swan
robust fulcrum
#

Hi

slate swan
warm tulip
slate swan
#

what is (x + y) - 4 = 10 + (8 x 2)

silk fulcrum
vocal snow
cold sonnet
slate swan
#

ANY HELP OR ME LEAVE?

slate swan
silk fulcrum
slate swan
#

i know

silk fulcrum
slate swan
slate swan
shrewd apex
#
bot = commands.Bot(intents=discord.Intents.default())

@bot.hybrid_command()
async def fight(ctx, player1: str, player2: str, health: int, time: int) -> None:
  if 20 > health  or 500 < health:
      await ctx.send('not allowed')
      return 
warm tulip
#

How to make a embed message that at end it says server name and serve pfp

cold sonnet
#

easy solution

paper sluice
shrewd apex
#

take it or leave it ๐Ÿ‘€

silk fulcrum
slate swan
slate swan
shrewd apex
#

gl I'll try not to be present

silk fulcrum
#

that you put it in wrong place

slate swan
unkempt canyonBOT
#

set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.

This function returns the class instance to allow for fluent-style chaining.
tidal hawk
shrewd apex
silk fulcrum
#

okimii won't like this

shrewd apex
#

use the deco

silk fulcrum
#

or he will?

robust fulcrum
warm tulip
tidal hawk
#

what indent

robust fulcrum
slate swan
tidal hawk
#

NO

tidal hawk
shrewd apex
#

!indents

tidal hawk
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
robust fulcrum
cold sonnet
slate swan
tidal hawk
slate swan
# cold sonnet <@456226577798135808>

this the code btw bot = commands.Bot(intents=discord.Intents.default()) @bot.hybrid_command() async def fight(ctx, player1: str, player2: str, health: int, time: int) -> None: if 20 > health or 500 < health: await ctx.send('not allowed') return

#

they aready put :

cold sonnet
#

yeah then you have an await ctx.send() that's already indented wrong

slate swan
#

there's actually a good chance that it'll error out again as an unknown interaction mmLul

#

lol

paper sluice
#

@slate swan you know java right?

slate swan
#

O I UNDERSTAND

slate swan
#

last right code is from 3 years

paper sluice
#

it would be easier to pick that up and make a bot

slate swan
#

SO :)

paper sluice
slate swan
#

BY JAVA??

paper sluice
#

yea, it easier to learn something again rather than learning something new

cold sonnet
#

java is the same as python just different

slate swan
#

o hmmm no i want learn python

silk fulcrum
#

if not every language than almost all of them are possible to make a discord bot on

paper sluice
vocal snow
#

Lmao

silk fulcrum
slate swan
#

i make a game my guy

paper sluice
#

don't make discord bots, its not meant to be for beginners

slate swan
#

guy* sorry misclick

cold sonnet
vocal snow
#

!resources @slate swan

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

this site is werido :(

cold sonnet
#

you just gotta connect to the internet and ask information from discord

slate swan
#

and i want hop in bots this make me learn basic

paper sluice
vocal snow
#

No, that works for a few people but makes things very difficult in the long run

slate swan
#

so what i do

vocal snow
#

You should get your python and programming fundamentals down before doing this

slate swan
#

ah no

vocal snow
#

You can also try Automate the Boring Stuff

slate swan
#

WTF WHY No ONE TELL ME ABOUT THIS

tidal hawk
#

didn't callback :(

cold sonnet
#

half of this doesn't have to do anything with dpy

vocal snow
#

The entire View would be preferable

hollow badger
tidal hawk
slate swan
tidal hawk
#

mhm

vocal snow
#

Oh yeah for URL buttons

#

Discord doesn't send an interaction

tidal hawk
#

damn, Zeffo do you have an idea how to make sure that user has open the link

#

or there isn't any other way

shrewd apex
#

no way

#

unless u own the site in the link

vale wing
#

Make a redirect and check idk

slate swan
#

next time i will back here when i check google and my friend in python :)

vocal snow
#

^^

slate swan
slate swan
#

this command don't want to delete

#

even after delete code

slate swan
#

No :(

#

...

#

how to bttw

#

then sync them

#

CommandTree.sync

#

self.tree.sync() in your case

#

put it where

#

o

#

Thank you

cold tide
#

Can anyone help me setup inputs for async

#

I have no idea how to

vocal snow
slate swan
cold tide
#

Like bots taking users inputs

vocal snow
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.10)"). 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.10)") 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.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/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
vocal snow
#

async return lemon_cut

cold tide
#

How would i use ifs?

#

i have 0 clue how to

slate swan
vocal snow
slate swan
#

very async code

cold tide
#

can you show me how you do tha?

slate swan
cold tide
#

How you use if statments so like if input== etc

cold sonnet
#

๐Ÿ˜ฑ

cold tide
#

Why did u delete it?

slate swan
# cold tide How you use if statments so like if input== etc
from asyncio import TimeoutError

bot = commands.Bot(...)

@bot.command()
async def gib(ctx: commands.Context) -> None:
  try:
    message = await bot.wait_for("message", timeout=60, check= lambda d: d.author == ctx.author and d.channel == ctx.channel)
  except TimeoutError:
    return await ctx.send("ok")

  if message.content == "uwu":
    print("uwu")
  elif message.content == "no":
    print("yes")
cold sonnet
#

ewu

cold tide
#

Thankyou

sick birch
#

how does one typehint lambda arguments

pearl shoal
#

i need help i want to make it so everytime i want to ban someone theres a random reason can i do that

sick birch
pearl shoal
#

i wqnted to do it out of a list but i wasnt able to

cold tide
#

@slate swan how would i execute the code??

pearl shoal
#

because im new to python

slate swan
cold tide
sick birch
silk fulcrum
unkempt canyonBOT
#

random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
pearl shoal
#

Pichu used charm to kick, Pikachu used thunder shock to kick, Raichu used walt switch to kick, Squirtle used water gun to kick, Wartorle used rapid spin to kick, Blastoise used skull bash to kick, Bulbasaur used leaf blow to kick,
Venusaur used solar beam to kick, Charmander used Flame thrower to kick, Charmeleon used metal claw to kick, Charizard used inferno to kick

slate swan
slate swan
#

what do you mean it's a command

#

and the user will type stuff in discord

cold tide
#

so i just use !gib ?

slate swan
#

not in the terminal

pearl shoal
#

there are a lot of words so when i move to the next line there is an error

slate swan
#

yes

sick birch
sick birch
#

And whatโ€™s the error?

pearl shoal
#

there are 11 errors

#

it works fine

#

in only 1 line

vocal snow
pearl shoal
#

but as sson as i move to second line it shows errors

sick birch
#

To avoid having that many words, create a list with all the Pokemons, and another one with all the items they can use. Pick a random from each, concat them

sick birch
vocal snow
#

not sure how you'd do it inline

pearl shoal
#

import discord
from discord.ext import commands
import random

client = commands.Bot(command_prefix = '@')
TOKEN = 'token'

@client.event
async def on_ready():
print('{0.user} is on')

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=random.randrange('Pichu used charm to kick, Pikachu used thunder shock to kick, Raichu used walt switch to kick, Squirtle used water gun to kick, Wartorle used rapid spin to kick, Blastoise used skull bash to kick, Bulbasaur used leaf blow to kick,
Venusaur used solar beam to kick, Charmander used Flame thrower to kick, Charmeleon used metal claw to kick, Charizard used inferno to kick')):
if reason==None:
reason="no reason provided"
await ctx.guild.kick(member)
await ctx.send(f'{reason} {member.mention}')

client.run(TOKEN)

#

?

vocal snow
#

you should default it to None, and call randrange inside the function

pearl shoal
#

what to do then?

sick birch
#

Set reason to none, and move it inside the function itself

pearl shoal
#

in these await.ctx.send('random.randrange()')

#

?

vocal snow
#

uhh

#

no

#

remove the quotes

pearl shoal
#

thenn

#

ok

#

await.ctx.send(random.randrange(blah blah))

sick birch
#

!d random.randrange

unkempt canyonBOT
#

random.randrange(stop)``````py

random.randrange(start, stop[, step])```
Return a randomly selected element from `range(start, stop, step)`. This is equivalent to `choice(range(start, stop, step))`, but doesnโ€™t actually build a range object.

The positional argument pattern matches that of [`range()`](https://docs.python.org/3/library/stdtypes.html#range "range"). Keyword arguments should not be used because the function may use them in unexpected ways.

Changed in version 3.2: [`randrange()`](https://docs.python.org/3/library/random.html#random.randrange "random.randrange") is more sophisticated about producing equally distributed values. Formerly it used a style like `int(random()*n)` which could produce slightly uneven distributions.

Deprecated since version 3.10: The automatic conversion of non-integer types to equivalent integers is deprecated. Currently `randrange(10.0)` is losslessly converted to `randrange(10)`. In the future, this will raise a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError").
vocal snow
#

are you sure randrange is the right method

vocal snow
slate swan
#
async def kick(ctx: commands.Context, member: discord.Member, *, reason=None) -> None:
  reason = reason or random.randrange(...)
#

it's random.choice though

vocal snow
#

you want random.choice instead i think

sick birch
#

Yeah randrange is not the right function

#

It just returns a random number

slate swan
#

and with the arguments provided, an error

pearl shoal
#

but there are a lot of sentences so i moves to the next line and stops working

silk fulcrum
#

You need to use choice, so probably this random.choice('blah blah blah'.split()) @pearl shoal

cold sonnet
#

pass a list in choice

sick birch
#

You can avoid having a lot of words

pearl shoal
#

how

sick birch
#

And itโ€™s extra random

pearl shoal
#

can i select a file from notepad and it uses to as reasons>

cold sonnet
#

charmander is not going to use razor blade

pearl shoal
#

?

cold sonnet
#

or leaf blow ar whatever

pearl shoal
#

its flamethrower

slate swan
#

guys this is the code @client.tree.command(name="", description="to fight") async def _fight2(ctx, player1: str, player2: str, Health: int, Time: int) -> None: if 20 > Health or 500 < Health: await ctx.send('not allowed') return await ctx.response.send_message("eeee") and this is the error 2022-08-05 15:04:35 INFO discord.client logging in using static token Traceback (most recent call last): File "c:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 21, in <module> client.run("e") File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 882, in run asyncio.run(runner()) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete return future.result() File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 857, in runner await self.start(token, reconnect=reconnect) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 790, in start await self.login(token) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 642, in login await self.setup_hook() File "c:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 10, in setup_hook await self.tree.sync() File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\tree.py", line 989, in sync data = await self._http.bulk_upsert_global_commands(self.client.application_id, payload=payload) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 715, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In 0.options.2.name: Command name is invalid In 0.options.3.name: Command name is invalid any help

cold sonnet
#

nah as I understood it was robin's idea

slate swan
#

ok sir

pearl shoal
#

pwes help

slate swan
#

Ok done giving me error

#

File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\tree.py", line 989, in sync data = await self._http.bulk_upsert_global_commands(self.client.application_id, payload=payload) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 715, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In 0.options.2.name: Command name is invalid In 0.options.3.name: Command name is invalid

#

help = ping | no help igore

cold sonnet
#

what you wanna do is

reasons = ["Charmander used that and that", "Pikachu kicked like that", "Raichu used Thunderbolt"] 
await ctx.send(f"{random.choice(reasons)} {member}")
pearl shoal
#

ye tyy

#

btw you real dani/?

cold sonnet
#

I'm real

pearl shoal
#

the yter

cold sonnet
#

in real life I tend to exist

silk fulcrum
cold sonnet
#

but I exist

pearl shoal
#

ohk;

pearl shoal
#

?

silk fulcrum
#

jokelogical

pearl shoal
#

sarcasmlogical

cold sonnet
#

I inherit from meh

#

but I have self.name = self.__name__

pearl shoal
#

wuw

#

wuw is better than uwu

crystal glen
#

Give me an Idea to add to my bot.

cold sonnet
#

voice receiving

crystal glen
#

Where do I start

cold sonnet
#

discord API

pearl shoal
crystal glen
#

?

#

what is that, a library?

pearl shoal
crystal glen
crystal glen
cold sonnet
#

there's no lib for it

pearl shoal
#

A fun moderation bot which will keep your server safe and secure using Pokemon Attacks!

#

lame bu ok

cold sonnet
#

I mean people say pycord or nextcord has it, but where's the fun in that

crystal glen
cold sonnet
#

no

crystal glen
pearl shoal
cold sonnet
#

I respect you for that

crystal glen
#

Give me another Idea, That I can actually do

cold sonnet
pearl shoal
#

boring

cold sonnet
pearl shoal
#

pikachancla

sick birch
zinc reef
sick birch
#

Create a simple but extensible bot core

pearl shoal
hardy yoke
sick birch
crystal glen
#
# join a voice channel and record what people say
@client.command()
@commands.has_permissions(administrator=True)
async def record(ctx, channel: discord.VoiceChannel):
    # get the voice client
    await ctx.message.delete()
    await channel.connect()
    y = ctx.voice_client
    # start recording
    await y.source.start()
    # wait for the user to say "stop"
    await ctx.send("Say \"stop\" to stop recording.")
    while True:
        msg = await client.wait_for("message")
        if msg.content == "stop":
            await y.source.stop()
            await ctx.send("Recording stopped.")
            break

Github Co-Pilot did this

#

But I'm not sure if it works

crystal glen
pearl shoal
#

recreate cod in discord

cold sonnet
shrewd apex
sick birch
shrewd apex
#

make a gist

zinc reef
sick birch
#

And I wish people did

sick birch
crystal glen
sick birch
#

People seem to prioritize making commands and functions over having a strong infrastructure

cold sonnet
#

that while is not blocking

zinc reef
# sick birch At least 1 ๐Ÿ˜‚

wasn't because you proposed it though, it's because I have a few different bots and I was sick of repetition in different repos ๐Ÿ˜„

pearl shoal
#

make a bot that makes different uwu sounds using ai ๐Ÿ’€

cold sonnet
#

stop

pearl shoal
#

why

#

Im not a god

#

im not a king

vocal snow
pearl shoal
#

i am

shrewd apex
#

while is blocking in an async function? if it doesn't have any blocking code?pithink

vocal snow
#

No

sick birch
pearl shoal
#

a drug addict

cold sonnet
#

I don't even know how time.sleep is blocking inside an async function

sick birch
crystal glen
#

Someone give me an idea for my freaking bot. ffs

pearl shoal
cold sonnet
#

doesn't asnyc create a task of that time.sleep so it doesn't block

zinc reef
#

you just got like a dozen ideas :/

cold tide
#
event=discord.Embed()
event=discord.Embed(title=f"@everyone ๐ŸŽ‰{ctx.author} is hosting a event",description="Type ClaimEvent to win picture perms !",color=00FF00)
pearl shoal
#

A fun moderation bot which will keep your server safe and secure using Pokemon Attacks!

cold tide
#

Someone tell me what the issue is.

#

Idk what it is

cold sonnet
#

color = 0x00FF00

zinc reef
cold tide
#

it just says invalid syntax

cold sonnet
#

yes

cold tide
#

Whats the hex code for green?

cold sonnet
#

wait what

pearl shoal
#

ohhh

crystal glen
#

Well, you have some grammar issues as well.

cold sonnet
#

how is that invalid syntax

cold sonnet
#

he means a event

crystal glen
#

yeah lol

sick birch
#

Hexadecimal numbers need to be prefixed with a 0x

cold tide
#

I spelt it right.

cold sonnet
#

I later wanted to point out the first event definition

crystal glen
cold tide
#

Noo...

#

Ohh

crystal glen
#

"A" goes before words that begin with consonants. "An" goes before words that begin with vowels: an apricot. an egg.

cold tide
#

Okay that shouldnt stop it though

crystal glen
#

Oh yeah, I forgot about that part.

#

Send the error

#

Or tell us what's wrong

zinc reef
#

also, passing an int is wrong, you should pass a discord.Color if I remember correctly

cold sonnet
cold tide
#

Just says invalid syntax

sick birch
cold sonnet
#

but it could be a var

sick birch
#

As it assumes its a base 10 number

sick birch
#

Donโ€™t think variables can start with a number

zinc reef
#

alright it can be both

cold sonnet
#

dunno

sick birch
#

The parser needs to differentiate from a variable and an integer

crystal glen
#
@client.command()
@commands.has_permissions(administrator=True)
async def event(ctx):
    event=discord.Embed(title=f" ๐ŸŽ‰{ctx.author} is hosting a event", description="Type ClaimEvent to win picture perms!", color="0x00FF00")
    await ctx.send(embed=event)

Try this

#

@cold tide

royal bone
#

How to run python script for free on server

cold sonnet
#

well how do you know if 01000111 is a number or a letter

sick birch
cold sonnet
#

binary

crystal glen
royal bone
#

How to run python script for free 24/7 on server

sick birch
sick birch
crystal glen
cold sonnet
#

๐Ÿ˜ญ

sick birch
#

just making more work for the rest of us ยฏ_(ใƒ„)_/ยฏ

royal bone
#

How to run python script for free 24/7 on server

pearl shoal
#

can we make a bot that adds accounts to a server i need it so i can test kick and ban commands

crystal glen
crystal glen
#

no.

#

Oh wait

#

Yes it's possible

pearl shoal
#

?

cold sonnet
#

probably against ToS

crystal glen
#

I think it's not

#

There is a bot called Letoa

pearl shoal
#

i just need 1 account

crystal glen
#

It's used for server backups

pearl shoal
#

to be added again and again

crystal glen
#

You authorize your bot to your account, And write some code, And then it will join your server automatically

#

Cuz the bot has access to joining servers for you

vocal snow
#

Yes it's possible through Oauth2

crystal glen
crystal glen
pearl shoal
#

i just want a single account to be added again and again to my server hen kicked

slate swan
pearl shoal
slate swan
#

Or you can make life simple and just create a second account, and use that for testing.

sick birch
pearl shoal
#

Jammy is my computer teachers name ๐Ÿ’€

slate swan
#

This accoutn I am on is my personal and I have a 2nd one for testing against. ๐Ÿ˜„

crystal glen
pearl shoal
pearl shoal
crystal glen
#

Use self-botting

#

It's bannable + against ToS

pearl shoal
crystal glen
#

Don't get invloved

sick birch
#

!rule 5

unkempt canyonBOT
#

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

pearl shoal
sick birch
pearl shoal
#

sad

crystal glen
#

yeah it's rule 5

sick birch
#

But rule 5 so letโ€™s not discuss it here

pearl shoal
#

i have tp rejoin again and again

crystal glen
#

It's better than getting banned

slate swan
#

Yes I am Araso, and will do Robin, still going through my Python course atm to get a better understanding of basics (2ndtime now!)

pearl shoal
#

ye

pearl shoal
#

80,000

sick birch
crystal glen
crystal glen
pearl shoal
cold sonnet
#

following the logic of the people who are here with syntax error problems, you should start learning python by making GTA 6 @slate swan

vocal snow
#

๐Ÿ˜‚

sick birch
pearl shoal
#

can we make a command so that we can change prefix of bot

sick birch
#

Sure can

robust fulcrum
#

I have made once the prefix comamnd

pearl shoal
robust fulcrum
#

With lot of struggle

pearl shoal
crystal glen
#

Is there a way to use multiple prefixs for one bot?

robust fulcrum
#

Cant tell code

sick birch
#

!d discord.ext.commands.Bot.get_prefix

unkempt canyonBOT
#

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

Retrieves the prefix the bot is listening to with the message as a context.

Changed in version 2.0: `message` parameter is now positional-only.
robust fulcrum
cold sonnet
pearl shoal
robust fulcrum
#

Ye it's possible

cold sonnet
pearl shoal
#

tell mee

crystal glen
#

Like this?

cold sonnet
robust fulcrum
pearl shoal
#

jk

#

78000 server

robust fulcrum
#

2 mins I'll tell you at dm

pearl shoal
#

jk

#

only 1

slate swan
robust fulcrum
#

If 1 server that's easy

#

Use simple python for that

crystal glen
cold sonnet
#

of course

robust fulcrum
unkempt canyonBOT
#

Hey @crystal glen!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

crystal glen
#

What would you guys suggest?

slate swan
#

That bot looks way to malicious.

crystal glen
#

I know right?

#

I just add stuff to my bot

#

No point to it, The bot's name is Haryad, It's a person who f'd my life.

pearl shoal
crystal glen
pearl shoal
#

nice

#

โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโก€โ €
โ €โ €โ €โ ‰โ ‰โ ‰โ ™โ ปโฃฟโฃฟโ ฟโ ฟโ ›โ ›โ ›โ ปโฃฟโฃฟโฃ‡โ €
โ €โ €โขคโฃ€โฃ€โฃ€โ €โ €โขธโฃทโก„โ €โฃโฃ€โฃคโฃดโฃฟโฃฟโฃฟโฃ†
โ €โ €โ €โ €โ นโ โ €โ €โ €โฃฟโฃงโ €โ นโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโฃฟ
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ ›โ ฟโ ‡โข€โฃผโฃฟโฃฟโ ›โขฏโกฟโกŸ
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ ฆโ ดโขฟโขฟโฃฟโกฟโ ทโ €โฃฟโ €
โ €โ €โ €โ €โ €โ €โ €โ ™โฃทโฃถโฃถโฃคโฃคโฃคโฃคโฃคโฃถโฃฆโ ƒโ €
โ €โ €โ €โ €โ €โ €โ €โขโฃฟโฃพโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโ €โ €
โ €โ €โ €โ €โ €โ €โ €โ ˆโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโก‡โ €โ €
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ ™โ ปโขฟโฃฟโฃฟโฃฟโฃฟโ Ÿ

silk fulcrum
slate swan
#

!src

unkempt canyonBOT
slate swan
#

oh it was sarcastic

#

nvm

pearl shoal
slate swan
crystal glen
#

I have 400 members

#

I just rename all of them to Haryad

#

And some other things

#

For example making multiple channels with the name Haryad

pearl shoal
#

i hqve 90000 members

crystal glen
pearl shoal
#

sure ig]

crystal glen
pearl shoal
#

and btw its 00009 members

slate swan
pearl shoal
crystal glen
pearl shoal
#

owo?

slate swan
slate swan
crystal glen
#

I will just turn on a VPN

slate swan
pearl shoal
slate swan
#

jeez im out

dire pier
#

just firm it

crystal glen
#

Nord ๐Ÿ™‚

sick birch
#

!rule 5

unkempt canyonBOT
#

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

sick birch
#

Donโ€™t discuss ban evasion techniques

crystal glen
slate swan
#

Exactly what Robin just said.

pearl shoal
#

janmejay

final walrus
#

does somebody know the best wait to implement a sleep in a discord @tasks.loop ?

#

that's non blocking

pearl shoal
#

ye

crystal glen
#

asyncio?

unkempt canyonBOT
#

coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.

If *result* is provided, it is returned to the caller when the coroutine completes.

`sleep()` always suspends the current task, allowing other tasks to run.

Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.

Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [Whatโ€™s New in 3.10โ€™s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.

Example of coroutine displaying the current date every second for 5 seconds:
final walrus
#

yeah it

#

skips over it and just loops again

crystal glen
#

It's probably your code

final walrus
#
@tasks.loop(seconds = 2)            
async def likeThread(channel, apis, tweets, client):
        print("Like thread started")
        print(client.userList)
        for user in client.userList:
            asyncio.sleep(5)
 ....

that's the relevant snippet and it seems to just skip over the sleep and loops again after 2 seconds

crystal glen
#

@tasks.loop(seconds = 2)

pearl shoal
#
from discord.ext import commands
import random


client = commands.Bot(command_prefix = '@')
TOKEN = 'token'

@client.event
async def on_ready():
    print('{0.user} is on')

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
    if reason==None:
      reason="no reason provided"
    await ctx.guild.kick(member)
    await ctx.send(random.choice("Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick", 
"Venusaur used solar beam to kick", "Charmander used Flame thrower to kick", "Charmeleon used metal claw to kick", "Charizard used inferno to kick") )



    
client.run(TOKEN)
pearl shoal
crystal glen
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

crystal glen
#

What's the error code?

#

use try & except

pearl shoal
#

Ignoring exception in command kick:
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\Dell\Desktop\LEARN BO\afasasa.py", line 19, in kick
await ctx.send(random.choice("Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick",
TypeError: Random.choice() takes 2 positional arguments but 12 were given

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

Traceback (most recent call last):
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Random.choice() takes 2 positional arguments but 12 were given

slate swan
crystal glen
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Random.choice() takes 2 positional arguments but 12 were given

pearl shoal
slate swan
#

since, every argument given would be passed into the function's parameters

silk fulcrum
crystal glen
# pearl shoal ```import discord from discord.ext import commands import random client = comm...
kick_messages = ["Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick", 
"Venusaur used solar beam to kick", "Charmander used Flame thrower to kick", "Charmeleon used metal claw to kick", "Charizard used inferno to kick"]

(random.choice(kick_messages))
slate swan
#

overwriting inbuilt class names catcry

silk fulcrum
#

naming var list wont lead to goodies

crystal glen
pearl shoal
#

why is my code not in color

slate swan
#

...

final walrus
final walrus
silk fulcrum
crystal glen
silk fulcrum
#

probably

slate swan
#

I hate it when people just cross you off pepe_exit

pearl shoal
silk fulcrum
#

:lemao:

slate swan
#

Give me a command suggestion pithink

crystal glen
# pearl shoal i dont understand what u say
import discord
from discord.ext import commands
import random


client = commands.Bot(command_prefix = '@')
TOKEN = 'token'

@client.event
async def on_ready():
    print('{0.user} is on')

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
    if reason==None:
      reason="no reason provided"
    await ctx.guild.kick(member)
    kick_messages = ["Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick", 
"Venusaur used solar beam to kick", "Charmander used Flame thrower to kick", "Charmeleon used metal claw to kick", "Charizard used inferno to kick"]
    await ctx.send(random.choice(kick_messages))



    
client.run(TOKEN)
#

do u get it now?

pearl shoal
#

thanks

final walrus
# slate swan uh.....

Sorry that came off as harsh, what I ment to say.. I don't think the intervals between the execution of my function are relevant to the functions internal execution time

slate swan
# pearl shoal i dont understand what u say

lmao not you, what basically you do is
make a list of your options, so opts = ["option1", "option2"]
and then use the random.choice function on the list, so random.choice(opts)

pearl shoal
#

how the code is colorful

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

slate swan
#

```py
code
```

pearl shoal
slate swan
pearl shoal
#

tyyyyyyyyyyyyy

slate swan
#

I have a help command

crystal glen
slate swan
#

type all the commands out manually if you already havent

slate swan
slate swan
#

Give me an utility command

slate swan
silk fulcrum
slate swan
final walrus
pearl shoal
slate swan
#

wb poll?

slate swan
slate swan
#

yeah?

slate swan
#

still no ๐Ÿ˜”

pearl shoal
pearl shoal
crystal glen
#

There's a better way to do it

slate swan
pearl shoal
#

but does this one work?

vale wing
#

That's simple selenium

slate swan
#

yep

#

commands.has_perm. . .
And
commands.has_role. . .
Would work in the same command ?

pearl shoal
#

โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโก€โ €
โ €โ €โ €โ ‰โ ‰โ ‰โ ™โ ปโฃฟโฃฟโ ฟโ ฟโ ›โ ›โ ›โ ปโฃฟโฃฟโฃ‡โ €
โ €โ €โขคโฃ€โฃ€โฃ€โ €โ €โขธโฃทโก„โ €โฃโฃ€โฃคโฃดโฃฟโฃฟโฃฟโฃ†
โ €โ €โ €โ €โ นโ โ €โ €โ €โฃฟโฃงโ €โ นโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโฃฟ
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ ›โ ฟโ ‡โข€โฃผโฃฟโฃฟโ ›โขฏโกฟโกŸ
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ ฆโ ดโขฟโขฟโฃฟโกฟโ ทโ €โฃฟโ €
โ €โ €โ €โ €โ €โ €โ €โ ™โฃทโฃถโฃถโฃคโฃคโฃคโฃคโฃคโฃถโฃฆโ ƒโ €
โ €โ €โ €โ €โ €โ €โ €โขโฃฟโฃพโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโ €โ €
โ €โ €โ €โ €โ €โ €โ €โ ˆโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโก‡โ €โ €
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ ™โ ปโขฟโฃฟโฃฟโฃฟโฃฟโ Ÿ

crystal glen
# pearl shoal โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโก€โ € โ €โ €โ €โ ‰โ ‰โ ‰โ ™โ ปโฃฟโฃฟโ ฟโ ฟโ ›โ ›โ ›โ ปโฃฟโฃฟโฃ‡โ € โ €โ €โขคโฃ€โฃ€โฃ€โ €โ €โขธโฃทโก„โ €โฃโฃ€โฃคโฃดโฃฟโฃฟโฃฟโฃ† โ €โ €โ €โ €โ นโ โ €โ €โ €โฃฟโฃงโ €โ นโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโฃฟ...
import discord
from discord.ext import commands
import random


client = commands.Bot(command_prefix = '@')
TOKEN = 'token'

@client.event
async def on_ready():
    print('{0.user} is on')

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
    kick_messages = ["Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick", 
"Venusaur used solar beam to kick", "Charmander used Flame thrower to kick", "Charmeleon used metal claw to kick", "Charizard used inferno to kick"]
    if reason==None:
        reason="no reason provided"
    await ctx.send(f"{random.choice(kick_messages)} {member.mention}")
    await ctx.guild.kick(member)



    
client.run(TOKEN)
slate swan
#

using + to concatenate strings

slate swan
#

await ctx.send(f"{random.choice(kick_messages)} {member.mention}")
dogepray

slate swan
vale wing
#

Imma make text generator bot ๐Ÿ˜‚

crystal glen
slate swan
#

Not slash

slate swan
# slate swan in command

I mean, you could catch all that in a for example text argument
and use the split method to get the content chopped off from a delimiter

#

Wait,
Wb โ€œ โ€œ

#

These still work ?

silk fulcrum
slate swan
#

oooh

#
async def uwu(ctx: commands.Context, *, text: str) -> None:
  option_one, option_two = text.split("|")

#The command could be invoked using -> <prefix>uwu option one uwuwuwuwuwu|option two 
#

How do I set the output for them btw?

slate swan
#

nice

vale wing
#

Woohoo it got to 10th epoch

pearl shoal
#

random.choice(kick_messages) (member.mention)

slate swan
crystal glen
pearl shoal
#

ashley isnt it ```f''

pearl shoal
#

u edited it

crystal glen
slate swan
pearl shoal
#

ok

pearl shoal
crystal glen
pearl shoal
#

ohh

slate swan
#

easy pepe_exit

pearl shoal
#

no need to prove, i know i am wrong

slate swan
#

dogepray alright forgib

pearl shoal
#

@crystal glen urs didnt work either

crystal glen
swift pumice
slate swan
#

guys what this should be? if Health == str:

pearl shoal
#

no error

#

it kicked theperson

#

but message is this

crystal glen
#

how does it kick the person tho

pearl shoal
#

random.choice(kick_messages) (member.mention)

pearl shoal
vale wing
unkempt canyonBOT
#

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

True
slate swan
#

oo

#

!e
Health = type("2")
print(Health == str)

unkempt canyonBOT
#

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

True
slate swan
#

just use isinstance dogepray

#

LOl

vale wing
#

Yes

vale wing
slate swan
#

guys how to set a var to a text

paper sluice
#

var = 'text'

slate swan
#

depending upon the scope dogepray

slate swan
pearl shoal
#
from discord.ext import commands
import random


client = commands.Bot(command_prefix = '@')
TOKEN = 'token'

@client.event
async def on_ready():
    print('{0.user} is on')

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
    if reason==None:
      reason="no reason provided"
    await ctx.guild.kick(member)
    kick_messages = ["Pichu used charm to kick {member.mention}", "Pikachu used thunder shock to kick {member.mention}", "Raichu used walt switch to kick {member.mention}", "Squirtle used water gun to kick {member.mention}", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}", 
"Venusaur used solar beam to kick {member.mention}", "Charmander used Flame thrower to kick {member.mention}", "Charmeleon used metal claw to kick {member.mention}", "Charizard used inferno to kick {member.mention}"]
    await ctx.send(f"{random.choice(kick_messages)}")
    await ctx.guild.kick(member)



    
client.run(TOKEN)
slate swan
vale wing
#

Nice formatting

slate swan
paper sluice
pearl shoal
vale wing
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
vale wing
#

But by your formatting I didn't mean the colors

#

Run black on your code or smth

pearl shoal
#

i dont know why but y bot was off but still responding?

slate swan
pearl shoal
#

??

vale wing
#

In on_ready

pearl shoal
#

i have been tryingg to figure put this for the past 1 hour on this chat

#

it is kicking the user but no message

vale wing
#

Wait actually it's not f string

#

So doesn't matter it will just print it without format

pearl shoal
#

.

slate swan
#

Made quickpoll what else?

vale wing
slate swan
vale wing
#

Wait wtf

pearl shoal
vale wing
#

You have 2 kick instructions

paper sluice
vale wing
#

Man what the heck

pearl shoal
#

from this channelonly

vale wing
#

You need only one after send

slate swan
#

guys why this not work :( error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'fighttruefalse' referenced before assignment

slate swan
paper sluice
slate swan
vale wing
pearl shoal
#
    await ctx.guild.kick(member)
slate swan
pearl shoal
#

?

slate swan
slate swan
slate swan
#

nothing, I just said nice so it's nice

paper sluice
unkempt canyonBOT
#

@paper sluice :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 4, in <module>
003 |   File "<string>", line 2, in foo
004 | UnboundLocalError: cannot access local variable 'x' where it is not associated with a value
slate swan
#

LOl

paper sluice
#

?

vale wing
#

You probably did something like py if amogus: amogus = False

slate swan
pearl shoal
#

Who developed copy paste?
Larry Tesler, 1945-2020
Lawrence Gordon Tesler passed away on February 16, 2020, aged 74. In seven decades, he created an incredible legacy for the world, with inventions and innovations that have helped shape computers and programming. He's best known for inventing copy-paste alongside his colleague, Tim Mott.

#

legend

slate swan
#

def foo then

#

OOOOOOOOOOOOOOOOOOOOOOO

#

wait what def mean

silk fulcrum
#

looks good :lemao:

slate swan
vale wing
#

Can't disagree

paper sluice
#

i keep forgetting to do <url>

slate swan
#

O

slate swan
silk fulcrum
silk fulcrum
#

what

pearl shoal
#

hooker

#

what?

slate swan
#

nvm awkward

pearl shoal
#

happened

silk fulcrum
#

oops

pearl shoal
#

what happened

silk fulcrum
#

OH MY GOSSH

pearl shoal
#

?

silk fulcrum
#

and now it's fucked up

#

do I rename my bot? lmao

pearl shoal
#

or stropper

silk fulcrum
#

interesting

slate swan
pearl shoal
#

so?

slate swan
#

the mods are strict dogepray with pg-13 stuff rule

silk fulcrum
#

geinus plan

slate swan
silk fulcrum
slate swan
#

:lemao:

silk fulcrum
#

i miss my nitro

slate swan
#

why do people even use bots

paper sluice
slate swan
paper sluice
slate swan
slate swan
pearl shoal
#

hooker means like that uhh i cant tell like uhhhhhhhh on you wall idk english well

slate swan
slate swan
slate swan
#

?tag view examples

novel apexBOT
#

This is not a Modmail thread.

paper sluice
silk fulcrum
slate swan
#

jeez

paper sluice
slate swan
silk fulcrum
pearl shoal
#

i just googled

silk fulcrum
slate swan
#

yes when you help me understand me why this not work not just send Joy3D

pearl shoal
#

a hook- is a prosti-

slate swan
slate swan
slate swan
silk fulcrum
slate swan
#

๐Ÿ’€

silk fulcrum
slate swan
pearl shoal
glad cradle
paper sluice
#

what is going on here

slate swan
#

select menu to be more accurate

slate swan
silk fulcrum
pearl shoal
silk fulcrum
#

wait what did i just say

slate swan
slate swan
pearl shoal
slate swan
#

is it

pearl shoal
#

ye

paper sluice
slate swan
#

mos

silk fulcrum
#

btw @slate swan :lemao: is this in my server

slate swan
#

it's been eternities since I watched beyblade metal fusion ๐Ÿ˜”

slate swan
pearl shoal
slate swan
#

lOL

paper sluice
slate swan
slate swan
#

Give me a suggestion for another command pithink

silk fulcrum
slate swan
#

like me :)

slate swan
silk fulcrum
slate swan
silk fulcrum
slate swan
slate swan
pearl shoal
unkempt canyonBOT
#

Contacting the moderation team via ModMail

@novel apex is a bot that will relay your messages to our moderation team, so that you can start a conversation with the moderation team. Your messages will be relayed to the entire moderator team, who will be able to respond to you via the bot.

It supports attachments, codeblocks, and reactions. As communication happens over direct messages, the conversation will stay between you and the mod team.

To use it, simply send a direct message to the bot.

Should there be an urgent and immediate need for a moderator to look at a channel, feel free to ping the <@&831776746206265384> role instead.

slate swan
silk fulcrum
pearl shoal
#

what

slate swan
pearl shoal
#

is wrong wih that sentenve

#

lol

slate swan
#

does say cum is normal here?

#

nop

pearl shoal
#

cum is short form for come

slate swan
#

THEN HE SAY IT

pearl shoal
#

lol

slate swan
#

<@&831776746206265384>

pearl shoal
#

download whatsapp

slate swan
#

god, stop already

pearl shoal
#

you'll know

slate swan
paper sluice
#

dm @novel apex if you have any problems @slate swan

wary shadow
#

!shhh

unkempt canyonBOT
#

โœ… silenced current channel for 6 minute(s).

wary shadow
#

!mute 799966293608497193 4h Being disruptive and inappropriately suggestive is not welcome here. Review the #rules and #code-of-conduct before your mute expires please.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @pearl shoal until <t:1659725820:f> (3 hours and 59 minutes).

wary shadow
#

!unhush

unkempt canyonBOT
#

โœ… unsilenced current channel.

slate swan
#

a

#

lol

#

THE LAW MAKE HIS Job

#

idk what it mean lol i bad at english

#

finally

silk fulcrum
slate swan
#

Not me

silk fulcrum
#

wait did I disable ping?

#

bruh now im scared

slate swan
wary shadow
#

It's very useful for walking into a situation and needing a hot second to understand context.

torn sail
torn sail
#

It shows an @ in the reply person if u pinged

slate swan
#

Not rude lemon_happy

crystal glen
#

How can I make the bot to repeat someone?

#

ctx.author.message?

sick birch
#

ctx.message.content to get the content of the message that triggered a command

slate swan
crystal glen
crystal glen
#

@client.event
async def on_command_error(ctx, error):
    await ctx.message.delete()
    if isinstance(error, commands.CommandNotFound):
        await ctx.send(f'{ctx.author.mention} {ctx.message.content} not found.')```
placid skiff
slate swan
#

why this not work error :( discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'fighttruefalse' referenced before assignment

slate swan
#

I do think someone replied to this

slate swan
slate swan
#

Oops sorry forgot to turn off mention

slate swan
#

You are referencing the variable before assigning it

#

Yes how!?

#

Assign the variable before referencing it

#

Just do this

def foo():
  x = 0
  x + 1
foo()
#

fight == 'true'

#

Defining the variable before using it

slate swan
#

O

#

Iโ€™m bad at explaining๐Ÿ’€

slate swan
silk fulcrum
#

gonna play ping pong, bye guys, @slate swan gl in learning

slate swan
#

nice cat

#

OOOOOOOOOOOOOO LOOOOL

#

I UNDERstand

crystal glen
#
    if not os.path.isfile(filename):
        await ctx.send(f"{filename} does not exist in my sound library.")
        return

When I do:
?p haryad, It gives the error

silk fulcrum
crystal glen
#

And haryad exists, But it's haryad.mp3

slate swan
silk fulcrum
#

aight anyways, bye

crystal glen
#

no help me with this

slate swan
#

LOl

slate swan
placid skiff
#

you are not referencing it, you are using the equality statement

slate swan
#

so how

#

to referencng it

placid skiff
#

uwu = 1 this is an assignment
uwu == 1 this is an equality statement

slate swan
#

o

#

this was easy bye

#

bye-

slate swan
crystal glen
#
# disable a command for a user
@client.command()
@commands.has_permissions(administrator=True)
async def cdis(ctx, member: discord.Member):
    await ctx.message.delete()
    await member.add_roles(discord.utils.get(ctx.guild.roles, name="Disabled"))
    await ctx.send(f"{member.mention} has been disabled from using commands.")

@client.event
async def on_message(message):
    # if the message author has the disabled role, delete the message
    if discord.utils.get(message.author.roles, name="Disabled"):
        await message.delete()
        await message.channel.send(f"{message.author.mention} you have been disabled from using commands.")
        return

Why this isn't working?

#

No errors

slate swan
crystal glen
#

The command isn't working

#

idk about the event

slate swan
#

discord.utils.get() is prolly returning None

crystal glen
crystal glen
slate swan
crystal glen
#

hm?

slate swan
#

wait wtf

crystal glen
slate swan
#

since caching issues and get methods search the cache

#

can someone tell me why im getting this error? oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.

heres my code

def getsession(token=None, state=None, scope=None, redirect_url=redirect_url): return OAuth2Session(client_id=client_id, token=token, state=state, scope=scope, redirect_uri=redirect_url, auto_refresh_kwargs=dict(client_id=client_id, client_secret=client_secret), auto_refresh_url=f"https://discord.com/api/v{api_version}/oauth2/token", token_updater=updatetoken) # this is the function to get session

@app.route("/authorized")
def _2():
    discord = getsession(state=flask.session["oauth2_state"])
    token = discord.fetch_token(f"https://discord.com/api/v{api_version}/oauth2/token", client_secret=client_secret, authorization_response=flask.request.url) # this is where i got the error
crystal glen
#
# give a user a role
@client.command()
@commands.has_permissions(administrator=True)
async def role(ctx, member: discord.Member, role: discord.Role):
    role = discord.utils.get(ctx.guild.roles, name="Disabled")
    await member.add_roles(role)
    await ctx.send(f"{member.mention} has been disabled from using commands.")
#

Will this work?

#

it doesn't

torn sail
#

Well you arenโ€™t giving the user the role that the author provides

slate swan
crystal glen
crystal glen
#

It doesn't give an error

#

Or initiate the command at all

#

It's like the command doesn't even exist

#

And I don't get an error for invalid command

#

WTF IS HAPPENING

#

wait

#

MY BOT IS NOT WORKING

crystal glen
slate swan
#

try printing role and see

west veldt
#

um anyone here

#

i need a bit help

shrewd apex
#

just ask

west veldt
#

like randomly i was -(anything)

#

and it sends an embed

shrewd apex
#

yes yes

west veldt
#

you know the way to it?

shrewd apex
#

prefix commands right?

west veldt
#

yas

#

how to do that

#

u there?

shrewd apex
#
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='-', intents=discord.Intents.default())

@bot.command()
async def foo(ctx: commands.Context) -> None:
  embed = discord.Embed(title='Bar', description='Test', color=discord.Color.random())
  await ctx.send(embed=embed)

bot.run('Token')
west veldt
#

who

#

whoa
tysm

still swan
#

hello, theres a problem with this code its giving me an error when i run the bot and i dont know why, may someone help me pls?

from discord.ext import commands

class Member(commands.Converter):
    async def convert(self, ctx: commands.Context, argument: str):
        member_converter = commands.MemberConverter()
        member = await member_converter.convert(ctx, argument)
        if not member.bot:
            return member
        raise commands.BadArgument('Member must not be a bot user.')
shrewd apex
#

and what's the error?

still swan
#

RuntimeError: Event loop is closed

#

also discord.ext.commands.errors.ExtensionFailed

shrewd apex
#

the full traceback please