#discord-bots

1 messages · Page 636 of 1

reef shell
#

@slate swan type pip list in shell and find out if it's been installed or not

cloud dawn
#

What python version are you running?

velvet tinsel
#

Hai Sherlock

#

👋

reef shell
velvet tinsel
#

Ok

reef shell
#

why the rest of those in here,
dc-comp.
dc-inter.
py-slash

velvet tinsel
#

What’s the problem?

cloud dawn
reef shell
clear rapids
velvet tinsel
#

Can you excuse me

cloud dawn
velvet tinsel
#

I don’t want to help people rn

slate swan
#

uh

velvet tinsel
#

I’m a bit tired

reef shell
cloud dawn
reef shell
#

If you didn’t know, dpy 2.0 have buttons and interaction support, except for slash commands

cloud dawn
#

And repo's like pycord, nextcord, and disnake covers them all

arctic gyro
#
async def on_member_join(self, member: discord.Member):
        channel = self.bot.get_channel(914211131290157220)

        if not channel:
            return

        await channel.send(f"{member} has joined the server")``` 

Im trying to create a welcome command with this but it aint working can anyone help me?
quick gust
#

That's in a cog?

reef shell
unkempt canyonBOT
#

classmethod listener(name=...)```
A decorator that marks a function as a listener.

This is the cog equivalent of [`Bot.listen()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.listen "discord.ext.commands.Bot.listen").
reef shell
#

You need to use this instead of @bot.event

arctic gyro
velvet tinsel
#

Ok

cloud dawn
quick gust
#

if that's in a cog... If it isn't, then remove self

reef shell
brittle ingot
#

shouldnt that be:

@commands.Cog.listener()
reef shell
#

Yeah

velvet tinsel
brittle ingot
#

it should be

arctic gyro
cloud dawn
reef shell
#

Literally saying do nothing

reef shell
cloud dawn
#

True i just copied their code and converted it to python

brittle ingot
#

make sure you are indenting properly inside the Cog

arctic gyro
reef shell
#

happens blobpain

cloud dawn
#

Walrus operator do be thicc

arctic gyro
# reef shell Show code
import random
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="rp ")
@bot.event
async def on_ready():
   print('We have logged in as {0.user}'.format(bot))

@bot.command(name="hello")
async def hello_world(ctx: commands.Context):
    await ctx.send('Good Morning ' + f'{ctx.author.mention}')

@bot.command(name="say")
async def type_smth(ctx, message):
 await ctx.send(message)

@bot.command()
async def clear(ctx, amount):
   await ctx.channel.purge(limit=int(amount)+1)
   await ctx.send("I have cleared " + amount + " messages")

@bot.command(name="ping")
async def ping(ctx: commands.Context):
    await ctx.send(f"Do your maths Homework! {round(bot.latency * 1000)}ms")

@commands.Cog.listener()
async def on_member_join(self, member: discord.Member):
        channel = self.bot.get_channel(914211131290157220)

        if not channel:
            return

        await channel.send(f"{member} has joined the server!  ")

bot.run(TOKEN)```
reef shell
#

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

reef shell
#
import discord
import random
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="rp ")
@bot.event
async def on_ready():
   print('We have logged in as {0.user}'.format(bot))

@bot.command(name="hello")
async def hello_world(ctx: commands.Context):
    await ctx.send('Good Morning ' + f'{ctx.author.mention}')

@bot.command(name="say")
async def type_smth(ctx, message):
 await ctx.send(message)

@bot.command()
async def clear(ctx, amount):
   await ctx.channel.purge(limit=int(amount)+1)
   await ctx.send("I have cleared " + amount + " messages")

@bot.command(name="ping")
async def ping(ctx: commands.Context):
    await ctx.send(f"Do your maths Homework! {round(bot.latency * 1000)}ms")

@commands.Cog.listener()
async def on_member_join(self, member: discord.Member):
        channel = self.bot.get_channel(914211131290157220)

        if not channel:
            return

        await channel.send(f"{member} has joined the server!  ")

