#discord-bots

1 messages Β· Page 801 of 1

slate swan
#

!d discord.Client.wait_for

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**...
slim ibex
#

pretty sure that returns when the account was created @west shuttle

slate swan
#

Which is a datetime obj

#

So you can .timestamp() it

west shuttle
slate swan
#

Cuz .timestamp() is just a number

slim ibex
#

yeah strftime'

slate swan
#

!d datetime.datetime.strftime

unkempt canyonBOT
#

datetime.strftime(format)```
Return a string representing the date and time, controlled by an explicit format string. For a complete list of formatting directives, see [strftime() and strptime() Behavior](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior).
slim ibex
#

ahh there it is'

slate swan
#

Double datetime derp

west shuttle
slate swan
#

How

slate swan
#

Like "%H:%M" does 04:51

#
q = {
  "question" : [],
  "options" : [],
  "answer" : []
}

question = q["question"]
options = q["options"]
answer = q["answer"]

@client.command()
async def ttrivia(ctx):
  await ctx.send("Input your question here")
  rresponse=await client.wait_for("message", timeout = 30)
  if rresponse.content.endswith("?"):
    await ctx.send("Your response has been stored")
  else:
    return await ctx.send("Entry denied")

  await ctx.send("Input your options here")
  rrresponse=await client.wait_for("message", timeout = 30)
  if rrresponse.content.endswith(""):
    await ctx.send("Your options have been recorded")

  await ctx.send("Insert your answer here")
  rrrresponse=await client.wait_for("message", timeout = 30)
  if rrrresponse.content.endswith(""):
    await ctx.send("Your answer has been stored")
    question.append(rresponse.content)
    options.append(rrresponse.content)
    answer.append(rrrresponse.content)

@client.command()
async def quiz(ctx):
  await ctx.send(random.choice(question))
  answer_to_quiz=await client.wait_for("message", timeout = 30)
  if question==answer and question==answer_to_quiz:
    await ctx.send("Your answer is correct")
  else:
    return await ctx.send("Your answer is wrong")

@client.command()
async def dict(ctx):
  await ctx.send(q)
slim ibex
#

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

can someone explain why the quiz is saying that answer is wrong?

#

Because you're comparing a message object to an empty list

quick gust
west shuttle
slate swan
slate swan
west shuttle
slate swan
west shuttle
#

thx

slate swan
#

This has a cheatsheet

slate swan
tender estuary
#
guild = ctx.guild

role = discord.utils.get(guild.roles, name="Name-here")
slate swan
#

if user.has_role

#

!d discord.Member.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID from roles which the member has.

New in version 2.0.
slate swan
#

!d if user.has_role

unkempt canyonBOT
#
if

8.1. The if statement

The if statement is used for conditional execution:


if_stmt ::=  "if" assignment_expression ":" suite
             ("elif" assignment_expression ":" suite)*
             ["else" ":" suite]
``` It selects exactly one of the suites by evaluating the expressions one by one until one is found to be true (see section [Boolean operations](https://docs.python.org/3/reference/expressions.html#booleans) for the definition of true and false); then that suite is executed (and no other part of the [`if`](https://docs.python.org/3/reference/compound_stmts.html#if) statement is executed or evaluated). If all expressions are false, the suite of the [`else`](https://docs.python.org/3/reference/compound_stmts.html#else) clause, if present, is executed.
slate swan
#

hmm

#
if role in member.roles```
where `role` is a discord.Role object , and `member` is discord.Member
#

It's member.get_role

slate swan
#

and yea member.get_role is a thing too

rain olive
#

πŸ₯Ί

hoary gust
#

guys recommend me something to code

tender estuary
slate swan
hoary gust
maiden fable
#

Dutchy πŸ‘€

slate swan
#

No eyesshaking

hoary gust
hoary gust
#

hmm

tender estuary
hoary gust
tender estuary
#

Make it anyways

maiden fable
quick gust
#

I've seen dutchy somewhere

slate swan
#

||make something like an annoying rickrole||

quick gust
#

ah SRA

hoary gust
slate swan
#

Make an amazon deal tracker verycool

#

user-to-bot voice

maiden fable
hoary gust
maiden fable
slate swan
#

something similar to what mee6 does

slate swan
maiden fable
hoary gust
#

and any projects general?

slate swan
#

Smh

hoary gust
hoary gust
#

wat?

slate swan
#

make an API wrapper maybe

maiden fable
maiden fable
hoary gust
#

wait u dont make bots anymore?

maiden fable
hoary gust
#

haha i c

maiden fable
#

Not many users

slate swan
maiden fable
slate swan
quick gust
#

kekw

#

jesus christ

slate swan
#

Even worse is guilded imo

boreal ravine
#

omg dutchy

maiden fable
#

Tf is this

slate swan
#

bruuuh

#

A big meme

maiden fable
slate swan
#

Average french platform

bitter depot
#

Let's keep things sfw please @slate swan

slate swan
#

WUT

#

its literal discord ripoff

#

niiiiiiice

slate swan
#

I hate it. Only thing I like about it are the channel types

#
@client.command()
async def quiz(ctx):
  await ctx.send(random.choice(question))
  answer_to_quiz=await client.wait_for("message", timeout = 30)
  if question==answer and answer==answer_to_quiz:
    await ctx.send("Your answer is correct")
  else:
    return await ctx.send("Your answer is wrong")```
#

Whats wrong brainlet

tender estuary
#

that's what, what's wrong

slate swan
#

You're still comparing to a message object

tender estuary
#

what are you trying to do

slate swan
#

well, basically users create their own questions, options and answers which are added to 3 diff lists in a dictionary (appending)

#

and then

unkempt canyonBOT
slate swan
slate swan
#

How?

#

you are comparing an string object with a discord.Message object
message.content is what u need

#

hmm

slate swan
#

no, i just represented those variables' classes

boreal ravine
slate swan
#

hmm

#

you would be using message.content instead of message there

#

hmm

#

so answer_to_quiz.content?

#

πŸšΆβ€β™‚οΈ

#

yea

#

lesgo

#

"Your answer is wrong"

#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

slate swan
#

🀨

#

L

#

import Intents when?

#

use vscode

#

best

brisk brook
#

Or sublime for the interface

slate swan
brisk brook
slate swan
#

bestieeeeeeee

brisk brook
#

Bestieeee

slate swan
# brisk brook Right click snip snip save

You think it's funny to take screenshots of people's NFTs, huh? Property theft is a joke to you? I'll have you know that the blockchain doesn't lie. I own it. Even if you save it, it's my property. You are mad that you don't own the art that I own.

Delete that screenshot.

slate swan
#

LOL IKR

brisk brook
#

FUNNY ASF AINT GONNA CAP

#

They be mad like uhh uhh we own that image, it's encrypted in the block chain

slate swan
#

Dude I own this NFT. Do you really think you can get away with theft when you're showing what you stole from me directly to my face. My lawyers will make an easy job of this case. Prepare to say goodbye to your luscious life and start preparing for the streets. I will ruin you.

brisk brook
#

LMAPOOOOO

slate swan
#

Man its such a joke

neat tartan
#

While funny we should probably keep talk in here on topic

slate swan
#

Yeah

brisk brook
#

Virtual images are a joke

slate swan
#

On topic

brisk brook
#

Yes

#

Topic

slate swan
#

hmm

brisk brook
#

I'm trying to make a buy command for my economy

stiff sonnet
#

Keyboard warriors

slate swan
#

yeah i was facing issue but people seem to have gotten tired of me cuz i cant seem to grasp the issue Brainlet

brisk brook
#

But it isn't working

slate swan
#

lemme send

#
@client.command()
async def quiz(ctx):
  await ctx.send(random.choice(question))
  answer_to_quiz=await client.wait_for("message", timeout = 30)
  if question==answer and answer==answer_to_quiz.content:
    await ctx.send("Your answer is correct")
  else:
    return await ctx.send("Your answer is wrong")
#
q = {
  "question" : [],
  "options" : [],
  "answer" : []
}

question = q["question"]
options = q["options"]
answer = q["answer"]

@client.command()
async def ttrivia(ctx):
  await ctx.send("Input your question here")
  rresponse=await client.wait_for("message", timeout = 30)
  if rresponse.content.endswith("?"):
    await ctx.send("Your response has been stored")
  else:
    return await ctx.send("Entry denied")

  await ctx.send("Input your options here")
  rrresponse=await client.wait_for("message", timeout = 30)
  if rrresponse.content.endswith(""):
    await ctx.send("Your options have been recorded")

  await ctx.send("Insert your answer here")
  rrrresponse=await client.wait_for("message", timeout = 30)
  if rrrresponse.content.endswith(""):
    await ctx.send("Your answer has been stored")
    question.append(rresponse.content)
    options.append(rrresponse.content)
    answer.append(rrrresponse.content)

@client.command()
async def quiz(ctx):
  await ctx.send(random.choice(question))
  answer_to_quiz=await client.wait_for("message", timeout = 30)
  if question==answer and answer==answer_to_quiz.content:
    await ctx.send("Your answer is correct")
  else:
    return await ctx.send("Your answer is wrong")

@client.command()
async def dict(ctx):
  await ctx.send(q)```
#

Here is the entire code for context

neat tartan
#

Try responding to the bot with the word message instead of yes and see what happens

slate swan
#

okay

sick birch
zealous gorge
#

How would I code a bot that sends a msg after a certain time interval?

sick birch
neat tartan
# slate swan

I wasnt sure if it was trying to look for the specific word message instead of the message contents but thats not the case

zealous gorge
#

How do I make bots stay up for like a certain time then turn off lets say 9 hours

#

Do I need to host it with clou or whatever thingy what do I do

sick birch
#

You'd probably use the tasks extension

#

Then when it's time to run, disconnect from the API

zealous gorge
#

Dont I need to host on cloud

sick birch
#

you can't fully turn off the bot unless you use some sort of bash script

sick birch
zealous gorge
#

I want to turn off my computer

sick birch
#

then yes you'd probably need a cloud computer

zealous gorge
#

Can I close the tab?

#

the replit tab

sick birch
#

a cloud computer will always be online whatever you do

slate swan
#

yea if you use a vps you can

sick birch
#

no don't use replit please

slate swan
#

replit, is bad.

sick birch
#

100%

zealous gorge
#

Lets say I do it for like 6 hours

zealous gorge
sick birch
#

get a good host such as AWS EC2 instance

slate swan
#

a vps

zealous gorge
#

btw gtg Im really hungry to eat sorry

sick birch
#

t3.micro instances are super cheap and get the job done

slate swan
#

well

#

it actually causes more issues now i think

#

can i make the bot ignore its own messages?

slim ibex
#

@zealous gorge use a task

sick birch
#

Also @slate swan, all the questions and answers will reset when you turn the bot off and back on, you need to make sure you put a question back into the dict if you can

slate swan
slate swan
slim ibex
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

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

Are you sure that works within the function considering scoping?

slate swan
#

but they are using wait_for , so probably a check function is required.

sick birch
#

Variables outside of a function won't work within

slate swan
#

hmm

#

so like i have to set the variable within the function as well?

slate swan
#

how do i go about doing that?

sick birch
#

why if question==answer?

neat tartan
#

Mobile discord is nice but ass for anything actually code based

slate swan
#

because if the question is
x and answer is y
x=y

So when the bot asks question via random.choice and the user gives the answer, the bot checks if the answer is equal to question

#

if answer is correct, it replies answer is correct

#

else, it gives wrong

sick birch
#

πŸ€” doesn't seem right

#

How are you storing the questions and answers? As lists?

neat tartan
slate swan
#

the questions and answers are stored within the lists

sick birch
#

I think a datastructure like this would fit your needs best:

x = [
  ("This is a question", "This is an answer"),
  ("This is another question", "this is another answer"),
]
slate swan
#
    question.append(rresponse.content)
    options.append(rrresponse.content)
    answer.append(rrrresponse.content)```
#

Is it possible to make it so that when a participant left, it was written how long he was on the server in time? if yes, can you tell me how?

#

Help pls

neat tartan
sick birch
#

yeah that's what i was thinking

slate swan
#

hmm

sick birch
slate swan
#

man now its getting even more confusing to understand

neat tartan
slate swan
#

How?

slate swan
#

so if i define it below def quiz it'll cause error

#

How to subtract time?

neat tartan
#

Ah i see

sick birch
#

And the time they left would just be datetime.datetime.now() would it not?

sick birch
#

Therefore, the time now minus the join time = time in server

#

You can either just do normal integer subtraction using UNIX timestamps or use delta time

slate swan
#

:thinking:

sick birch
#

timedelta()

slate swan
#

Okay

sick birch
neat tartan
slate swan
#

oh so i should scrap the dictionary idea

sick birch
#

oops

#

where did i goof up

#

oh i see

#

!e

x = [
  ("This is a question", "This is an answer"),
  ("This is another question", "this is another answer"),
  ("This is question 3", "this is answer 3"),
]

for question, answer in x:
  print(f"Question: {question}")
  print(f"Answer: {answer}")
  print("-----")
unkempt canyonBOT
#

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

001 | Question: This is a question
002 | Answer: This is an answer
003 | -----
004 | Question: This is another question
005 | Answer: this is another answer
006 | -----
007 | Question: This is question 3
008 | Answer: this is answer 3
009 | -----
sick birch
#

^ that's sort of what i mean

#

would be easiest to work with question/answers

slate swan
#

hmm

#

but there's no way to store questions and answers from chat now is there

#

this'd mean that I would have to manually add questions and answers into the code

#

which isn't what im looking for

sick birch
#

Not necessarily

neat tartan
#

The top half of that would be defined outside of the function and then a simple x = x inside the function should pull it in to be usable i think

sick birch
#

!e

x = [
  ("This is a question", "This is an answer"),
  ("This is another question", "this is another answer"),
  ("This is question 3", "this is answer 3"),
]


q = "question 4"
a = "answer 4"
x.append((q, a))

print(x)
unkempt canyonBOT
#

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

[('This is a question', 'This is an answer'), ('This is another question', 'this is another answer'), ('This is question 3', 'this is answer 3'), ('question 4', 'answer 4')]
sick birch
#

you can put more questions in that way

slate swan
#

hmm

sick birch
#

!e

# accessing questions
x = [
  ("This is a question", "This is an answer"),
  ("This is another question", "this is another answer"),
  ("This is question 3", "this is answer 3"),
]

q1, a1 = x[1]
print(q1)
print(a1)
unkempt canyonBOT
#

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

001 | This is another question
002 | this is another answer
slate swan
#

hmm

hoary gust
#

guys any projects on discord bot ?

distant pendant
#

Would you suggest me to host my bot on repit or not? and why

red nest
#

because your code would be public and anyone could see it

distant pendant
red nest
neat tartan
distant pendant
#

Where do you host your bots?

red nest
#

my bot isnt hosted yet:(

neat tartan
#

Its convenient for people who dont have coding ides and setting up a discord bot because it "doesnt need a host" but its seriously flawed in almost every aspect

quick gust
neat tartan
#

A lot of people get a VPS or use their own computer or an old one to just host it themself

distant pendant
sick birch
#

I used my Raspberry PI before that

quick gust
#

not really, there are free ones but they're all bad imo

sick birch
#

bad is being generous

red nest
sick birch
slate swan
#

hi

sick birch
#

"good free hosting services" don't exist sadly

red nest
#

yeah

neat tartan
sick birch
#

Though I think AWS has some amount of free hours? maybe give that a try

slate swan
#

a vps is better than a rpi tbh if its for the long run the rpi is better

sick birch
slate swan
#

Do you know why do I get this error? I tried searching but still can't solve the problem
" Traceback (most recent call last):
File "C:\Users\filip\PycharmProjects\discordBOT\main.py", line 8, in <module>
@client.event()
TypeError: Client.event() missing 1 required positional argument: 'coro' "

code:
`import discord
TOKEN = "my bot token"
client = discord.Client()

@client.event()
async def on_ready():
print("Working")

client.run(TOKEN)`

quick gust
#

I believe oracle has a free tier VM

slate swan
#

how to get member with userId

sick birch
slate swan
sick birch
#

EC2 on the other hand, you can use their load balancers and scale easily

#

Also you don't have to worry about upkeep, electricity, internet bills, etc

red nest
slate swan
#

depends on the plan

tender estuary
sick birch
slate swan
#

lol

sick birch
#

t3.micro iirc has 2 gigs of ram and 2 cores? it should be good for a good while

slate swan
quick gust
# sick birch

750 hours is still pretty good considering its free

sick birch
#

(if you put linux on it of course)

red nest
sick birch
red nest
quick gust
slate swan
#

not bad

quick gust
#

I mostly just use VMs to practice installing linux lmfao

sick birch
#

ah wait it's each month

slate swan
sick birch
#

if you have 6 hours of downtime each month you can get a full year of it

quick gust
#

ofc

slate swan
#

bruh

sick birch
quick gust
#

its fun when u dont have to care about loosing stuff

sick birch
#

not all of them are click and go like windows

#

(arch)

slate swan
quick gust
sick birch
#

took me the better part of my saturday the first time i was installing arch on my main

slate swan
#

meh i had to install mysql on kali today, i tried tons of times before realising that it comes with mariadb installed already

#

i only have windows cause some games doesnt support linux

sick birch
#

mainly because i kept screwing up the partition tables and wiping all the data on the drives πŸ˜„

quick gust
#

lmaoo

neat tartan
#

Im not ashamed to admit that i have to use guides for setting up linux vms

sick birch
#

i dual boot yeah

slate swan
#

πŸ§‘β€πŸ¦―

sick birch
#

or GPU passthrough with a windows VM

slate swan
#

im not dual booting

sick birch
#

lot of games support linux, or can be run through steam proton, same goes for some of the anti cheats

#

Epic's anti cheat for one

slate swan
#

my laptop couldn't handle windows anymore so i just completely removed it, the only reason i had windows was games

#

which i dont play anylonger

quick gust
#

anyways getting kinda ot here

sick birch
#

true

#

back on topic

quick gust
#

.topic

lament depotBOT
#
**What feature would you be the most interested in making?**

Suggest more topics here!

slate swan
quick gust
neat tartan
#

@slate swan hows your stuff coming along?

slate swan
sick birch
slate swan
#

gimme help command interface ideas

sick birch
#

πŸ˜‚

slate swan
neat tartan
neat tartan
#

Ah aight, ill pop over there and try to help where i can

sick birch
slate swan
#

i dont want to

frozen elk
#

I have member id how do I turn it into memer variable to unban someone

grim oar
#

!d discord.Guild.get_member

quick gust
#

bot.get_user(id)

grim oar
#

Oh unban

#

My bad

quick gust
#

yeah

slate swan
sick birch
#

How did you get the ID?

grim oar
#

You can use Guild.unban and pass in your User

frozen elk
hoary gust
#

guys any project recommendation on discord bots?

grim oar
#

snake game

sick birch
slate swan
slate swan
grim oar
#

generic

slate swan
boreal ravine
sick birch
#

Ah wait it' as snowflake

#
guild.unban(discord.Object(...))
grim oar
boreal ravine
slate swan
unkempt canyonBOT
slate swan
boreal ravine
slate swan
boreal ravine
#

They weren't talking to you

hoary gust
boreal ravine
#

Their message was self-explanatory

silk robin
#

πŸ‘€

grim oar
slate swan
slate swan
silk robin
#

Whats up sar

slate swan
#

πŸ‘οΈ thinking of implementing a new help command

silk robin
slate swan
#

it also shows the slash commands

#

yeah

pliant gulch
slate swan
#

hi andypithink

grim oar
slate swan
#

😭

boreal ravine
slate swan
slate swan
slate swan
grim oar
#

!d discord.Guild.unban

unkempt canyonBOT
#

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

Unbans a user from the guild.

The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
sick birch
#

Use discord.Object to make your own discord.abc.Snowflake

#

Since discord.abc.Snowflake is an abstract base class, you should never have to initialize it yourself

slate swan
sick birch
#

(though honestly it's starting to become one)

slate swan
pliant gulch
#

Reminds me I was totally gonna add a built-in http server to rin

slate swan
#

you were gonna what

grim oar
#

How's the rewrite going andy

pliant gulch
#
@rin.GatewayClient.route("/guilds")
async def guilds(request) -> None:
    ...
#

Basically builtin discord-ext-ipc

grim oar
#

weren't you guys going to use blanket's framework for that

pliant gulch
#

no

slate swan
#

and werent you gonna change the name cause people think rin is rin tohsaka

pliant gulch
#

FastAPI

grim oar
#

Wot I remember

sick birch
slate swan
pliant gulch
pliant gulch
#

Plus it's just psuedocode

slate swan
#

I don't understand how to do

#

ah, got it

pliant gulch
#

Oh nevermind it would

slim ibex
pliant gulch
slate swan
#

Subtract the date of departure from the date of joining

pliant gulch
#

Although that isn't even right, since client has no way of getting guilds directly

grim oar
#

it's returns are useless anyways, it going in void cuz of deco

pliant gulch
#

Instead you'd need to use ```py
list(rin.Guild.cache.itertor())

grim oar
#

β€œa cache iterator”

vocal snow
#

What's wrong with that

pliant gulch
#

Just self.root.values()

grim oar
#

could have used the iter dunder in base cache bozo

pliant gulch
#

I could

slate swan
#

theres a iter dunder?

pliant gulch
#

The iter would need to return the cache, then I'd need to add __next__

#

then I have to do all this non-sense with keeping an index of the current element

#

Then I would actually need to handle stop iteration

grim oar
#

πŸ¦…

#

Excuses

pliant gulch
#

since dict have no index!

grim oar
#

what is that iterator method even returning, a tuple of k:v?

pliant gulch
#

It's a generator

grim oar
#

oh

slate swan
#

dont think indexing a dict would be possible since its dict['key']

pliant gulch
#

Yep, you'd need to make a list of the values and keep track of index

pliant gulch
grim oar
#

😼 yeah might take more space

#

I got the stupid

honest vessel
#

I am unbanned finally woho

sick birch
#

Ok?

arctic python
#

!rule 6 @slate swan

unkempt canyonBOT
#

6. Do not post unapproved advertising.

arctic python
#

!rule 9 also

unkempt canyonBOT
#

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

final iron
fresh orchid
#

why this isnt working?

@commands.command()
    async def suggest(self, ctx, reason=None): 
        count_yes = int(1)
        count_no= int(1)
        count_yes_1 = count_yes + int(1)
        if not ctx.channel.id == 933813622952562718:
            await ctx.send("This command only works in #suggestions")
        else:
            if reason == None:
                await ctx.send("You have to use ,suggest and then type your suggestion after ,suggest")
            else:
                button_yes = Button(label=count_yes, style=discord.ButtonStyle.success, emoji="βœ…")
                button_no = Button(label=f"{count_no}", style=discord.ButtonStyle.danger, emoji="❌")

                view = View()
                view.add_item(button_yes)
                view.add_item(button_no)

                embed=discord.Embed(title="Suggestion:", description=reason, color=13565696, timestamp=datetime.utcnow())   
                embed.set_author(name=f"{ctx.author.display_name} ({ctx.author.id})", icon_url=ctx.author.avatar.url)
                message = await ctx.send(embed=embed, view=view)


                async def button_yes_callback(interaction):
                    count_yes =+ 1
                    button_yes.label = count_yes
                    await message.edit(view=view)

Basically it should edit the button of the message and then set the number on the button 1 higher

But when I press the button nothing changes
It will stay 1

honest vessel
#

count_yes should't it be += 1

fresh orchid
#

let me try

#

no

#

then it says count_yes is not defined

honest vessel
#

@fresh orchiddefine it as 0 first

#
>>> i = 0
>>> i += 1
>>> print(i)
1
>>> i =+ 1
>>> print(i)
1
>>> i += 1
>>> print(i)
2
>>>
final iron
#

Why are you using int()on it?

fresh orchid
#

idk but i think this is not a problem

honest vessel
#

and it is += not =+

honest vessel
honest vessel
#

@fresh orchidIt is not. cause u define it in the first function not the inner function

#

what u would like to is more like use self. then

slate swan
#

sorry admins:)

#

i didnt know that

honest vessel
#

@fresh orchidu could do self.count_yes = int(1)

#

and then do self.count_yes += 1

fresh orchid
#

i dont think so because when I do

async def button_yes_callback(self, interaction):
                    self.count_yes += 1
                    button_yes.label = count_yes
                    await message.edit(view=view)

It says

missing 1 required positional argument: 'interaction'
honest vessel
#

i just know that =+ 1 is wrong its += 1

fresh orchid
#

so no solution

honest vessel
#

i dont know no but it hink its weird that u cant use self

#

i hvntg played so much with inner functions or buttons for that matter

#

new error here self.count_yes += 1 button_yes.label = count_yes missing self on second
and yes message is not defined so thats another error

#

@fresh orchidmy friend, isnt your inner function in that else: block?

#

or is it just my screen

fresh orchid
#

Oh yes

#

Is it a Problem?

honest vessel
#

it should be same indentation as ur first varaible in ur upper function

fresh orchid
#

Ok

#

I will try

honest vessel
#

one step at time πŸ˜„

#

weird python didnt say anything about that

#

(maybe u can have inner functions in if-statmeents i dunno

fresh orchid
#

Still the same

I cant use Self

honest vessel
#

oh ok @fresh orchid can u reach the varaible count_yes now that u changed indentations? - if you remove self

ionic ledge
#

how to dm everyone in server

honest vessel
#

hah gl with that @ionic ledge

ionic ledge
honest vessel
#

i think thats borderline ToS on this server

ionic ledge
honest vessel
#

i mean ToS to help you with that

ionic ledge
honest vessel
neat tartan
#

It would bw fairly easy to do but morally i dont think anyone will help because of the damages it can cause

sick birch
honest vessel
#

only with it is a spambot and thats a no go here

ionic ledge
#

i need to use Google then ig

honest vessel
#

you should't prob even make that at all

#

whats wrong with tag?

velvet tinsel
#

tbh, if you think about it it's really easy

honest vessel
#

at_everyone, at_here

velvet tinsel
#

a for loop, then some member stuff

#

not gonna give any specifics, it is against ToS

honest vessel
honest vessel
#

@fresh orchidhows it going friend

sick birch
velvet tinsel
#

binds literally fucking left the group chat

#

@slim ibex wtf

slim ibex
#

Ayo

#

I just saw this

uneven apex
#

what are some good libraries to work with slash commands

slim ibex
#

Disnake

honest vessel
#

@uneven apexdisnake

velvet tinsel
honest vessel
velvet tinsel
#

no need to ping you

slim ibex
#

lol

sick birch
#

You can work with slash commands with base discord.py pretty easily

#

They are considered interactions after all

honest vessel
#

@sick birchit dosnt take much effort to swap to disnake

#

and that fork is getting updated

sick birch
#

No, but I'm only suggesting options

sick birch
#

If you want to use a fork you can, but nothing is forcing you to

velvet tinsel
#

ctrl+r and replace discord with disnake

uneven apex
#

but i didn't find anything regarding slash commands in its doc

velvet tinsel
#

then do some editing

pliant gulch
#

Doesn't take to much to make a slash commands class, cache callbacks using id, then dispatching in INTERACTION_CREATE

honest vessel
#

Advice, never ask for help like that just ask your question and show whats wrong errors etc. ANd peopels gladly to help u if they can

#

that has nothing todo with discordbots

sick birch
#

on_interaction will pick up slash commands, to register a slash command you just need to send an API request, which can be done using online tools such as Postman (excellent API testing tool)

honest vessel
#

the question is still related to python

#

math/python-general

sick birch
#

Not related to discord bots, claim a help channel and we can help you there

honest vessel
#

@fresh orchidsorry bro i cant help then 😦

fresh orchid
#

All fine

velvet tinsel
#

@honest vessel no need to ping him every message

honest vessel
#

esp before the reply function was implanted

velvet tinsel
honest vessel
#

say what? πŸ˜„

fresh orchid
honest vessel
honest vessel
velvet tinsel
honest vessel
velvet tinsel
honest vessel
#

Tell me in a offtopic channel.

velvet tinsel
#

ok

frozen patio
#

hello

#

I am using python and I have an embed color problem

honest vessel
#

ok, can you be more specific

#

can you show how u made ur embed?

frozen patio
#

can I send a couple pictures?

honest vessel
#

just show how u define colour for ur embed

#

if code is picture sure why not

frozen patio
#

yeah it is

frozen patio
honest vessel
#

i nvr used nextcord but try do a hex format and not a string

#

aka remove "

#

0xff0000 etc

frozen patio
#

will that work?

honest vessel
#

it complaining you sent a string so

neat tartan
#

I thought embed only had preset colours decided by (1,2,3,4,...) not any hex or other typical colour codes

honest vessel
frozen patio
#

ok let me try this now

honest vessel
#

if only preset colours to choose from wow stupid fork

#

@frozen patiotry remove " on it

frozen patio
#

i did

velvet tinsel
#

@honest vessel wtf

frozen patio
#

it crashed

honest vessel
#

lol

frozen patio
#

it needs to have the "

honest vessel
#

then its like he said ints, 1,2,3,4 preset

velvet tinsel
#

wait what's it called

#

lemme pull up the github

honest vessel
#

but u have also premade functions like Colour.blue()

#

etc i dont know exactly how they spell it but

frozen patio
#

im trying to put a cyan one in

velvet tinsel
#

!pypi discordheximals

unkempt canyonBOT
velvet tinsel
#

πŸ‘

honest vessel
#

@velvet tinselwhats ur issue?

velvet tinsel
#

thanks @slate swan

velvet tinsel
frozen patio
#

didnt work

velvet tinsel
frozen patio
velvet tinsel
frozen patio
#

mhm

honest vessel
#

em = discord.Embed(title="", description="", colour=myclass.colors["blurple"])

velvet tinsel
#

@frozen patio try color=hex goes here

#

not a str, but as an int maybe

honest vessel
#

so you mean skip 0x

#

0x7289DA -> 7289DA

frozen patio
#

i skipped the 0x thing yeah

honest vessel
#

try both let us know what worked

velvet tinsel
#

ok

frozen patio
honest vessel
#

ah

#

disnake too

#

how come they not fix so it accepts both ?

frozen patio
#

thank you 2 very much

honest vessel
#

np happy cayn

frozen patio
#

yep the command worked also!

honest vessel
#

@velvet tinselimagine not accept both how hard that can be ...

hoary cargo
frozen patio
#

oh another question

#

how do I make a kick/ban command

slate swan
#

!d discord.Member.kick

unkempt canyonBOT
#

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

Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.kick "discord.Guild.kick").
slate swan
#

Same with the ban

#

!d discord.Member.ban

unkempt canyonBOT
#

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

Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
frozen patio
#

ok thanks!

slate swan
#

Welcomeee

#
chemicals = dict()

index = 1
while True:
    chemical = input(f"Enter chemical {index}: ")
    if chemical == " ":
        break
    else:
        chemicals[chemical] = input("Enter the amount: ")
    index += 1
print(chemicals)
#

Yooooo. I found a way to have infinite QnAs 🀀

velvet tinsel
slate swan
velvet tinsel
#

hi hi

cold sonnet
#

haha

flat solstice
#

So I'm trying to make a invite info command so read https://discordpy.readthedocs.io/en/stable/api.html?highlight=invite#discord.Invite to see all of the attributes but for some reason I'm getting this errorpy ERROR:cogs.error_handler:AttributeError: 'NoneType' object has no attribute 'timestamp' (In inviteinfo) Traceback: File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/modmail/cogs/info.py", line 478, in inviteinfo embed = discord.Embed(title = f"Server invite: {invite.code}", description = f"Invite created <t:{int(invite.created_at.timestamp())}:R>", colour = ctx.author.colour, url = invite.url) so I tries removing timestamp which also error'd withpy ERROR:cogs.error_handler:TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' (In inviteinfo) Traceback: File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/modmail/cogs/info.py", line 478, in inviteinfo embed = discord.Embed(title = f"Server invite: {invite.code}", description = f"Invite created <t:{int(invite.created_at)}:R>", colour = ctx.author.colour, url = invite.url)so I think timestamps supposed to be there based on my other info commands (roleinfo, serverinfo and userinfo) which all have created_at.timestamp(). This is my codepy @commands.guild_only() @commands.command(description = "Get some information about a invite.", usage = "inviteinfo", aliases = ["invitestats", "ii"],) async def inviteinfo(self, ctx, invite: discord.Invite): embed = discord.Embed(title = f"Server invite: {invite.code}", description = f"Invite created <t:{int(invite.created_at.timestamp())}:R>", colour = ctx.author.colour, url = invite.url) embed.set_author(name = f"ID: {invite.id}", icon_url = invite.guild.icon_url) embed.add_field(name = "Inviter", value = f"{invite.inviter.mention}|{invite.inviter.mention}" if invite.inviter else "Unknown") embed.add_field(name = "Uses", value = f"{invite.uses}/{'Infinite' if invite.max_uses == 0 else invite.max_uses}", inline = True) embed.add_field(name = "Expires", value = f"<t:{int(invite.max_age.timestamp())}:R>", inline = True) embed.add_field(name = "Temporary", value = f"{invite.temporary}", inline = True) embed.add_field(name = "Revoked", value = f"{invite.revoked}", inline = True) embed.add_field(name = "Channel", value = f"{invite.channel.mention}", inline = True) await ctx.reply(embed = embed)

velvet tinsel
#

Nice pfp btw

echo wasp
#

so rn my role giver is going by id how do i make it check the id of the role if the user picked a name of one of the roles that has its id in the list

slate swan
#
@bot.command()
async def embed_color(ctx, word):
    if len(word) != 8:
        await ctx.send('Must be sent in hex code with 0x at the beginning, ex:\n0x5866ef')
    else:
        bot.e_color = (word).value
        embed = discord.Embed(title=f"New color", color=bot.e_color)
        await ctx.send(embed=embed)
#

how do i get the value of word

#

i tryed (word).value

#

and it didnt work

#

here's the traceback

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\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: AttributeError: 'str' object has no attribute 'value'
#

thanks in advanced

final iron
#

word is what ever the user inputted

#

Just like defining a variable

#
word = "abcdefg"
slate swan
final iron
#

What is up with your indentation

compact ruin
#

its just hte discord removed all the indent

#

so i had to do a bunch of spaces

#

lmao the indent on my code itself is fine i just get that one error

#

lemme see if i can make it abit neater lmao

compact ruin
#

idk why it keeps saying the variable is referenced before assignment lemon_angrysad

slate swan
final iron
#

If chosen_Reward is not equal to coins silver or gem it throws that

slate swan
#

because i dont want a "text" liek this

#

i want a text like this: text

final iron
#

Okay?

slate swan
#

without the ""

final iron
#

It should still send the actual text

slate swan
#

so i need the value of the string, or else it doesnt work

#

i need

#

color=0x00000

#

not color = "0x00000"

final iron
#

Then type hint it as an int

slate swan
#

can i join it with 0x at the begining

compact ruin
#

Ty ty i got it now

#

I just realised what the problemo is

#

thanks mate

slate swan
#

how can i join 0x with the int

#

cant be '0x'

#

well i could do color = {
'0x':0x
}

#

i guess

light night
#

ThinkO_O what are you planninng on doing?

#

hexing the color?

#

if you want to hex the color, you could just hex(color)

final iron
#

!d hex

unkempt canyonBOT
#
hex

hex(x)```
Convert an integer number to a lowercase hexadecimal string prefixed with β€œ0x”. If *x* is not a Python [`int`](https://docs.python.org/3/library/functions.html#int "int") object, it has to define an `__index__()` method that returns an integer. Some examples:

```py
>>> hex(255)
'0xff'
>>> hex(-42)
'-0x2a'
```  If you want to convert an integer number to an uppercase or lower hexadecimal string with prefix or not, you can use either of the following ways...
slate swan
#

@final iron

#

needs to start with 0x

light night
#

oh

slate swan
#

kk i just saw that

final iron
#

You cannot concatenate an integer

slate swan
#

wtf is concatenate

light night
#

I believe this means you can't do like

#

"string" + int

final iron
#

!e

print("a" + "b")
unkempt canyonBOT
#

@final iron :white_check_mark: Your eval job has completed with return code 0.

ab
final iron
#

Boom, concatenation

slate swan
#

yes

#

i cant do that

#

i know, its jsut an example

final iron
#

You could try

light night
#

ThinkO_O maybe there's a typehint for hex types?
Then again I don't know if there's a hex type

cloud dawn
unkempt canyonBOT
#

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

ab
slate swan
#

what do i do now

#

i know you cant conceratarte im not dumb

silent portal
#

Is there a way to get all the badges a user has?
Like

for badge in user:
  print(badge)```
slate swan
#

just tell me how to put 0x with the int

final iron
#

!d discord.Member

unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

hash(x) Returns the member’s hash.

str(x) Returns the member’s name with the discriminator.
light night
#

user.public_Flags or member.public_Flags both work

final iron
#

!d discord.Member.public_flags

unkempt canyonBOT
#

property public_flags```
Equivalent to [`User.public_flags`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.public_flags "discord.User.public_flags")
cloud dawn
#

!d hex

unkempt canyonBOT
#
hex

hex(x)```
Convert an integer number to a lowercase hexadecimal string prefixed with β€œ0x”. If *x* is not a Python [`int`](https://docs.python.org/3/library/functions.html#int "int") object, it has to define an `__index__()` method that returns an integer. Some examples:

```py
>>> hex(255)
'0xff'
>>> hex(-42)
'-0x2a'
```  If you want to convert an integer number to an uppercase or lower hexadecimal string with prefix or not, you can use either of the following ways...
light night
#

wait you could type hint a int, then hex it

slate swan
#

let me try this???

outer parcel
#

hi everyone i need help

#

im scripting a bot but there is a problem

outer parcel
#

for some reason it is doing the code twice

sick birch
#

Can we see the code?

outer parcel
slate swan
#

maybe u ran it twice

light night
outer parcel
#

nop not running anything

sick birch
#

looks like there might be 2 instances running

cloud dawn
outer parcel
#

wait a minute i just turned off the script and it is still working ...

sick birch
#

yeah

#

multiple instances are running

outer parcel
#

wdym

final iron
#

Reset your token

sick birch
#

you're accidentally running the bot from 2 different connections i guess you could say

slate swan
#

hexs arent just numbers

final iron
#

Easiest way to fix it

slate swan
#

what do i do now

light night
#

you need to make sure the word is well an int

slate swan
#

its not tho

light night
#

you can probaly just check the type

slate swan
#

theres letters

outer parcel
#

so what do i do to stpo it

slate swan
#

cant be a str

light night
slate swan
#

?

#

type hinting

light night
#

word will always be a string, and if nothing, then error in this case

slate swan
#

obv

light night
#

but you can typehint it to be an int

slate swan
#

wait can i turn the hex into a rgb

#

no wait

light night
#

notice how this will not work?

slate swan
#

yes

outer parcel
light night
#

if it's a string it will not work

slate swan
#

ik

#

so how do i solve the problem?

light night
#

ThinkO_O you could use a typehint then like typing.Union

#

with the word

slate swan
#

alr

#

can u tel me how

#

?rtfm typehint

#

?rtfd typehint

#

?rtd typehint

#

Hi back pithink

#

i lost 2fa codes for my old account :(

light night
#
async def example_command(self, ctx, word : typing.Union[int, str]):

 if isinstance(str):
  return await ctx.send('sorry this will not work')

Uh, okay this example is kind of bad, hold on

slate swan
#

is self important

#

?

light night
#

only if in a cog

#

as a cog is a class

slate swan
#

like another file for a code

light night
#

as a bot.command πŸ™…

#

no, a class is something like

#
class Test(commands.Cog):

    def __init__(self, bot):
        self.bot = bot

this is like a cog class, well subclass

slate swan
#

alr7

#

typing is red

light night
#

import typing, then you are good

slate swan
#

alr and how can i use typing union

#

in my particular case

slim ibex
#

a union is is something or something

slate swan
#

hexs arent just intergers

slim ibex
#

so Union[X, Y] is the same as X | Y

slate swan
#

and strings dont work

light night
#

ThinkO_O I wonder

cloud dawn
light night
#

if it doesn't you may need to make a regex converter of your own

slim ibex
slate swan
#

alr i ditched the command

#

whatever

slim ibex
#

why

final iron
#

!e
print(int("0xE91E63"))

unkempt canyonBOT
#

@final iron :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | ValueError: invalid literal for int() with base 10: '0xE91E63'
final iron
#

Oh yeah

#

You can't use int on it

sick birch
#

!e
print(int("0xE91E63", 16))

unkempt canyonBOT
#

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

15277667
sick birch
#

mm

final iron
#

Was checking google right now

#

I guess that works

sick birch
#

hexes are technically another representation of integers are they not?

final iron
#

But its not a discord hex code

light night
#

You could probaly run regex on the hex ThinkO_O with like a discord.py commands converter
Then convert it back to int

final iron
#

Doesn't discord use a "flavour" of hex or smth?

sick birch
#

not sure

#

dealing with hexes is kind of weird

final iron
#

The hex I showed above is what I use in my commands

#

And it works

vale wing
#

Can't the discord.Color be used as a typehint?

sick birch
#

perhaps try RGB, might be easier since discord.Colour has a .from_rgb() @classmethod

vale wing
#

I've seen it somewhere

slate swan
#

so i should convert hex to rgb

#

then use rgb???

sick birch
#

They can actually!

vale wing
#

Lol

vale wing
#

No need for the regex

#

Just typehint with color

sick birch
#

^

slate swan
#

is this gud

sick birch
#

No

slate swan
#

to make it a rgb

sick birch
#

you can just typehint to discord.Colour and forget all of that

slate swan
#

???

#

how

slim ibex
#

do you know what type hinting is?

slate swan
#

no clue

slim ibex
#

word: Union[int, str]
Union is the type hint for the word param

sick birch
#
@bot.command()
async def myColorEmbedCommand(..., colour: discord.Colour, ...):
  await ctx.send(embed=discord.Embed(..., colour=colour, ...)
#

that's all you have to do

slate swan
#

kk

slim ibex
#

idk if you can change color of fieldsm, titles, etc if that is what you want

slate swan
#

no

sick birch
#

You can only change the color of the left bar on embeds

slate swan
#

ik]

#

@sick birch

sick birch
#

yes now colour will be what you pass in to the embed's color kwarg

#

and you can get rid of that if/else by the way, d.py will handle that for you

slate swan
#

@sick birch colour is an argument missing

slim ibex
#

you didn't specify color arg when invoking the command prob

slate swan
#

wdym

sick birch
slim ibex
#

your command atm when invoking is !cmdname <word> <colour>

velvet tinsel
slim ibex
#

you prolly didn't specify something for colour

sick birch
#

you need to call it like this:

<prefix>embed_color <word> <hex>
slim ibex
#

^

velvet tinsel
#

fix your name

slim ibex
#

yes

slate swan
#

is it hex

velvet tinsel
slim ibex
#

why

slate swan
#

or like red

velvet tinsel
#

it's supposed to be moyai

sick birch
velvet tinsel
#

not moai 😠

pallid mango
#
@client.event
async def on_member_update(before, after):
    if ".gg/" in str(after.activity.name):
      guild = client.get_guild(932840827212931123)
      role = discord.utils.find(lambda r: r.name == 'promoter', guild.roles)
      await after.add_roles(role)```
#

gives role but doesnt take it

#

what am i doing wrong?

slim ibex
velvet tinsel
pallid mango
#

doesnt take role whenever user removes status

sick birch
pallid mango
#

oh yeaaaa

#

how would i do it?

sick birch
#

if the vanity is not in after status name anymore, remove the role

pallid mango
#

idk code for that

slim ibex
#

!d discord.Member.remove_roles

unkempt canyonBOT
#

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

Removes [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s from this member.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
pallid mango
#

yes ik that

slate swan
#

i dont get it

pallid mango
#

but the other part, like i cant just put blank in the "" because they might change it to something else directly after taking .gg/ out

sick birch
pallid mango
#

yes

slate swan
#

jack shit

velvet tinsel
#

!d startswith

unkempt canyonBOT
#

startswith

Case-sensitive starts-with.

Example:

Entry.objects.filter(headline__startswith='Lennon')
```  SQL equivalent:

```py
SELECT ... WHERE headline LIKE 'Lennon%';
```...
slate swan
velvet tinsel
#

!d str.startswith

unkempt canyonBOT
#

str.startswith(prefix[, start[, end]])```
Return `True` if string starts with the *prefix*, otherwise return `False`. *prefix* can also be a tuple of prefixes to look for. With optional *start*, test string beginning at that position. With optional *end*, stop comparing string at that position.
slate swan
#

doesnt change the color

sick birch
velvet tinsel
pallid mango
#

ohhhh

#

just add not in

sick birch
#

because you're setting the embed color to bot.e_color rather than colour

slate swan
#

i want it to be bot.e_color bc i want it to change the color of al the embeds

sick birch
#

then set bot.e_color to colour

slate swan
#

like this?

sick birch
pallid mango
#

dude what

#

it keeps deleting it...

visual yarrow
#

Sorry @pallid mango, caught by the spam filter. Remove the server invite link in order to post the code.

pallid mango
#

dawg i put .gg

#

how is that an invite?

sick birch
# slate swan

exactly like so, what's the red squiggly telling you though?

slate swan
pallid mango
#
@client.event
async def on_member_update(before, after):
    if "" in str(after.activity.name):
      guild = client.get_guild(932840827212931123)
      role = discord.utils.find(lambda r: r.name == 'promoter', guild.roles)
      await after.add_roles(role)
    if "" not in str(after.status.name):
      await after.remove_roles(role)```
sick birch
#

there you are

pallid mango
#

oh wait, my bad i forgot to remove the second vanity in the not in code

sick birch
#

Also role is restricted to the scope for the first if

slate swan
#

Guys does anyone have ticket system source?

sick birch
#

move it outside both ifs so it's restricted to the on_member_update scope

pallid mango
#

does that mean i need to add another identifier?

#

oh

neat pagoda
#

anyone know how to fetch lyrics from youtube-dl?

pallid mango
#

okay

sick birch
sick birch
neat pagoda
sick birch
#

Regardless we can't provide assistance with that library

pallid mango
#
@client.event
async def on_member_update(before, after):
    if ".gg" in str(after.activity.name):
      guild = client.get_guild(932840827212931123)
      await after.add_roles(role)
    if ".gg" not in str(after.status.name):
      await after.remove_roles(role)
  role = discord.utils.find(lambda r: r.name == 'promoter', guild.roles)```
slate swan
#

sickk

sick birch