#discord-bots

1 messages Β· Page 644 of 1

slate swan
#

might wanna check your bot's latency

maiden fable
#

Imagine using hours=0.5 instead of minutes=30 smh

Totally me

slate swan
#

πŸ˜‚

upbeat otter
#

stop trolling

#

lmao

maiden fable
#

minutes=5 works

upbeat otter
maiden fable
#

Never referred u

maiden fable
pearl birch
#

it has some really weird rules, the fact that it's doing bracket balancing makes me wonder if they are using regex at all
see how https://en.wikipedia.org) leaves out the ) but https://en.wikipedia.((org)) keeps everything in

upbeat otter
maiden fable
#

^^^

unkempt canyonBOT
#

str.endswith(suffix[, start[, end]])```
Return `True` if the string ends with the specified *suffix*, otherwise return `False`. *suffix* can also be a tuple of suffixes to look for. With optional *start*, test beginning at that position. With optional *end*, stop comparing at that position.
upbeat otter
upbeat otter
pearl birch
maiden fable
upbeat otter
maiden fable
upbeat otter
pearl birch
maiden fable
pearl birch
slate swan
pearl birch
#

if it's not even consistent across platforms

maiden fable
maiden fable
slate swan
#

same

sullen shoal
#

regex looks ugly imo

slate swan
#

i even dropped the idea of having a filter with regex, although i have to use regex for discord invites πŸ˜” ✊

slate swan
pearl birch
#

regex looks ugly yes and so my philosophy is i just need to know how to write regex i don't need to know how to read even my own regex

maiden fable
slate swan
#

because there could also be https://

sullen shoal
pearl birch
slate swan
#

while i could also check that there'd be the issues to when they use spaces to ignore a filter that uses that

maiden fable
pearl birch
slate swan
upbeat otter
#

huh

slate swan
slate swan
pearl birch
#

Here's a challenge: write a regex to detect Discord nitro scam websites

maiden fable
#

Imagine discord providing another message attr which would be message.links and message.invite_links 😐

sullen shoal
slate swan
#

here's my extremely beautiful and complex totally not copied from somewhere discord invite regex 😌 '(?:https?://)?discord(?:(?:app)?\\.com/invite|\\.gg)/?[a-zA-Z0-9]+/?'

pearl birch
maiden fable
#

@slate swan just use str.split() and with a for loop, check if discord.gg is there in any of the words

pearl birch
upbeat otter
maiden fable
#

There's almost everything a way to not use regex

pearl birch
#

because literally fuck regex if there's a list

sullen shoal
kindred drum
#

yo how do I make the bot give someone a role when doing a command e.g. !giverole @unkempt zodiac - gives them a specified role predetermined

pearl birch
maiden fable
#

Eevee be like, let's add another list attr to any of the forks which would be a list of scam links

kindred drum
#

oh god

unkempt canyonBOT
maiden fable
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

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 added [`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.
slate swan
icy mango
#

HI

maiden fable
upbeat otter
maiden fable
#

Everyone waiting for his question πŸ˜„

maiden fable
#

Thought so

sullen shoal
upbeat otter
maiden fable
upbeat otter
maiden fable
#

BTW I am thinking of learning JS hehe

prisma spoke
#
@bot.command()
async def brackets(ctx, n:int):
    with open("usersforteams.json", "r") as f:
        users = json.load(f)
    
    await ctx.send(random.choices(users, k = n))``` this didntwork
icy mango
prisma spoke
#

i got a key error of 0

upbeat otter
kindred drum
#

what parameters do I use

pearl birch
icy mango
#

I m lrning it

maiden fable
sullen shoal
boreal ravine
maiden fable
#

Tho typescript is more popular

boreal ravine
upbeat otter
prisma spoke
boreal ravine
#

my bad then mobile view kinda sucks

kindred drum
#

how come I get an error when I use this code @bot.command() async def addrole(ctx): member = ctx.message.author role = get(member.server.roles, name="Test") await bot.add_roles(member, role)
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attrib
attribute 'server'

boreal ravine
prisma spoke
boreal ravine
upbeat otter
prisma spoke
kindred drum
#

guild.roles?

prisma spoke
#

raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 0

upbeat otter
boreal ravine
unkempt canyonBOT
#

property roles: List[discord.role.Role]```
Returns a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of the guild’s roles in hierarchy order.

The first element of this list will be the lowest role in the hierarchy.
prisma spoke
maiden fable
#

Bruh whenever my phone vibrates from a notification, I feel like Discord mailed me about my bot ;-;

boreal ravine
maiden fable
upbeat otter
upbeat otter
maiden fable
kindred drum
#
``` another error 😭
maiden fable
#

ctx.author.add_roles*

boreal ravine
unkempt canyonBOT
#

exception KeyError```
Raised when a mapping (dictionary) key is not found in the set of existing keys.
upbeat otter
maiden fable
boreal ravine
#