bot.run(TOKEN)```
#

lmao, It's not inside a cog

brittle ingot
#
class WelcomeSystem(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_member_join(self, member):
        ...code

    @commands.command()
    async def hello(self, ctx, member: discord.Member):
        await ctx.send(f"Hello {member.mention}. Welcome to {ctx.guild.name}")

def setup(bot):
    bot.add_cog(WelcomeSystem(bot))
reef shell
#

Why are you using that self param.

arctic gyro
reef shell
#

That's how a cog works

arctic gyro
arctic gyro
brittle ingot
#

Self only works in Cogs or classes. Its essentially the instance of that class.

reef shell
arctic gyro
brittle ingot
#

I remember when i was first learning Cogs. I thought it was so difficult 😂

reef shell
#

There's a gist for understanding cogs

#

wait a sec

brittle ingot
#

since when?

reef shell
brittle ingot
#

bruhh. Would have been helpful a year ago 😂

reef shell
arctic gyro
reef shell
#

np

thorn blade
#

whats wrong with this command?

@bot.listen('on_message')
async def antilinks(ctx):
  if "https://" in ctx.content.lower() and not ctx.author.guild_permissions.manage_messages:
    await ctx.delete()
    embed = discord.Embed(title=f"Unauthorised Link",
    description=f" {ctx.author.mention} Your Message Has Been Deleted \nPlease Refrain From Sending `Links` In The Server",
    color=discord.Colour.red())
    embed.set_author(name=f'Message Sent By {ctx.author.name}', icon_url=ctx.author.avatar_url)
    embed.set_thumbnail(url="https://cdn.discordapp.com/emojis/729251370590535770.png?v=1")
    await ctx.channel.send(embed=embed)
#

it should delete link/message but it dont

dire folio
#

how do i make it so commands can only be done by specific roles

reef shell
velvet tinsel
#

I think it should be a startswith

eternal jasper
#

how do you make your bot say command not recognized

velvet tinsel
#

🤷‍♂️

brittle ingot
#

or contains/includes

thorn blade
velvet tinsel
#

@reef shell do your thing

reef shell
velvet tinsel
#

Do the error handler

thorn blade
#

u mean @command.error thing?

velvet tinsel
#

Is it supposed to be a startswith?

reef shell
# thorn blade no

It's for discord.Message so the naming should make sense to it,
people use the name ctx usually for Context param.

reef shell
velvet tinsel
thorn blade
#

??

velvet tinsel
#

Yes

#

I mean it should be a bot.listen()

#

And not be a command

thorn blade
#

it is

#

check the command...

#
@bot.listen('on_message')
async def antilinks(ctx):
  if "https://" in ctx.content.lower() and not ctx.author.guild_permissions.manage_messages:
    await ctx.delete()
    embed = discord.Embed(title=f"Unauthorised Link",
    description=f" {ctx.author.mention} Your Message Has Been Deleted \nPlease Refrain From Sending `Links` In The Server",
    color=discord.Colour.red())
    embed.set_author(name=f'Message Sent By {ctx.author.name}', icon_url=ctx.author.avatar_url)
    embed.set_thumbnail(url="https://cdn.discordapp.com/emojis/729251370590535770.png?v=1")
    await ctx.channel.send(embed=embed)
reef shell
# thorn blade ctx.delete to message.delete
@bot.listen('on_message')
async def antilinks(message):
  if "https://" in message.content.lower() and not message.author.guild_permissions.manage_messages:
    await message.delete()
    embed = discord.Embed(title=f"Unauthorised Link",
    description=f" {message.author.mention} Your Message Has Been Deleted \nPlease Refrain From Sending `Links` In The Server",
    color=discord.Colour.red())
    embed.set_author(name=f'Message Sent By {message.author.name}', icon_url=message.author.avatar_url)
    embed.set_thumbnail(url="https://cdn.discordapp.com/emojis/729251370590535770.png?v=1")
    await message.channel.send(embed=embed) 
thorn blade
#

yep done

#

i changed it to message.delete

reef shell
#

Not just that part

thorn blade
#

i saw the last part

#

await message.channel.send(embed=embed)

velvet tinsel
#

I see eivl

thorn blade
brittle ingot
#

did you not put that in as the parameter for the event?

thorn blade
quick gust
#

can u try moving message.delete() to the end? Not sure if thats it

reef shell
#

replace ctx with message

velvet tinsel
reef shell
thorn blade
velvet tinsel
#

Now do it again

reef shell
#

I literally typed itfor you

reef shell
#

Did what

thorn blade
#

oh damn

quick gust
thorn blade
#

did

quick gust
#

It should work now if u put message as the parameter instead of ctx

reef shell
#

Now try to trigger the listener

#

by sending a message that contains 'htt...' or whatever you typed there

#

I'd use regex for that

brittle ingot
#

My entire bot is regex 😏

#

lmao jk

slate swan
#

im still having the same problem the whole day

reef shell
tawdry perch
slate swan
tawdry perch
#

3k lines put in 1 line

brittle ingot
#

its not, im lame unfortunately 😂

slate swan
reef shell
#

Idk about how nexcord works with buttons and stuffs

slate swan
#

sad

brittle ingot
#

it appears you haven't passed in, interaction as an argument for the function...

pliant gulch
#

The only thing given to a button's callback is interaction

dire folio
#

how do i make this work (so the command only works if the user has the role)

@client.event
@discord.ext.commands.has_role('Staff')
async def on_message(message):
reef shell
#

does check decorators work in events?yert

brittle ingot
#

no i don't think so.

brittle ingot
reef shell
brittle ingot
#
role = get_role here
if role in message.author.roles:
    ... do stuff

else:
    ... do other stuff
slate swan
#

discord.ext.commands is the exact opposite of events

#

therefore no, decos don't work on events

velvet tinsel
#

meh dpy coder 😄

slate swan
#

😳

velvet tinsel
slate swan
#

well I mean they aren't opposites

#

but the decorators are all defined in the commands class

brittle ingot
#

they just don't go together 😄

slate swan
#

👍

brittle ingot
#

not bashing here. But its never even been a thought for me to try something like that, tbh 😂

slate swan
#

I think decos are specifically just for the main on_message event

#

in the source code

#

which launches all commands

#

ask blanket when he's here

#

haven't seen him in a while shipit

brittle ingot
#

i haven't seen blanket in forever

slate swan
#

hmm

velvet tinsel
brittle ingot
#

or the other one there with the dog meme pfp

slate swan
#

dog meme pfp?

#

weird

brittle ingot
#

i forget their name but they were around with blanket. alec and toxicKidz

slate swan
#

I don't even know toxicKidz

brittle ingot
#

oop he was a project lead. idk if he still is.

slate swan
#

either he has a nickname or he's just gone for a damn long time

velvet tinsel
#

Enslo

#

😭

hollow mortar
#

hey i have a problem

brittle ingot
#

yes

hollow mortar
#
from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
import json

cid = '
secret = '9'


auth_manager = SpotifyClientCredentials(client_id=cid, client_secret=secret)

sp = spotipy.Spotify(auth_manager=auth_manager)

username = "Zetona"
playlist = "spotify:playlist:3sQMXSZ9662KzJQJMVfWPI"

results = sp.user_playlist_tracks(username,playlist_id=playlist,)
tracks = results['items']
while results['next']:
    results = sp.next(results)
    tracks.extend(results['items'])
for item in tracks:
    print(
        item['track']['name'] + ' - ' +
        item['track']['artists'][0]['name'] + ' - ' +
        item['track']['album']['name'])```
#

this is my code

slate swan
#

we can't

#

help with that

hollow mortar
brittle ingot
#

bruhh hide your credetionals next time

slate swan
#

that too

brittle ingot
hollow mortar
hollow mortar
#

its python app i know that its against tos

slate swan
#

you're downloading music from spotify, sharing information of it, and asking it in a non-related channel

hollow mortar
#

BRUH you see anything saying download in the code ?

agile ledge
#

.

slate swan
#

then what do it do

hollow mortar
#

its not download and this code it not against tos of discord or spotify cuz spotify by them self have this shit public

#

it bring songs name from playlist \

#

you give the app url of your spotify playlist and it give you all the songs and artist and albums of the songs

#

you can check it by your self this is not against tos of discord or python or spotify

wild oak
#

@agile ledge

dire folio
hollow mortar
brittle ingot
#

message.author.mention

agile ledge
slate swan
#

bro you get the cog and then get the cog by the cog's name

#

😳

wild oak
#

bro

#

what I don't even need help anymore

slate swan
#

commands = i.get_commands()

wild oak
#

no

pliant gulch
wild oak
#

the dude helped me so much

hollow mortar
#

idk why

wild oak
#

I was literally this close to deleting the help command 🤏

slate swan
#

i is a cog object

pliant gulch
slate swan
#

why

pliant gulch
#

Bot.cogs is a mapping [str, Cog]

#

i is the key and the value would be the Cog

#

I told lofi lemonade yesterday that they can just do for i in self.bot.cogs.values()

slate swan
#

bro 😢

#

!d discord.ext.commands.Bot.cogs

unkempt canyonBOT
brittle ingot
#

you could also use self.bot.cogs.keys() ?

pliant gulch
#

No??

slate swan
#

hm nice

pliant gulch
#

That would be strings

slate swan
#

and he can use i.get_commands?

pliant gulch
#

Yes

brittle ingot
#

oh we are getting the actual cog object. nevermind

#

im slow

slate swan
#

try to search a relating channel

hollow mortar
dire folio
# brittle ingot message.author.mention

i have this:

else:
        user = message.author.mention
        await message.channel.send(f'{user}You do not have permission to use this command!')

the bot does it but then starts pinging itself and saying it

slate swan
#

anyone that knows spotipy would help you

#

Code:

import requests, discord
from discord.ext import commands

Result:

    from discord.ext import commands
ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)
hollow mortar
#

nope it doesnt need ppl to know spotipy

#

the problem is the app print list but when i change it to var it doesnt come as a list only 1 line

#

so its not spotipy problem its common python problem

slate swan
#

changing a list to a var

hollow mortar
#

it print only 1 line doesnt print the list

slate swan
#

wdym var 🥲

hollow mortar
#

look

#
    print(
        item['track']['name'] + ' - ' +
        item['track']['artists'][0]['name'] + ' - ' +
        item['track']['album']['name'])```
#

when i run this it show this

#

when i change it to this

#
    x=(
        item['track']['name'] + ' - ' +
        item['track']['artists'][0]['name'] + ' - ' +
        item['track']['album']['name'])
    print(x)```
#

it only show the last line like this

#

it only show this the last line of the print list

slate swan
#

maybe because you use a for loop

#

and you use it wrongly

pliant gulch
slate swan
#

define a list before the for loop

#

and use append everytime

#

except of overriding the whole list

slate swan
pliant gulch
#

Show the function signature

hollow mortar
slate swan
#

!e

x = [] 
for i in "Hello World!":
     x.append(i)
print(x) 
#

help me dumb

hollow mortar
#

i tried this

#
x=None
for item in tracks:
    x=(
        item['track']['name'] + ' - ' +
        item['track']['artists'][0]['name'] + ' - ' +
        item['track']['album']['name'])
print(x)```
#

and didnt work

unkempt canyonBOT
#

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

['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!']
slate swan
#

that doesn't work of course

#

it replaces everything everytime

#

try the method I just sent

#

x=[]

#

and then use append() instead of assigning it a value

hollow mortar
#

i get this error

#

AttributeError: 'str' object has no attribute 'append'\

#

when using this code

#
x=[]
for item in tracks:
    x.append(item)
    x=(
        item['track']['name'] + ' - ' +
        item['track']['artists'][0]['name'] + ' - ' +
        item['track']['album']['name'])
print(x)```
slate swan
#

hm?

#

oh

#

because you used x=()

#

which made it an str

#

replace item in your append() with all these stuff in x=()

#

so you append a string to your list

hollow mortar
#

it works now thanks alot sorry for miss understanding before

#

thanks alot

slate swan
#

really nice

hollow mortar
#

ty G

slate swan
#

you're welcome

magic ore
#

The message might not be cached

slate swan
#

that's probably not the case

#

!d discord.on_message_edit

unkempt canyonBOT
#

discord.on_message_edit(before, after)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") receives an update event. If the message is not found in the internal message cache, then these events will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.

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

The following non-exhaustive cases trigger this event...
slate swan
#

well it's possible

#

on_raw_message_edit would surely solve that problem

magic ore
#

yeah, messages sent before the bot started aren't cached

slate swan
#

yep

#

I'd use cogs if I was you

#

restarting the bot everytime is frustrating for me

#

👍

wild oak
#

alright

#

So like the command works great

brittle ingot
#

but

wild oak
#

but i wanna change the color of the embed

#

corasponding

#

to the random thing it picked

#

lemme show you

slate swan
#

color=0x hexcode

#

use the module random

#

and have a list of colors u want

wild oak
#

No

#

Like

#

for coal i want red and for fave toy i want green

#

and im gonna be adding more