!d discord.Member.add_roles <=

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

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 added [`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.
maiden fable
prisma spoke
boreal ravine
#

@prisma spoke json is empty?

prisma spoke
maiden fable
prisma spoke
boreal ravine
maiden fable
#

My friends gonna laugh too much when they see this message

slate swan
maiden fable
#

Yea that too

maiden fable
#

You need a list

upbeat otter
slate swan
#

you need to give it a list

maiden fable
prisma spoke
prisma spoke
slate swan
upbeat otter
slate swan
placid skiff
slate swan
placid skiff
#

to use a dictionary you need a key

slate swan
#

!e ```py
import random
my_dict = {'a': 1, 'b': 2}
print(random.choices(my_dict))

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 3, in <module>
003 |   File "/usr/local/lib/python3.10/random.py", line 519, in choices
004 |     return [population[floor(random() * n)] for i in _repeat(None, k)]
005 |   File "/usr/local/lib/python3.10/random.py", line 519, in <listcomp>
006 |     return [population[floor(random() * n)] for i in _repeat(None, k)]
007 | KeyError: 1
slate swan
#

it needs a list/tuple

maiden fable
#

Yea

#

U can do dict.items tho

#

Idk I'mma better not say anything and get roasted here

placid skiff
#

to randomize the choice from the dictionary you need to create a list, which elements are equals to list, and randomize like this

upbeat otter
prisma spoke
sullen shoal
#

oh

prisma spoke
#

if i want to get random inputs fromm json file then what do i do?

slate swan
kindred drum
#
async def addrole(ctx):
    member = ctx.message.author
    role = get(member.guild.roles, id="915553473653801031")
    await member.add_roles(member, role)
#

am I special or something

slate swan
kindred drum
#

I get a "no role" error

prisma spoke
maiden fable
unkempt canyonBOT
lament mesa
prisma spoke
#

dont include quotes

lament mesa
#

and ids are integers

maiden fable
#

ctx.guild.get_role(id)

slate swan
kindred drum
#

ah

slate swan
maiden fable
#

Best thing to do is guild.get_role(int("1234567890"))

slate swan
sullen shoal
#

uh

placid skiff
unkempt canyonBOT
#

@placid skiff :white_check_mark: Your eval job has completed with return code 0.

2
placid skiff
#

see?

boreal ravine
maiden fable
#

You can't assign values to constants like ints @sullen shoal

prisma spoke
maiden fable
slate swan
boreal ravine
sullen shoal
maiden fable
#

Welp this just became chaotic, I'mma do something else

prisma spoke
#

?

kindred drum
#
async def addrole(ctx):
    member = ctx.message.author
    role = get(guild.get_roles(915553473653801031)
    await member.add_roles(member, role)
```Unknown Role
boreal ravine
#

@prisma spoke no

kindred drum
#

waitno get

slate swan
#

that's not a dict

boreal ravine
#

use ur json object

slate swan
#

^^

#

it's a dict object but that works too

boreal ravine
#

name it something else though

prisma spoke
boreal ravine
#

users is already ur json variable name

sullen shoal
boreal ravine
kindred drum
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'guild' is not defined

#
async def addrole(ctx):
    member = ctx.message.author
    role = guild.get_roles(915553473653801031)
    await member.add_roles(member, role)```
prisma spoke
tawdry perch
#

I'm back = time for random questions

boreal ravine
kindred drum
#

im gonna shoot muself

sullen shoal
#

json.load returns dict object

boreal ravine
tawdry perch
kindred drum
boreal ravine
kindred drum
#

Unknown Role

slate swan
#

your id is wrong

boreal ravine
#

role doesnt exist

slate swan
#

^ that too

tawdry perch
#

I passed None, but the role still exists in channel ```py
await ctx.channel.set_permissions(role, overwrite=None)

kindred drum
#
async def addrole(ctx):
    member = ctx.message.author
    role = discord.utils.get(member.guild.roles,id=915553473653801031)
    await member.add_roles(member, role)``` Unknown role but the role is correct
prisma spoke
kindred drum
#

like i have checked

prisma spoke
slate swan
prisma spoke
#
    users = json.load(f)

my_list = [k for k in users]

@bot.command()
async def brackets(ctx, n:int):
    
    await ctx.send(random.choices(my_list, k = n))```
#

its defined

slate swan
#

yeah it should work

kindred drum
tawdry perch
#

How can I delete role from channel? I tried this, but it still exists. ```py
await ctx.channel.set_permissions(role, overwrite=None)

#

the role still has permission values in there

slate swan
#

weird, it should work

tawdry perch
#
    @commands.command()
    async def get_permissions(self, ctx, role: disnake.Role):
        a = ctx.channel.permissions_for(role)
        print(a)
``` gave me a valid permission integer with same permissions for that role as before
slate swan
#

weird pithink

tawdry perch
#

it has been weird for past 2 days sigh

#

hmm

prisma spoke
#
@bot.command()
async def brackets(ctx, n:int):
    
    await ctx.send(random.choices(my_list, k = n))``` i want to add certain limitations such as one choice shudnt be repeated
tawdry perch
#

nope, that did not work

prisma spoke
#

and that it shud display in a certain form like

choice 1 = (choicehere) vs (choice2here)
kindred drum
#

okay now i get no errors but it does nothing

prisma spoke
#

@slate swan ..

slate swan
#

nvm it does not

kindred drum
#

@bot.command()
async def addrole(ctx):
member = ctx.message.author
role = discord.utils.get(member.guild.roles,name="Verified")
await member.add_roles(role)
wait how do I make it so it gives the @strange crest user a role?

unkempt canyonBOT
#

random.sample(population, k, *, counts=None)```
Return a *k* length list of unique elements chosen from the population sequence or set. Used for random sampling without replacement.

Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allows raffle winners (the sample) to be partitioned into grand prize and second place winners (the subslices).

Members of the population need not be [hashable](https://docs.python.org/3/glossary.html#term-hashable) or unique. If the population contains repeats, then each occurrence is a possible selection in the sample.
slate swan
#

!e ```py
import random
my_list = [1, 2, 3, 4, 5, 6]
print(random.sample(my_list, 2))

unkempt canyonBOT
#

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

[4, 6]
kindred drum
#
async def addrole(ctx):
    member = ctx.message.author
    role = discord.utils.get(member.guild.roles,name="Verified")
    await member.add_roles(role)```
wait how do I make it so it gives the @ ed user a role?
slate swan
#

that only gives the role to the author

kindred drum
prisma spoke
slate swan
prisma spoke
prisma spoke
slate swan
#

it returns a list

#

so just index that list

#

i am trying to make my discord bot to update my database but its not updating

@bot.command()
async def start(ctx):
    player = ctx.author
    conn = sqlite3.connect('test.sql')
    c = conn.cursor()
    c.execute(f'UPDATE data SET start_used = start_used+{player.id} WHERE ID = {player.id}')
    conn.commit()
    if c.execute(f"SELECT * FROM data WHERE start_used={player.id}"):
        return await ctx.reply("Command already used by this member.")
    c.execute(f"INSERT INTO data VALUES ('{player.id}', 100, 0, 0, 0)")
    conn.commit()
    conn.close()
    await ctx.send('you have started your journey with **100:nexus:** in your balance')```
#

there are 3 ids when i tried to run this command when a 4th id its saying "command already used by this member"

prisma spoke
#

oh so like ```py
a = (random.sample(my_list, k= n))
b=a[0]
c=a[1]
await ctx.send(f"{b} vs {c}")

prisma spoke
#

also why is there f string

#

ur format is wrong

#

i helped u earlier with that

#

check that msg

kindred drum
#
async def addrole(ctx):
    member = ctx.message.member.mention
    role = discord.utils.get(member.guild.roles,name="Verified")
    await member.add_roles(role)``` "message" has no object attribute member
#

anyone can resolve?

prisma spoke
velvet tinsel
#

Code fixed

kindred drum
#

AttributeError: 'str' object has no attribute 'guild'

velvet tinsel
kindred drum
#

@bot.command()
async def addrole(ctx):
member = ctx.author.mention
role = discord.utils.get(member.guild.roles,name="Verified")
await member.add_roles(role)

maiden fable
#

Nothing more, nothing less

kindred drum
#

what I put in parenthesis?

#

ctx? author?

velvet tinsel
#

No

kindred drum
#

i mean like as parameter

velvet tinsel
#

ctx.author

#

Not ctx.author.mentions

slate swan
velvet tinsel
#

That’s mentioning the author πŸ€¦β€β™‚οΈ

manic wing
velvet tinsel
velvet tinsel
slate swan
slate swan
manic wing
#

i thought you got muted for that

prisma spoke
slate swan
#

also if any mods see this i only agreed i wasn't the one who just said that don't ban me again πŸ‘Œ

manic wing
#

oh wait i was there

prisma spoke
#

Kraots is confusing

manic wing
#

tf

slate swan
kindred drum
slate swan
manic wing
#

im thinking of the I pay for WINRAR dude

tawdry perch
#

I passed None but the role permissions are same as before

manic wing
kindred drum
slate swan
manic wing
#

set_permissions(member, send_message=False)

prisma spoke
manic wing
slate swan
#

i did get muted for that but after that i got banned too, while like 10m into my mute

tawdry perch
manic wing
#

same thing

tawdry perch
#

I'm trying to remove it from channel completely

slate swan
kindred drum
#

async def giverole(ctx, user: discord.Member, role: discord.Role): how do I make the role a specified role

velvet bear
kindred drum
#

?

manic wing
#

!d discord.Member.add_roles || member.add_role(role), where member is an instance of discord.Member

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

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 added [`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.
potent light
#

I am making a group of commands and I want to check if the user is subscribed or not. If subscribed, I want to allow them to use the sub-commands otherwise I will send them the link where they can subscribe.
The question is, how do I forbid a sub-command from being used?
e.i:
!mmo profile (mmo is parent, profile is child command).

tawdry perch
#

How can I delete role from channel? I tried this, but it still exists. ```py
await ctx.channel.set_permissions(role, overwrite=None)

 I'm trying to get rid of that role from current channel
the role still has permission values in there
slate swan
#

hey quick question what does "const lib = require" mean?

rare saddle
#

Please tell me why the check does not work and the person who is on the blacklist can create reports?

hazy agate
#

hi guys

slate swan
#

hello

hazy agate
#

ooo

#

!d code welcome

unkempt canyonBOT
#

Source code: Lib/code.py

The code module provides facilities to implement read-eval-print loops in Python. Two classes and convenience functions are included which can be used to build applications which provide an interactive interpreter prompt.

hazy agate
#

sheesh

#

see

slate swan
hazy agate
#

with what

slate swan
#

code

hazy agate
#

coding

slate swan
#

what does "const lib = require" mean?

hazy agate
#

BOT?

slate swan
#

ye

hazy agate
#

idk this command

slate swan
#

i want to check if a specific role is removed from any user in my server. Is there an event for that?

hazy agate
#

anything sir?

slate swan
#

nah

hazy agate
#

o

slate swan
#

E

hazy agate
#

u wanna see my codes?

unkempt canyonBOT
#

Hey @hazy agate!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

β€’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

β€’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

hazy agate
#

this kid

#

no

#

no

velvet tinsel
#

@slate swan how did you get banned but come back?

#

I do not understand

hazy agate
#

i thnk he is a massive hecker

#

LOL

velvet tinsel
rare saddle
hazy agate
#

ye

sage otter
hazy agate
#

and its java

#

i mean js

#

i love py

velvet tinsel
#

Java and javascript are two different things, I used to get them mixed up

hazy agate
#

am doing everything with py

maiden fable
hazy agate
#

ooooooo

sage otter
#

Yeah that’s what I thought

velvet tinsel
#

apparently, someone said "Java is as different as JavaScript as ham is to hamster"

unkempt canyonBOT
#

Hey @hazy agate!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

β€’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

β€’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

hazy agate
#

aaaaaaaaaaaaaaaa

rare saddle
#

Please tell me why the check does not work and the person who is on the blacklist can create reports?

unkempt canyonBOT
#

Hey @hazy agate!

It looks like you tried to attach file type(s) that we do not allow (). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

hazy agate
#

aaaaaaaa

#

t

#

can someone help with yotube dl

kindred drum
velvet tinsel
#

.....yay

#

πŸ₯³

sage otter
#

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

velvet tinsel
#

I do that sometimes

#

*cough*

potent light
#

πŸ₯³

#

does anyone need help?

slate swan
velvet tinsel
#

not yet, I fixed my code

sage otter
#

Yes

slate swan
#

yes it is but it isn't shown in the server audit-log

hazy agate
#

so that means

#

music help is not here

potent light
#

If before.premium_suscriber_role > after.premium_subscriber_role:.

sage otter
#

what.

slate swan
#

wait so what does it check exactly? I don't quiet understand it

sage otter
#

you don’t compare those objects like that.

#

use the premium_subscriber_count attr.

potent light
potent light
hazy agate
#

g

#

g

slate swan
#

@potent light I basically want to check if a user is not a Serverbooster anymore and it logs it in a channel.

I have this atm but i don't know if it works

@bot.event
async def on_member_update(before, after):
    role = blablbal
    channel = blablabla
    if role in before.roles:
        await channel.send(f"{after.mention} is not a Booster anymore.")
hazy agate
#

bruh

potent light
slate swan
sage otter
#

To actually make sure you're getting what you want

#

Id add inside the logic

#

and role not in after.roles

slate swan
#

shouldn't it be the same tho?

#

basically you say

if bla != lol and lol != bla

sage otter
#

It checks if the role was in the members before update roles and checks if it’s in their after update roles

sage otter
slate swan
#

hm okay

potent light
sage otter
#

You can’t manually add a booster role to someone

slate swan
#

That's not the point

sage otter
#

Discord does boost role handling for you. All you can do is control is the role it gives

slate swan
#

Normal Booster Roles are not shown in the Audit Log

upbeat otter
slate swan
#

wdym

upbeat otter
#

Ummm

#

Nvm good luck

slate swan
#

thx

rapid pilot
#

Hello, I need some suggestions. I want to develop a discord bot but is actually out of ideas. So do you have any idea like for "what kind of purpose" shall I develop one?

maiden fable
rapid pilot
maiden fable
#

No cap, but there's a shortage of ideas

rapid pilot
#

any small functionality you think that it might be of some use?

dense swallow
rapid pilot
dense swallow
#

There's at least one bot which has every features

rapid pilot
upbeat otter
#

Lol

maiden fable
#

Idk where I saw it

#

But then dbm is also always there haha

upbeat otter
maiden fable
#

o

#

why do I feel like u know literally everything

#

Hmmmmmmmmmmmmmmmmmmmmm Amen πŸ™

upbeat otter
maiden fable
#

Why tho

upbeat otter
maiden fable
#

Cz u r a Goddess hehe

slate swan
#

simp

#

:kek:

maiden fable
#

Hunter

upbeat otter
maiden fable
#

:kek:

maiden fable
#

Discord do be slow today

upbeat otter
#

@maiden fable oh my goodness, i see the closing curly bracket in your about me xD

maiden fable
#

🀣 at last

#

Hail Discord

upbeat otter
tawdry perch
#

How can I delete role from channel? I tried this, but it still exists. ```py
await ctx.channel.set_permissions(role, overwrite=None)

 I'm trying to get rid of that role from current channel
the role still has permission values in there
maiden fable
#

how tf am I gonna read all this smh

maiden fable
maiden fable
upbeat otter
maiden fable
upbeat otter
maiden fable
#

ok

upbeat otter
maiden fable
upbeat otter
maiden fable
#

no lol

upbeat otter
#

Lmao

maiden fable
#

We still get updates

cloud dawn
unkempt canyonBOT
#

property changed_roles: List[discord.role.Role]```
Returns a list of roles that have been overridden from their default values in the [`roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.roles "discord.Guild.roles") attribute.
upbeat otter
maiden fable
maiden fable
cloud dawn
upbeat otter
maiden fable
tawdry perch
cloud dawn
slate swan
#

@sage otter Okay the role got detected. My code if you want to use it somewhere:

@bot.event
async def on_member_update(before, after):
    role = discord.utils.get(bot.guild.roles, id = 9999999999999999)
    if role in before.roles and rolle not in after.roles:
        print(f"{after.mention} is no booster anymore.")
#

no print actually a channel.send

#

but anyways yeh

tawdry perch
maiden fable
#

Then do it lol

tawdry perch
tawdry perch
cloud dawn
tawdry perch
#

Ah makes sense

velvet tinsel
#

I need to join this "disnake" server

#

hai @cloud dawn , have you brought any beers?

cloud dawn
#

🍻

#

Always

velvet tinsel
#

❀️

#

beer 🍻

#

I fixed my problem *yay*

#

it was a stupid problem as well, forgot to put a () on lower() ;-; couldn't figure it out for 2 days

slate swan
tawdry perch
#

Ooof

slate swan
cloud dawn
#

milk is ok

slate swan
velvet tinsel
slate swan
#

Milk gang😀

velvet tinsel
slate swan
velvet tinsel
#

I drink it everyday

slate swan
#

Cereal with milk

#

Good

slate swan
#

How can i add the emoji to the button

      components = [
          Button(
              style=ButtonStyle.URL,
              custom_id="insta",
              label=":NaN: Instagram account",
sage otter
#

emoji kwarg

#

emoji="insertemojihere"

slate swan
#

Hey, how to look if a given role in a given channel has send_messages as permissions?

maiden fable
#

!d discord.Role.permissions

unkempt canyonBOT
slate swan
# sage otter `emoji="insertemojihere"`

like this?

      components = [
          Button(
              style=ButtonStyle.URL,
              custom_id="insta",
              label="Instagram account",
              
              url=f"https://www.instagram.com/{message}/",
              emoji=":instagram:"
          )
      ])
slate swan
#

Im specifically asking for channel permissions

maiden fable
#

O

#

!d discord.TextChannel.overwrites

unkempt canyonBOT
#

property overwrites: Dict[Union[Role, Member], PermissionOverwrite]```
Returns all of the channel’s overwrites.

This is returned as a dictionary where the key contains the target which can be either a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") or a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") and the value is the overwrite as a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite").
slate swan
#

Uh and how to look if role (as discord.Role) has a specific permission?

maiden fable
#

It will return a dict of role object to a permissionoverwrite object

#

!d discord.PermissionOverwrite

unkempt canyonBOT
#

class discord.PermissionOverwrite(**kwargs)```
A type that is used to represent a channel specific permission.

Unlike a regular [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the default value of a permission is equivalent to `None` and not `False`. Setting a value to `False` is **explicitly** denying that permission, while setting a value to `True` is **explicitly** allowing that permission.

The values supported by this are the same as [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions") with the added possibility of it being set to `None`.

x == y Checks if two overwrites are equal.

x != y Checks if two overwrites are not equal.

iter(x) Returns an iterator of `(perm, value)` pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.
slate swan
#

Ok uh

#

So

#

Can I just do

if ctx.channel.overwrites[role]["send_messages"]:
    ...

?

maiden fable
#

Lemme see

#

yea ig

slate swan
#

Cool ok thx

maiden fable
#

Or try

#

!d discord.PermissionOverwrite.pair

unkempt canyonBOT
#

pair()```
Tuple[[`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions")]: Returns the (allow, deny) pair from this overwrite.
slate swan
#

Uhhh

#

Whats the code then?

tawdry perch
maiden fable
#

no

slate swan
#

Yea it is

tawdry perch
#

I thought because of

slate swan
#

Normally it shows blue teyt without the link lmao

lament mesa
#

it takes some time to load

slate swan
maiden fable
slate swan
#

O looks different on mobile

tawdry perch
#

Ye

slate swan
maiden fable
#

nvm ignore that

#

Try your old code

slate swan
#

That returns that the object isnt subsvriptable

slate swan
slate swan
#

Put that <:emojiname:id> inside there

#

in the label or there?

#

Yes like that

#

yes but it doesnt work

#

it doesnt send the embed

#

Ok then idk I just said what they said lmao

#

πŸ˜πŸ™πŸ’€

slate swan
#

Bruh now it says its a dict....???

#

Nvm I got it now

#

Channel().overwrites[role].send_messages

sage otter
#

Not sure if passing the emoji like that will work tho AMshrug

velvet tinsel
#

I need to do buttons soon

#

and join this "disnake" server thing

#

I have never used buttons before.
unfortunately, now comes a time I do

slate swan
sage otter
#

You could do that but do you need to

slate swan
#

maybe bc its a custom emoji idrk

sage otter
#

If the emoji is in a server the bot is in then that’s not the problem

#

Put a backslash behind the emoji and send it and use that instead

#

For example

slate swan
#

i have it already

sage otter
#

And that doesn’t work you said?

slate swan
#

yes

sage otter
#

Then your bot can’t see that emoji

slate swan
#

how

sage otter
#

Is the emoji in a server your bot is in?

slate swan
#

yes

sage otter
#

What does the error say. When you do it like that.

#

Mine works perfectly fine with that.

slate swan
#

To get the emoji object, you gotta do

emoji = discord.utils.get(Guild().emojis, id=the id as int)
slate swan
sage otter
#

He doesn’t need to do that tho

slate swan
#
 raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.emoji.name: Invalid emoji
#

Yea but in case

slate swan
#

LMAO

#

XD

#

How good I sent it just in case

magic stump
#

If i convert file pyw to exe. Script will hide on taskbar?

narrow tide
#

hi, I'm trying to make a discord bot that sents a message everytime a variable is odd

narrow tide
drifting tulip
#

odd?

wicked atlas
#

So I've come across https://deta.sh, and I just want to know, has anyone tried to use this for a Discord bot, or something else? It looks great, but I know there has to be a catch

kind fern
#

So for the Datetime module, how do you set the time zone as EST?

narrow tide
kind fern
#

;~;

slate swan
wicked atlas
#

Well you can host a discord bot with an API and interactions

#

I'm just trying to figure out if it has issues like repl.it does

sage otter
# narrow tide yes, an odd number

just basic logic. check if the number is odd with the modulo operator by checking if the remainder of a number and 2 is not 0. If it’s not 0 use
Messageable.send to send the message.

slate swan
#

from __future__ import annotations do i need a module for this or is this pre included in python. i found it in robodannys cog util for paginators but ive never seen it before and i cant install it

velvet tinsel
#

from __future__ import braces

dire folio
#

how do i get a channels id?

velvet tinsel
#

πŸ˜‚

velvet tinsel
dire folio
#

isn't that the servers id?

slate swan
velvet tinsel
#

ctx.channel.id I suppose

dire folio
#

ye thx

slate swan
#

plz help

sick birch
#

At the start, yeah, it looks awesome but you'll probably end up finding out it has a lot of restraints

dire folio
#

for date.today() does anyone know how to get it in the format dd/mm/yyyy

#

instead of the normal yyyy/mm/dd

slate swan
#

convert it to a string

#

split it at the slashes

#

and reorder it as you want

#

at least thats how i'd do it

cloud dawn
slate swan
#

everyone does mistakes

cloud dawn
#

I give up

wicked atlas
#

!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).
cloud dawn
#

Extra datetime ofc... this module yert

manic wing
#
class datetime(datetime.datetime):
  def __init__(self):
    self.datetime = self``` infinite `datetime.datetime.datetime.datetime`? hehe
cloud dawn
#

illegal code

pliant gulch
#

self.datetime would be a datetime object not the module so you wouldn't be able to do datetime.datetime

#

You should use __import__("datetime") instead, that would probably work

pliant gulch
dire folio
#

i have this command but when you do smth like this $suggest test again. it will only put the word test in the embed and not test again. heres the code

@client.command()
async def suggest(ctx, description):
    authid = ctx.author.id
    embed = discord.Embed(title='**Submitter**', description=f'{ctx.author}', inline=False)
    embed.add_field(name='Suggestion', value=description)
    embed.set_footer(text=f'User ID: {authid} β€’ {datetime.strftime(date.today(), "%d/%m/%y")}')
    embed.set_thumbnail(url=ctx.author.avatar_url)
    channel = ctx.guild.get_channel(763131896045502474)
    msg = await channel.send(embed=embed)
    await msg.add_reaction('πŸ‘')
    await msg.add_reaction('πŸ‘Ž')
#

nvm i got it

boreal ravine
sick birch
#

No they probably want to consume it all in one

#

In which case you have to make it like if you were putting in keyword arguments

#

i.e

async def suggest(ctx, *, description):
  # code here

rather than

async def suggest(ctx, description):
  # code here
kindred drum
#

is it possible to make a bot category specific>

sick birch
#
on_message:
  if message_in_category:
    process_commands()
  return
narrow notch
#

What's the difference between listen() and event

full lily
#
class RelativeDate(Converter):
    async def convert(self, ctx, argument: str) -> arrow.Arrow:
        ...

class Epoch(commands.Cog):
    @commands.command()
    async def epoch(ctx date_time: RelativeDate): 
        epoch = date_time.timestamp()  # Cannot find reference 'timestamp' in 'RelativeDate' 

I have a warning come up that timestamp() does not exist for my converter, RelativeDate. The code works, however I'm wondering if I'm doing something wrong here in regards to typehints

sick birch
# narrow notch What's the difference between listen() and event

You can have multiple listeners that all get triggered at once, unlike event, which you can only have one of. In the case of on_message, you don't have to process_commands with a listener while you do have to with an event. This can sometimes come in handy, like the case I was explaining above. Sometime's it's not, in which case you can use a listener.

sick birch
full lily
sick birch
full lily
#

It's saying that the converter class RelativeDate has no method timestamp

#

Which is True, I guess

sick birch
#

Well yeah, date_time is going to be turned into a RelativeDate class

full lily
#

but I return arrow.Arrow

sick birch
#

Python typehints really do nothing in function except in cases like discord.py

#

In this case it's different

slate swan
#

who can help me make a queue command

sick birch
#

For example, Python won't complain when you do something like so:

myString : str = 5

Even though you say it should be a string.

full lily
#

Python doesn't complain but my ide would

sick birch
#

Back to the question, what are you returning for convert()?

patent surge
#

I have discord.Guild object how I will generate invite link from it ?

slate swan
#

help, i want to delete the messages of more 20 letters of length except in the flood channel, but the bot delete the message in all channels and i dont want that, can help me?

the code:
´´´py
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.channel.id == "895281353791258654":
return
else:
if len(message.clean_content) > 20:
await message.delete()
#do stuff here
´´´

full lily
#

it's an arrow.Arrow object, which has the method timestamp() that I need later on

#

This isn't the only example of this warning, by the way

sick birch
#

Can you send how your arrow.Arrow class looks like?

full lily
#

It's from the arrow lib

sick birch
full lily
#

It's a warning, yes

sick birch
#

Through the console?

full lily
#

No, no. The code works fine

#

It's a warning through the ide

sick birch
#

Yeah I''m starting to see what you mean, it seems more like an IDE/linter warning

#

Discord.py does some funky stuff with converters, so there's really not much you can do about it

full lily
#

I've not worked with converters before and I was thinking i've done something weird

sick birch
#

No no, it's just how discord.py works with converters

full lily
#

That's a little reassuring

sick birch
# patent surge ???

If I were to guess, I'd go to the documentation, find discord.Guild, and look under the methods section (2nd column)

#

Probably create_invite() or something along those lines, the docs are very well outlined and have good semantics

magic ore
#

You can only create an invite of a channel

sick birch
#

Fair point

#

Same thing would apply then, except with a TextChannel

slate swan
#

@sick birch can you help me make a queue command

sick birch
#

Would you look at that, I guessed right haha

sick birch
slate swan
#

ok my question is how do I make a queue command

sick birch
#

You want a general idea?

slate swan
#

like how do I do it

sick birch
#

Here's how I would do it: have a queue command, and some sort of data structure for holding a queue. You might also be able to make some sort of Track class, which you can put within that list. After each track is done playing, you can move on to the next one and pop the first one.

#

Perhaps some sort of play() function within the Track class would help

sick birch
#

I just told you how

narrow notch
#

await msg.edit(content="")
Or
await msg.edit(name="")

narrow notch
#

Ok thx

slate swan
sick birch
#

I suppose I could try

#

Though I've never built a music system before

slate swan
#

dm's? It'll take a while probably

sick birch
#

I don't do dm help sorry

#

Also worth mentioning that you probably will fare better if you attempt it on your own, and ask specific questions here rather than "can you walk me through from start to finish on exactly what to do"

slate swan
#

so can you help me

sick birch
#

On specific questions but not necessarily the whole thing

slate swan
sick birch
#

Like I said I've never built a queue system before, so I can only help with the general idea, the structure, and some specifics with the library itself

#

I've already given you a general idea and a structure

#

I suggest you take it from there and try your best to build a working system, me and others here would be more than happy to help with specifics

slate swan
#

I can post my code

sick birch
#

Sure post it and i'll take a peek

slate swan
#

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

sick birch
#

That's a start, how well does it work?

#

Also I can't help with YTDL, as it violates TOS but I will help with discord.py's voice features.

slate swan
lyric moat
#

why does this does not work? when im trying thubnail it send error to the other part of the code

    embed = discord.Embed(title="", color=0x2f3136, description=f"",
  embed.set_thumbnail(url="")```
slate swan
sick birch
slate swan
sick birch
#

first in first out method

#

it'll act as your queue

lyric moat
#

i just took it out

slate swan
#

whats the error code? @lyric moat

#

@sick birch I got no clue what that is. can I see an example

lyric moat
#

its an button command im trying and it keep sending error its say

  File "main.py", line 61
    await buttons.send(
    ^
SyntaxError: invalid syntax`````
sick birch
slate swan
sick birch
#

Instead of using numbers like I did, you would probably use some sort of class that represents a music track

slate swan
#

so where would it go in my code

sick birch
#

Anywhere, it's only a datastructure

lyric moat
slate swan
slate swan
sick birch
slate swan
sick birch
#

I can give you some psuedocode:

class Queue:
  def __init__(self):
    # initialize a list
  def remove(self):
    # code
  def add(self, item):
    # code
  # any other methods you may need
#

Then you can do something like this:

q = Queue()
q.add(someSong1)
q.add(someSong2)
q.remove()
slate swan
#

see im confused

sick birch
#

We're only making a datastructure that will hold the songs that we want to play one after the other

#

The queue class is just a wrapper for a list

#

When you add objects, it puts them at the end of the list. Removing starts from the front of the list. Hence the FIFO method

#

In your queue command, you would add the song to the queue. Once it's done laying, using the after= of the play() method, you would remove the song and move on to the next

slate swan
#

???????????????

sick birch
#

Well to make a queue system we need something to hold all the songs we want to play yes?

#

So that when we finish one song, we move on to the next, yes?

#

That's why I'm suggesting you implement a queue class

#

though if you need help with building the queue class you should move to #algos-and-data-structs and a queue is a datastructure

slate swan
sick birch
#

No you'll need to fill in the methods yourself

#

I only gave you a skeleton to work with

slate swan
#

methods?

sick birch
#

Methods such as add(), remove(), etc...

slate swan
#

and what would I need to add to the play command

sick birch
#

Be glad you have to write this in Python, our teacher made us write this in Java with nothing but arrays. It was a nightmare.

sick birch
slate swan
#

to the play command

sick birch
#

Well you already have a play command working

slate swan
#

so I dont need anything else there

sick birch
#

Only thing you might need is a system to handle what happens after a track finishes playing

#

IIRC discord.py provides an after= kwarg that tells it what to do after it finishes playing a song

slate swan
#

can you just give the code

#

im confused

#

or make a video

sick birch
#

No, I will not give you the code

#

That won't help you learn

slate swan
#

what if I dont want to learn

half sun
#

Then you won't have a bot?

sick birch
#

Then I'm still not giving you code that you can just copy paste becuase I'm not being paid to do it

half sun
sick birch
#

True, but I'm not going to explicitly write specific code for someone unless I'm being commissioned for it.

final iron
#

Looking at your image manipulation cog, isn't PIL blocking?

half sun
#

How do you mean by blocking

final iron
#

Not async

daring olive
#

@half sun hi zenyx, please don't share links to projects that implement youtubedl or other ToS breaking aspects

half sun
#

Yes I don't believe PIL is asynchronous

sick birch
#

I mean all it takes is for it to miss a heartbeat to the gateway servers and bam

final iron
lyric moat
#

how can i added a thumbnail on this?

    embed = discord.Embed(title="", color=0x2f3136, description=f"**Faded Help Layout**\n\n![faded_tool](https://cdn.discordapp.com/emojis/915747082789355562.webp?size=128 "faded_tool") **bot info**\nPrefix: **`//`**\nGuilds : **`{len(client.guilds)}`**\n\n![faded_owner](https://cdn.discordapp.com/emojis/915747745166393394.webp?size=128 "faded_owner") **bot updates**\n__nothing found__")```
half sun
#

I wouldn't consider it a "long" process. It's done within a fraction of a second

sick birch
#

All it takes is for someone to run the command at the wrong time

daring olive
#

@sick birch i appreciate your efforts in coaching/teaching but please don't further assist that user with the music features of their bot

half sun
#

I mean I've had the bot hosted for 8 ish months on several servers without s hitch

sick birch
#

Anyway something else then haha?

sick birch
#

Yes, don't embeds have a thumbnail kwarg?

#

Either that or embed.set_thumbnail()

final iron
#

!d discord.Embed

unkempt canyonBOT
#

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

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

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

New in version 2.0.

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

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

!d discord.Embed.set_thumbnail

unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
sick birch
#

spotted

#

Well there's your answer then @lyric moat

lyric moat
#

i did but it would not work

final iron
sick birch
#

Hover over the red squiggly, what does it say?

wicked atlas
# lyric moat

You're missing a closing parenthasies at the end of your Embed(). The line just before embed.set_thumbnail()

lyric moat
#

yep

pseudo flicker
#

hi i want to make a reboot command in case i need to restart my bot for applying new changes without having to close the terminal.
here's my code:

#

(for the reboot command)

#

the code above was from stackoverflow and from the discordbots subreddit after a quick google search, but it just closes the terminal and somehow causes the bot to run without the terminal (however, it double sends responses)
i even tried await bot.close() or await bot.logout() but it closes the terminal and the bot and never reactivates it unless i reload the script again.

wicked atlas
#

Here's a tip on how to do a reboot command: don't. Instead, you should start using Extensions and Cogs, which can be loaded and unloaded without stopping the program.

pseudo flicker
#

oh ok...

#

imma start learning that

wicked atlas
#

It makes it easier to organize your code too

pseudo flicker
#

ahhhh this is better thank uuu

sick birch
#
embed.set_thumbnail(url="https://example.website.com")
wicked atlas
sick birch
#

also if you're setting title to an empty string, you can just omit it completely

compact creek
#

I am a very unexperienced coder. Anyone know how i can fix this in repl.it?

#

@sick birch ?

#

nevermind im an idiot theres legit a button sorry for the ping

wicked atlas
compact creek
#

yea thank you

sick birch
#

why spoonfeed?

#

its aight

#

hm

#

it is the bot is really finnicky

#

i don't see why not

#

ikr

#

3 liner if you include the decorator, function declaration, and actual code

final iron
#

Are yall looking for this

#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

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 added [`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.
sick birch
#

Yeah thanks

slate swan
#

No need for the str converter

#

Just bot.get_user(int)

#

Yeah its a id

#

Any erros?

#

Oh wait i thought you ment a member object

#

Yeah idk how sorry

karmic totem
#
-discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized```
karmic totem
sullen shoal
#

show entire trackback

#

@karmic totem

#

get the member

unkempt canyonBOT
#

Hey @karmic totem!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

β€’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

β€’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

karmic totem
#

raceback (most recent call last):
File "main.py", line 23, in <module>
bot.run('token')
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nex
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/http.py", line 380, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/http.py", line 335, in request
raise HTTPException(response, data)
nextcord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized

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

Traceback (most recent call last):
File "main.py", line 23, in <module>
bot.run('token')
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 666, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 645, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 608, in start
await self.login(token)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 476, in login
data = await self.http.static_login(token.strip())
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/http.py", line 384, in static_login
raise LoginFailure('Improper token has been passed.') from exc
nextcord.errors.LoginFailure: Improper token has been passed

sullen shoal
#

look at the last line

karmic totem
#

yeah but its not

sullen shoal
#

it is

karmic totem
#

it was straight from dev portal

sullen shoal
#

it checks for it and then shows that

#

is it an env variable

slate swan
#
    @commands.command()
    async def suggest(self, ctx, arg1, arg2):
        await ctx.channel.purge(limit=1)
        em = discord.Embed(title=f"{arg1}", description=f"{arg2}", color=0x811aff)
        em.set_author(name=f"{ctx.author}", icon_url=f"{ctx.author.avatar_url}")
        em.set_footer(text=f"Suggested by {ctx.author}")
        await ctx.send(embed=em)```

okay, so i have this suggestion command set up. how would i work it so that instead of each arg being separated by a space be separated by a comma or something else, so that for example, arg 1 could be "add a music bot" and arg 2 could be "you should add a new music bot because groovy is discontinued"

if that makes sense
sage otter
#

If that’s the case you only need to pass one argument into the signature

#

and just use str.split() on that one argument.

#

!d str.split

unkempt canyonBOT
#

str.split(sep=None, maxsplit=- 1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).

If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters (for example, `'1<>2<>3'.split('<>')` returns `['1', '2', '3']`). Splitting an empty string with a specified separator returns `['']`.

For example:
slate swan
#

okay thank you

lyric moat
slate swan
#

Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'

#

im getting that error, how do I fix it?

sullen shoal
#

!d discord.Guild.get_member

unkempt canyonBOT
slate swan
#
intents = discord.Intents().all()
intents.members = True
bot = Bot(command_prefix='+', intents=intents) #Prefix for the bot
bot.remove_command('help')

i'm pretty sure something in there is raising: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'

sullen shoal
#

yeah how else are you going to get member

#

discord needs to know from which guild

#

idk tbh i have a way but i would rather not tell that because its slow, there must some other way and not that

prisma spoke
#
my_list = [k for k in users]

@bot.command()
async def brackets(ctx,*,n:int,p:int):
    h=0
    while h!=p:
        a = (random.sample(my_list, k= n))
        b=a[0]
        s=a[1]
        await ctx.send(a)
        await ctx.send(f"{b} vs {s}")``` this isnt workn
worthy wagon
#

File "/root/caseclosed/cogs/verify.py", line 41, in on_raw_reaction_add
await channel.send(embed=embed)
AttributeError: 'NoneType' object has no attribute 'send'

#

can you not do channel.send anymore?

wicked atlas
#

get_channel tries to fetch the channel from the bot's cache. If the channel is not in the cache, it returns none. Do something like this instead

channel = self.bot.get_channel(909942444555116594) or await self.bot.fetch_channel(909942444555116594)
#

this will fetch the channel from the API if it's not found in the cache

worthy wagon
#

Appreciate it

sullen shoal
#

!d discord.User.mutual_guilds

unkempt canyonBOT
#

property mutual_guilds: List[Guild]```
The guilds that the user shares with the client.

Note

This will only return mutual guilds within the client’s internal cache.

New in version 1.7.
sullen shoal
#

this could be a good way

sick birch
wicked atlas
sick birch
#

Channel might be locked for the bot

wicked atlas
#

Your bot dosen't have access to that channel is my guess

worthy wagon
#

it has all perms

#

and it can literally view the channel

sick birch
#

how can you be sure

#

also, when you invited the bot, did you check the guild checkbox for the oauth2 scope?

worthy wagon
#

yes

worthy wagon
upbeat otter
#

@worthy wagon May I ask a question?

worthy wagon
#

yo

sick birch
worthy wagon
#

Yes I did

sick birch
#

That's super odd

wicked atlas
upbeat otter
#

Whats the point of verifying like this? No Offense, just asking, btw whats the problem youre facing

sick birch
#

that's what i'm thinking too

sick birch
upbeat otter
sick birch
#

personally i prefer to use buttons but both work

worthy wagon
#

I'm not in the mood to deal with buttons bro

wicked atlas
#

Well, technically they can, because automated accounts can add reactions

worthy wagon
#

cause of stupid errors like these for instance

#

I already have a bot that is pretty much all buttons

upbeat otter
#

Did you enable intents?

sick birch
worthy wagon
#

yes

upbeat otter
#

Interesting

worthy wagon
#

I always enable all intents, and give my bots the required permissions, and sometimes just admin if I'm lazy.

sick birch
#

try giving it admin now

worthy wagon
#

it has admin

sick birch
#

i see

worthy wagon
#

it has all perms on it's role, and I put admin on the invite link

upbeat otter
#

Try giving it an admin role

worthy wagon
#

it has an admin role

upbeat otter
#

Like an external one?

worthy wagon
#

yes

upbeat otter
#

I see

wicked atlas
#

Waiiiiiiit a minute

sick birch
#

Try to reinvite the bot and check admin in the oauth2 page

worthy wagon
#

I've tried that already

upbeat otter
#

Code?

wicked atlas
#

Is that verification channel the same one that you are trying to fetch?

worthy wagon
#

yes

#

I had it working with a different verification command

#

But I decided to use a reaction instead

worthy wagon
#

Read that differently

wicked atlas
sick birch
#

yeah...

worthy wagon
#

it does

#

I feel like it's common sense to do that man

#

not to be rude.

sick birch
#

you'd be surprised how many people miss stuff like that

wicked atlas
#

yeah

sick birch
#

can you send the code then?

worthy wagon
#

and if it didn't have access to the channel, you wouldn't see the bot in the member list on the right

#

little discord tip for you guys

sick birch
worthy wagon
#

yes, but it has access to both channels

sick birch
#

i would think so as you gave it admin

#

i guess run it again?

#

i can only chalk it up to server error

worthy wagon
#

now with this reaction method, it broke the sending

upbeat otter
#

Try restarting your bot, maybe...

worthy wagon
#

No one got toxic lol

upbeat otter
#

Ok stop