brittle ingot
wild oak
#

Wym

#

Am i not doing it right

brittle ingot
#

your are generating a random index for the list, but random.choice takes a list and chooses a random entry in that list.

wild oak
#

how would i change that

#

just like

#

could i make a group of good answers and bad answers and just have a certain color for each group

brittle ingot
#

that or you could make it a dict.

wild oak
#

but i dont know how to

#

Like

#

Uggghh i hope you know what im trying to make

brittle ingot
#
answers = [
    {
        "answer": "your-answer-string",
        "color": color-code or string
    }
]
wild oak
#

but then

#

how would i put the answer in the embed

#

but wait

#

would that even work like i still want it to be random

magic ore
#

access the 'answer' key of the returned dict from random.choice

wild oak
#

and have a set of good and bad

#

good green bad red

#

is what im trying to do even possible lmao

brittle ingot
#

so it would look something like:

#

yes very

wild oak
#

ok great

#

im still here btw

#

i didnt run off lmao

brittle ingot
#
answers = [
    {
        "answer": "You opened your present and got coal",
        "color": redhexcodehere
    }
]

answer = random.choice(answers)

embed = discord.Embed(
    title="My Embed! WHOO!",
    description=answer["answer"],
    color=answer["color"]
)
wild oak
#

Hmmm

#

so

#

wait lemme try to do this

#

uhhh

#

would it work the same way with a set of right answers

brittle ingot
#

wdym?

wild oak
#

like (group a "good answers" color=green)
(group b "bad answers" color=red)

#

random answer and if the answer was bad

#

red

wild oak
#

nothing hes trying to help me

velvet tinsel
#

Ok

wild oak
#

im still a little bit confused

#

lmao

velvet tinsel
#

What do you need help with

wild oak
#

ok so look ill try to explain it the best it can

#

i want a command like -present and when you do it itll have 2 groups like group a with good answers and a green colored embed and a group b with bad answers and a red colored embed

#

but i dont know if that would still do it

velvet tinsel
#

lyric moat
#

is there something needs to be import or?

brittle ingot
#

If you want to make it conditional based on whether the answer is right or not, i would change the color portion of the dict to "type": "bad" or "type": "good" and make an if statement to check if type is good or bad and return the color.

velvet tinsel
#

Can’t you do random.choice with a list?

wild oak
#

yeah i know its a weird comma nd

#

would that still work with the colors and the embed

wild oak
#

i just know how i would add 2 diff groups to it

#

with certain colors

dire folio
#

will this work for users who have a specific role to use this command:

@client.event
async def on_message(message):
    role = 'Staff'
    if role in message.author.roles:
             ... stuff
         
     
     else:
              ... stuff
dire folio
#

wdym

wild oak
#

error, code

#

if you need the full code let me know

#

@brittle ingot yes ik i didnt change it

#

i dont know why its saying that

#

becuase it still works

#

but it randomly stops working and says that sometimes then keeps working?

#

@ me please

velvet tinsel
#

Ok

#

You did it out of range

wild oak
#

How can i fix that

#

explain that to me like a 3 year old

velvet tinsel
#

Errr

wild oak
#

lmao

slate swan
velvet tinsel
#

Well the len of items is too big

#

Try 1 instead

wild oak
#

Ok

velvet tinsel
#

Or maybe len - 1

wild oak
#

1 moment

#

-1?

slate swan
wild oak
#

or 1

#

hes talking about this

slate swan
#

@velvet tinsel len() is to get the length of something😭

wild oak
#

@velvet tinsel

slate swan
wild oak
#

but it works randomly

#

like if i keep trying

slate swan
#

What are you trying to do?

silk mauve
#

Guys, so I have a Command which just Server Booster can use. And if a member tries to use the command he doenst has the role I want that a embed send

wild oak
#

welp

silk mauve
#

@snipe.error
async def snipe_error(ctx, error "Dont have anything here"):
if isinstance(error, ):

wild oak
#

oh whoops

#

i didnt even mean to say your name

silk mauve
#

its ok lol?

wild oak
#

i was gonna say welp now it works

#

lmao

velvet tinsel
#

😭

wild oak
#

thanks 😂

silk mauve
#

Like I dont know what to put in after the "error"

#

Its not missingpermissions

velvet tinsel
#

Is the problem?

silk mauve
#

what

slate swan
velvet tinsel
silk mauve
#

bruh

slate swan
velvet tinsel
#

😳

wild oak
#

i mean it seems like it works

velvet tinsel
#

Well

slate swan
wild oak
#

Thanks 😂

velvet tinsel
#

😂

wild oak
#

Yeah thanks

#

I would have literally never guessed

velvet tinsel
#

Why is it spamming tho

wild oak
#

no no no that was me

slate swan
wild oak
#

it was spaced out

#

thanks

velvet tinsel
velvet tinsel
#

I don’t know

#

Never had an indexerror in about a month

#

😂🤷‍♂️

wild oak
brittle ingot
#

Just do random.choice….

velvet tinsel
#

😭😂😭😂🤷‍♂️

wild oak
brittle ingot
#

!random.choice

velvet tinsel
slate swan
brittle ingot
#

Nope 🤣

wild oak
#

thats code from my 8ball command

brittle ingot
velvet tinsel
#

!d random

unkempt canyonBOT
#

Source code: Lib/random.py

This module implements pseudo-random number generators for various distributions.

For integers, there is uniform selection from a range. For sequences, there is uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement.

On the real line, there are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distributions of angles, the von Mises distribution is available.

velvet tinsel
#

I guess

wild oak
#

it already works lmao

#

im happy

slate swan
wild oak
slate swan
#

random.choice() works fine

wild oak
#

i already made the command 😭

slate swan
#

Not hard to change it

#

Pretty easy

wild oak
#

then what do i do

brittle ingot
#

We tried making it a list of dicts so he could determine the embed color based on response type: good or bad

opal skiff
#
global status
if message.content == "T!status":
        await message.reply(embed=discord.Embed(description=f"Aktueller status `{exa.get_server(id=id).status}`"))
        status=True
if message.author == client.user:
  if status:
            status=False
            while True:
                await asyncio.sleep(20)
                await message.edit(embed=discord.Embed(description=f"Aktueller status `{exa.get_server(id=id).status}`"))``` idk why but when the bot recieves a message by itself even if status == False it will still start the infinite loop for the message and edit the embed property
wild oak
#

i dont want the color any more

#

i kinda gave up

velvet tinsel
#

I guess you can randint it and if it’s like a particular number then choose from a good list and if not then a bad list

#

🤷‍♂️

brittle ingot
#

I would encourage you to learn about data types

velvet tinsel
#

Who me

slate swan
silk mauve
#

author?

velvet tinsel
velvet tinsel
velvet tinsel
silk mauve
#

hm

slate swan
#

@velvet tinsel is this a list?

A = ("hi")
slate swan
velvet tinsel
#

It looks like a very badly written tuple

slate swan
#

Tulle😭

slate swan
velvet tinsel
#

💀

slate swan
wild oak
#

and i added another thing and now its saying the same thing LOL

velvet tinsel
#

I mean it also looks like a variable but at the same time it doesn’t

silk mauve
#

It still don't work..

velvet tinsel
wild oak
#

@velvet tinsellol

velvet tinsel
#

But it also looks like one

silk mauve
#
@discord.ext.commands.has_role("Server Booster")
async def snipe(ctx):
    if ctx.author.has_role:
        channel = ctx.channel
    try:

        snipeEmbed = discord.Embed(title=f"Letzte gelöschte Nachricht in #{channel.name}",
                                   description=snipe_message_content[channel.id])
        snipeEmbed.set_footer(text=f"Gelöscht von {snipe_message_author[channel.id]}")
        await ctx.send(embed=snipeEmbed)
    except:
        await ctx.send(f"Es gibt keine gelöschten Nachrichten in #{channel.name}")
    else:
     embed = discord.Embed(title="***Booster Command***", description="Du hast ein Booster Vorteil Entdeckt!",
                              colour=discord.Colour.red())
    await ctx.send(embed=embed)
slate swan
wild oak
slate swan
wild oak
#

how

#

teach me your ways 🙏

silk mauve
#

import random

wild oak
#

k wait

#

already ddid

silk mauve
#

choices = [ YOUR CHOICHES]

wild oak
#

did

#

wait

silk mauve
#

Just like the 8ball comand

slate swan
#

!e @wild oak

import random

a = ("a","b")
print(random.choice(a))
unkempt canyonBOT
#

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

b
slate swan
#

Mobile isnt easy lol

wild oak
#

OHHH

#

Okkkkkk

slate swan
#

Yah

silk mauve
#

bruh

velvet tinsel
wild oak
#

Gimme a sec

slate swan
silk mauve
velvet tinsel
slate swan
silk mauve
velvet tinsel
silk mauve
#

I dont get errors, but its still says, "Role server booster is required

#

discord.ext.commands.errors.MissingRole: Role 'Server Booster' is required to run this command.

slate swan
#

Do you have nitro?

velvet tinsel
wild oak
#

did i do this right

silk mauve
wild oak
#

nvmd

slate swan
silk mauve
slate swan
silk mauve
#

and I also have the booster role

velvet tinsel
unkempt canyonBOT
#
Nope.

No documentation found for the requested symbol.

velvet tinsel
#

I don’t know

wild oak
#

here

velvet tinsel
#

Wtf

wild oak
#

OH

velvet tinsel
#

Bruh

slate swan
velvet tinsel
#

😭 why use an f string without even use it

wild oak
silk mauve
wild oak
#

dude i said oh and went to fix it 😭

velvet tinsel
silk mauve
velvet tinsel
silk mauve
#

No

velvet tinsel
#

Ok

wild oak
#

i already did import random becuase of my rock paper scissors command

silk mauve
#

And I want if someone isnt booster, that a message sends

silk mauve
#

a embed

#

an*

velvet tinsel
#

Send code again

#

As a screenshot

wild oak
#

me?

velvet tinsel
#

Pls I don’t want to keep scrolling

wild oak
#

why

silk mauve
velvet tinsel
wild oak
#

ok

velvet tinsel
#

Omg all that yellow

silk mauve
#

lol

velvet tinsel
#

What have you been doing

slate swan
silk mauve
velvet tinsel
#

Did you check capitalisation?

slate swan
#

Check docs i think theirs a built in decorator for premium users

velvet tinsel
silk mauve
#

What is a capitalisation?

slate swan
velvet tinsel
#

however this doesn’t

velvet tinsel
#

I can’t find anything either

#

😭🤷‍♂️ well

slate swan
#

@silk mauve just get the role and check a users role

velvet tinsel
#

I don’t even know if it exists or not anymore

outer parcel
#

Guys i need help in downloading Atom

outer parcel
#

ty

slate swan
#

Yw

slate swan
velvet tinsel
slate swan
velvet tinsel
#

🙈

#

;

#

My birthday is in 8 months :hype:

slate swan
#

@sullen shoal in a part of my code i did

a = exec(something)
await ctx.send(a)

Never sends the results but shows in the terminal do you know why?

slate swan
lyric moat
#

why does it keep saying this?

    from discord.ext import commands
ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)```
velvet tinsel
unkempt canyonBOT
#

@velvet tinsel :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 | SyntaxError: 'await' outside function
slate swan
#

It wont work ofc

velvet tinsel
#

What happened to @slate swan

#

Guy isn’t active

velvet tinsel
slate swan
velvet tinsel
#

Why

slate swan
velvet tinsel
#

Yes

slate swan
#

Well noobian got banned for insulting a mod and others and krypton got muted for 3 days cuz he wasnt being respectful

#

And mostly cause they were both hurting eachothers feelings which is against the rules

lapis socket
#

How can I use the wolfram API in order to make queries, namely the code to make a query

slate swan
lapis socket
#

in a discord bot yes

#

@slate swan

slate swan
#

Ig now but not really

lapis socket
#

:/ could you help lol

sick birch
#

A quick google search would most likely reveal their documentation

velvet tinsel
#

Robin

#

You just said what I say to most people

#

In a nicer way

#

How did you do that?

sick birch
#

Haha you'd be amazed how many issues would be solved by just putting in some time and reading the documentation

velvet tinsel
#

I say “google it” and people get annoyed at me

#

And call me “toxic”

#

And “read the docs”

slate swan
velvet tinsel
#

And someone wishes they could mute me

#

💀

slate swan
brittle ingot
#

!PEP8

unkempt canyonBOT
#

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:
PEP 8 document
Our PEP 8 song! :notes:

slate swan
cloud dawn
#

You need to give an URL to the person you help or use the build in commands from this server.

brittle ingot
#

Welps code was not indented properly

slate swan
#

Oh lmao

velvet tinsel
slate swan
velvet tinsel
#

screw you ipad

slate swan
velvet tinsel
#

Tuples I cannot wrap my heard around

#

Databases sound cool
But I’m hella busy

sick birch
#

WHY does sqlite have tuples as their default return type

cloud dawn
velvet tinsel
#

actually, the reality is I can’t be bothered.

sick birch
#

They have a well built row factory, might as well set that as the default?

cloud dawn
#

!d tuple

unkempt canyonBOT
#

class tuple([iterable])```
Tuples may be constructed in a number of ways:

• Using a pair of parentheses to denote the empty tuple: `()`

• Using a trailing comma for a singleton tuple: `a,` or `(a,)`

• Separating items with commas: `a, b, c` or `(a, b, c)`

• Using the [`tuple()`](https://docs.python.org/3/library/stdtypes.html#tuple "tuple") built-in: `tuple()` or `tuple(iterable)`...
pliant gulch
#

Tuples are basically immutable lists

sick birch
#

Tuples are dumb imo

velvet tinsel
#

Yes

cloud dawn
#

They have their own strengths.

slate swan
#

Tuples are so easy lol

velvet tinsel
#

I know the basics

brittle ingot
velvet tinsel
#

in reality, I dont. I havent even looked anything up yet

brittle ingot
#

(manage_messages, False)

velvet tinsel
#

I mean, they do look interesting

#

they really dont

cloud dawn
#

Yeah lol just ask here and you will have people google it for you. Big brain.

slate swan
pliant gulch
#

If you wanna learn something interesting check out metaclasses

velvet tinsel
#

Ima google it later

cloud dawn
#

I'll bing it

velvet tinsel
#

No

#

You dont need to

#

I can do things by myself

slate swan
velvet tinsel
#

I was the person who was called toxic because I told people to google stuff

velvet tinsel
slate swan
velvet tinsel
slate swan
#

😳

cloud dawn
#

Interesting command

slate swan
#

Ikr

cloud dawn
#

tbf Discord should have made this lol

brittle ingot
#

Bruhh A classes class 🤯

slate swan
#

Minaberry did it so now we know

pliant gulch
#

I use metaclasses a lot

#

Use it for Flags, Plugins

#

they are good me strong likey

slate swan
pliant gulch
#

A better impl would be just to make a context menu command which users can right click and select bookmark

cloud dawn
#

I called them out and my discord crashed crosspeepo

brittle ingot
#

I’m just finally mastering classes 🤣 over here thinking they’re the top dog of everything. Nope meta classes are

velvet tinsel
#

💀

velvet tinsel
#

They’re coming for you

pliant gulch
velvet tinsel
cloud dawn
#

shit gotta delete my browser history first

velvet tinsel
slate swan
velvet tinsel
#

I got banned from the discord py server

slate swan
#

Hes got the pythonhub which shows raw bytes😉 😏 😳

sick birch
velvet tinsel
cloud dawn
#

That takes effort since you can literally kick someone in the balls there for using repl.it

velvet tinsel
#

Before you were banned

sick birch
#

5 or 6 months ish

velvet tinsel
#

I was in like 2 hours and then got banned

slate swan
#

Why?

velvet tinsel
#

😂 that’s a skill of mine

sick birch
#

some stupid stuff tbh

velvet tinsel
sick birch
#

funny thing was i was a regular too

velvet tinsel
#

I have a test account I can get across it

slate swan
#

Disnake server is betterpithink shipit

velvet tinsel
#

😂 ok

#

I probably won’t even last a month

cloud dawn
slate swan
slate swan
velvet tinsel
#

that can’t stop me, but who cares

cloud dawn
slate swan
cloud dawn
#

Me neither i never really talk there.

velvet tinsel
slate swan
velvet tinsel
#

I annoyed the mods

#

I’m really good at that

pliant gulch
slate swan
slate swan
cloud dawn
pliant gulch
#

Its against the guidelines which are the rules that users should follow on the platform so

slate swan
#

Whats even the difference of discords tos and dcg

brittle ingot
#

It also doesn’t relate to discord bots directly

slate swan
#

how do I change the custom status of a discord bot

not playing or something like that, just the custom status

cloud dawn
#

!d discord.ext.commands.Bot.change_presence

unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
pliant gulch
#

So yes it is against ToS

slate swan
cloud dawn
#

Yep

slate swan
#

So basically tos = dcg if you break one you break the other

#

@cloud dawn i looked, didnt help//

cloud dawn
pliant gulch
slate swan
slate swan
cloud dawn
pliant gulch
#

Discord bot's don't have access to custom statues

slate swan
#

then why bother trying to help?

pliant gulch
#

They cannot use them

slate swan
pliant gulch
#

No they don't

sick birch
cloud dawn
sick birch
#

Helping is different from spoon feeding

slate swan
#

Guys please keep it civil

slate swan
#

No need to get a bit heated

sick birch
#

Then no, bots do not have custom statues. Period.

#

Unless you mean their about me section

#

which can be changed in the bot application dashboard

slate swan
cloud dawn
sick birch
#

Yep

velvet tinsel
velvet tinsel
#

Okimii…did you add me as a friend?

slate swan
cloud dawn
velvet tinsel
#

Minutes

slate swan
sick birch
slate swan
velvet tinsel
slate swan
velvet tinsel
#

Bruh

cloud dawn
velvet tinsel
#

Change_presence?

velvet tinsel
slate swan
cloud dawn
velvet tinsel
#

Okimii

slate swan
velvet tinsel
#

I thought you knew this…

slate swan
velvet tinsel
#

Holy someone dmed me for python homework help

#

Nahhhh

cloud dawn
slate swan
velvet tinsel
#

Bro

slate swan
#

cause the activity is playing

velvet tinsel
#

😭 I don’t want to be mean

#

But I have to say this

#

google it

slate swan
velvet tinsel
#

Don’t you want the playing thing thinkmon

long fog
cloud dawn
#

!d discord.ActivityType

unkempt canyonBOT
#

class discord.ActivityType```
Specifies the type of [`Activity`](https://discordpy.readthedocs.io/en/master/api.html#discord.Activity "discord.Activity"). This is used to check how to interpret the activity itself.
velvet tinsel
#

Just delete the space

#

😭

cloud dawn
#

!indention

unkempt canyonBOT
#

Indentation

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

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

Example

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

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

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

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

velvet tinsel
#

Thank

#

@novel apex

#

Ohh you mean that

#

Wait no

#

Wtf is happening

#

My brain….

slate swan
#

@velvet tinsel i do know how to do the playing thing but not this🤦‍♂️

velvet tinsel
#

Ok

#

I thought you meant playing

#

😭 sorry okimii

velvet tinsel
slate swan
brittle ingot
#

!d discord.ActivityType

unkempt canyonBOT
#

class discord.ActivityType```
Specifies the type of [`Activity`](https://discordpy.readthedocs.io/en/master/api.html#discord.Activity "discord.Activity"). This is used to check how to interpret the activity itself.
brittle ingot
#

!d discord.Activity

unkempt canyonBOT
#

class discord.Activity(**kwargs)```
Represents an activity in Discord.

This could be an activity such as streaming, playing, listening or watching.

For memory optimisation purposes, some activities are offered in slimmed down versions:

• [`Game`](https://discordpy.readthedocs.io/en/master/api.html#discord.Game "discord.Game")

• [`Streaming`](https://discordpy.readthedocs.io/en/master/api.html#discord.Streaming "discord.Streaming")
velvet tinsel
brittle ingot
#

There is a listening one im sure of it

velvet tinsel
#

Ye

slate swan
#

Ahhhh

velvet tinsel
#

There is like listening to Spotify

slate swan
velvet tinsel
#

🤷‍♂️ listening

slate swan
brittle ingot
#

!d discord.ActivityType.listening

unkempt canyonBOT
cloud dawn
brittle ingot
slate swan
velvet tinsel
#

There is a custom activity

cloud dawn
#

Disnake has it like this```py
disnake.Listening(name="yes")

brittle ingot
#

!d discord.ActivityType.custom

unkempt canyonBOT
velvet tinsel
velvet tinsel
brittle ingot
#

The definitions 👌

slate swan
slate swan
#

Bro chill😳

velvet tinsel
brittle ingot
#

Alright, Doc’s challenge. Pull up a thing you know isn’t used much and is underrated

slate swan
brittle ingot
#

Mine is simple

unkempt canyonBOT
#

property me: discord.member.Member```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
slate swan
#

Makes sense

slate swan
brittle ingot
#

I’ve literally seen people use guild.get_member to fetch their bot

brittle ingot
#

A shard? So when your bot gets in over 1000 servers I believe, discord recommends you shard your bot. It’s essentially discord instantiating multiple instances of your bot iirc it’s 1000 servers per shard. I’m not totally clear on it myself as I’ve never made a public bot but I think it’s suppose to help balance the bot load and it’s impact on the platform.

slate swan
#

!source

unkempt canyonBOT
unkempt canyonBOT
#

class discord.MemberCacheFlags(**kwargs)```
Controls the library’s cache policy when it comes to members.

This allows for finer grained control over what members are cached. Note that the bot’s own member is always cached. This class is passed to the `member_cache_flags` parameter in [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").

Due to a quirk in how Discord works, in order to ensure proper cleanup of cache resources it is recommended to have [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") enabled. Otherwise the library cannot know when a member leaves a guild and is thus unable to cleanup after itself.

To construct an object you can pass keyword arguments denoting the flags to enable or disable.

The default value is all flags enabled.

New in version 1.5.
brittle ingot
#

Oh I know right! I actually had the pleasure of using that for a commissioned economy bot. Essentially limiting the members cached to only those online currently, etc

pliant gulch
#

chunk_guilds_at_startup is also very useful

brittle ingot
#

Yes, it is. Especially for that eco bot. It was no where as big as this server but still around 50k members

#

Cache fills up quick

pliant gulch
#

Yea I used chunk_on_startup for caching as well when I had a discord bot. I just didn't chunk on start and I would chunk when a guild becomes "active"

#

Later popping the guild out of the cache after it becomes inactive

#

Saved startup times by a lot

brittle ingot
#

Smart

pliant gulch
#

Due to it not populating dead guilds

slate swan
#

So that basically just caches online members or a specific group of members?

brittle ingot
#

So essentially it by default caches all members the bot can see iirc so if you change it (works just like intents declaration) you can specify what members you want

slate swan
#

You guys are always teaching something new🙏

brittle ingot
#

Essentially discord in on_ready will send a populate cache response with a payload of all information the bot may need or is subscribed too. Which can take forever depending on the amount of guilds the bots in or members per guild etc.

slate swan
#

Yeah ik

#

Still lovely explanation

brittle ingot
#

Figured as much, just learned it myself tbh.

slate swan
manic wing
#

3 minutes

brittle ingot
#

A little over a year

slate swan
brittle ingot
#

😂

slate swan
#

If i did my math rightjam_cavedude

brittle ingot
#

Yay!!

slate swan
#

Very excited pithink

brittle ingot
#

Tbf I got into programming because I refused to pay for premium bot services. Literally learned python off of discord.py

slate swan
brittle ingot
#

Same, the extent of my knowledge was discord based programming so I ended up taking on a web server, and API project

slate swan
#

Same

brittle ingot
#

Exactly mee6

slate swan
#

Most people think im smart or experienced but really ive only been programming for 7 months but ive learn faster or more than others with more due to my passion

pliant gulch
#

I started my endeavour 4 years ago

brittle ingot
#

You just have to be willing to research. Luckily I always maintained discipline. Always made sure I listened to what looked like reputable sources and if I did end up following a tutorial I always checked the dates in correlation to the libs release dates. Most importantly prioritized docs over google

sick birch
#

i'm quite a slow learner, at least it feels like, i've been programming for around about 2 years, and i still feel kinda stupid lmao

brittle ingot
manic wing
#

danny

brittle ingot
slate swan
brittle ingot
# manic wing danny

Got ur DM, didn’t reply. What did you need? And yes I’ve made discord bots. You can check out my GitHub for some crappy examples 😄

pliant gulch
#

0x42 bot is the one to rule them all

slate swan
brittle ingot
#

Is that urs?

pliant gulch
#

Yes it is mine

#

Repo is public so you can take a look at all that clean code

slate swan
#

@pliant gulch you can talk when you release lefiyert

pliant gulch
#

😫

brittle ingot
#

Lol

slate swan
manic wing
pliant gulch
#

When lefi comes out of alpha I'll be rewriting 0x42 with lefi

manic wing
#

gives me like a ... skill evaluation to be blunt

brittle ingot
#

I don’t have any public bots. They’re all private or commissioned

slate swan
manic wing
#

whats your github?

pliant gulch
slate swan
brittle ingot
pliant gulch
brittle ingot
#

There are more repos but theyre private including a python package 😮

pliant gulch
#

Gotta finish documentation first and converters before I can actually get started though

slate swan
brittle ingot
#

Actually I think that one is public

pliant gulch
#

50% of the discord models are documented and we don't even have them all implemented I don't think

#

The rest is undocumented other than the internals of the wrapper

slate swan
#

😳

#

Thats a fat percent

brittle ingot
#

I know sebkuip and another is working on a fork too. Idk it’s expected release though

pliant gulch
#

His isn't a fork its from scratch

brittle ingot
#

Yeah that’s what I meant

pliant gulch
#

Al though I'm not very pleased looking through their codebase

brittle ingot
#

I’ve been watching it, seems interesting

pliant gulch
#

Right now its sorta a mess, I helped them a little bit

manic wing
#

@brittle ingot lol

pliant gulch
#

🤔

brittle ingot
#

What is that?

slate swan
#

Explain now😭

pliant gulch
#

Your waiting until ready while in ready event?

manic wing
brittle ingot
#

Which bot?

unkempt canyonBOT
#

main.py line 60

@bot.event```
brittle ingot
#

Oh yeah that bot is a mess

slate swan
#

😭

brittle ingot
#

I mean they all are

#

😂

manic wing
#

um

pliant gulch
#

Caeden you should take a look at my bot

#

very good code

slate swan
manic wing
slate swan
#

We all know you got clean code🤬

brittle ingot
pliant gulch
brittle ingot
#

One star and two forks 🤩

manic wing
#

@brittle ingot you're calling await load_blacklist() before you defined it

brittle ingot
pliant gulch
brittle ingot
near jackal
#

hi is there a way of using PyQt5 with discord.py? when i load client.run(token)
it freezes my window

pliant gulch
manic wing
#

@pliant gulch nothing wrong, just a sin to make an unclosable bot

brittle ingot
#

That bot is currently running soooooooo 😋

slate swan
pliant gulch
manic wing
#

i have a private rep which is a gui for my bot

brittle ingot
#

Open it, let’s roast you now 😜

manic wing
#

oh mate

near jackal
manic wing
#

ill show mine, you just have to promise to not look at the jsons and not look at the game.py

slate swan
#

goes straight to it

manic wing
near jackal
#

thnx

manic wing
#

i made a github of it a couple weeks before i stopped development

manic wing
brittle ingot
#

Wtaf

slate swan
brittle ingot
#

I was just trying to scare caeden

slate swan
#

I think he died😭

brittle ingot
#

I would too if 99% of my data storage was JSON 😆

#

I’m just kidding Caeden

slate swan
brittle ingot
#

Oh nothing, the dicts directory is completely normal

slate swan
#

dies

brittle ingot
#

We all have that one thing. Or in my case many things

slate swan
#

Yep

near jackal