#discord-bots

1 messages · Page 696 of 1

slate swan
#

yea whatever

shadow wraith
#

i'm pretty sure is that she/he/they are trying to get like a # prefix

slate swan
#

they did it

shadow wraith
#

oh

slate swan
#

now have a nice day cool people

shadow wraith
slate swan
#

saaame problem 2 commands works

shadow wraith
slate swan
#

like ! and #

shadow wraith
#

bruh

slate swan
#

nope

#

Send the code

#

aw man im stupid

#

ok

shadow wraith
#

liar

#

i am

slate swan
#

no me

shadow wraith
#

y'all liars

slate swan
#

yes you are right @slate swan this is the issue

#

big bruh moment

#

I KNOWWW BUT I DONT REMEMBER WHAT I HAVE THE BOT RUNNING IN OTHER HOST

shadow wraith
#

are you using VSCode?

shadow wraith
#

in the menubar go to terminal and then new terminal, you'll see 1-2 tabs named "Python", those are the tabs that all the bot terminal stuff and stuff goes to

shadow wraith
shadow wraith
slate swan
#

Either that or he just restarts the bot properly lol

shadow wraith
#

lmao yes

slate swan
#

only one thing more why this dont works

shadow wraith
#

are you in a cog?

slate swan
#

what i can use

manic wing
#

just replace self with client

shadow wraith
slate swan
#

no need for client on_ready takes no parameters

#

self here?

shadow wraith
#

on_ready does take no params tho redstone is right

slate swan
#

what i do

shadow wraith
#

something like bot.user

manic wing
#

eh misread it

slate swan
#

i delete self?

shadow wraith
#

!d discord.ext.commands.Bot.user

unkempt canyonBOT
shadow wraith
#

yes, alright here's the confirmation that this will probaly not work ☠️

#

it's the latest message python sent in this channel

slate swan
#

so what i can do

slate swan
# slate swan

Discord bots arent meant for people with basic knowledge or below, concider reading a book in python or something similar before these kinds of projects

shadow wraith
slate swan
shadow wraith
#

scroll up

#

oh

slate swan
#

bruh see

shadow wraith
#

why did you add bot in the parameters for on_ready?

#

you would not have been able to make the event

#

because you don't have bot, but you alr do so no need the bot

slate swan
#

because im dumb

shadow wraith
#

liar

slate swan
#

thanks this works

shadow wraith
#

np but next time learn python

slate swan
#

!resources

unkempt canyonBOT
#
Resources

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

slate swan
#

im tryng

#

i know the soooooooooo basic

slate swan
# slate swan

yuh then why did you jump directly to a discord bot project? u have no idea what ur doing

shadow wraith
#

you need more knowledge if you want better bot

#

but did you actually make a paginator?

#

:cap: 🧢

slate swan
#

what is paginator

shadow wraith
#

paginator = react to a message with arrow and the thing changes

slate swan
#

a website?

shadow wraith
#

like your help command

#

you know the reaction on it, it like pages

slate swan
#

ohh i use a command what i see in some docs

shadow wraith
#

oh

#

yeah alright got it but next time focus more on learning python, don't straightly go for discord bots

slate swan
#

thanks

shadow wraith
#

np

slate swan
#

byeee

shadow wraith
#

cya

#

i did it i helped someone lets goo

slender perch
#

hi, im working on a bot that will list info about every server its in

#

but whenever it gets to invite code it does this

#

does anyone know a way to make it print the invite codes to the server?
or better yet, make invite codes for that server

#
token = input("token: ")
prefix = "?"

import discord
from discord.ext import commands
from discord.ext.commands import Bot

bot = commands.Bot(command_prefix=prefix)
bot.remove_command("help")


@bot.event
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print(discord.__version__)
    print('------')
    print('Servers connected to:')
    for guild in bot.guilds:
        print("name:")
        print(guild.name)
        print(" ")
        print("id:")
        print(guild.id)
        print(" ")
        print("owner id:")
        print(guild.owner_id)
        print(" ")
        print("member count:")
        print(guild.member_count)
        print(" ")
        print("invite codes")
        print(guild.invite_code)
        print(('------'))


bot.run(token)
#

here is the code^

oak epoch
#

why there are differences in formatting in desktop and mobile when bot sends an embed? For ex, ** ... ** bolds the text in desktop. but in mobile, its printed as is

slate swan
unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

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

Or any GuildChannel.create_invite

#

that's a bad thing to do though, breaches privacy

slender perch
#

the main point of the tool is to find public tokens and use it to get in contact with the owner

#

cuz someone could take that same token and nukeeeee

shadow wraith
oak epoch
shadow wraith
#

huh alright let me see, definitely an issue with your discord app then

oak epoch
#

ok

slate swan
#

nah , discord on desktop and mobile are different
Same thing happens with hyperlinked text in embeds too

oak epoch
slate swan
#

Don't think so

#

It's a discord limitation

oak epoch
#

oh

slender perch
#

because this is all i get as a result

torn sail
#

Don’t put the asterisk as a arguement

quaint epoch
#

hey anyone know how i can email a user if the user is verified?

#

like, how do i get their email and check if they are verified?

quick gust
#

pretty sure u can't get an account's email

graceful mulch
#

hi

#

I want to make a daily streak command

#

my code

import datetime
from datetime import datetime, timedelta

@client.command()
async def daily(ctx):
  with open ("streak.json","r") as f:
    data = json.load(f)
  streak=data[f"{ctx.author.id}"]["streak"]
  last_claim_stamp=data[f"{ctx.author.id}"]["last_claim"]
  last_claim=datetime.fromtimestamp(float(last_claim_stamp))
  now  =datetime.now() 
  delta = now-last_claim 
  print(f"{streak}\n{last_claim_stamp}\n{last_claim}\n{now}\n{delta}") 
  if delta< timedelta(hours=24):
    await ctx.send('YOU ALREADY CLAIMED YOUR DAILY in 24 hours')
    return
  if delta > timedelta(hours=48):
    print('streak reset')
    streak = 1
  else:
    streak+=1   
  daily = 45+(streak*5) 
  data[f'{ctx.author.id}']["streak"]=streak
  data[f'{ctx.author.id}']["last_claim"]= str(now.timestamp())
  with open("streak.json","w") as f:
    json.dump(data,f,indent=2)
  embed = discord.Embed(title="Daily", colour=random.randint(0, 0xffffff), description=f"You've claimed your daily of **{daily}** \n Not credited")
  embed.set_footer(text=f"Your daily streak : {streak}")

  await ctx.send(embed=embed)
#

My doubt - this requires a entry it json file , how can i automate that

#

I tried making a function but error - it adds timestamps before the command execuetes

#

so the bot says you already claimed your daily

#

Pls help

slender perch
upbeat otter
torn sail
upbeat otter
graceful mulch
#

the things are there in json

#

last_claimand all

slender perch
#

yea but now it does another funny

upbeat otter
#

that's just use to indicate args and not actually put it in the func

slender perch
#

File "main.py", line 11
invite = await create_invite(reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)
^
SyntaxError: 'await' outside function

upbeat otter
graceful mulch
#

I cant

upbeat otter
#

why

graceful mulch
#

btw can you help me in this

upbeat otter
graceful mulch
#

cuz i dont know db

upbeat otter
torn sail
graceful mulch
#

and too lazy

jade tartan
#

How to make your bot know who joined and left on the vs code terminal?

torn sail
#

on_member_join?

graceful mulch
#

yes

jade tartan
#

yes and on_member_remove?

graceful mulch
#

yes

slate swan
#

Hi, I'm new to git. I'm currently making a bot on Github. I just forked the Codes. How do I activate the codes on Github?

graceful mulch
#

idk

upbeat otter
visual island
graceful mulch
#

use a ide

#

lol

slate swan
upbeat otter
slate swan
#

Look i maded this bot

#

but how do i make the bot work?

graceful mulch
#

good

jade tartan
slate swan
#

is disnake a good library to use in replacement for the depreciated discord.py?

graceful mulch
#

copy code on a ide

slate swan
jade tartan
#

is it the print function?

graceful mulch
#

yes

upbeat otter
torn sail
slate swan
graceful mulch
jade tartan
#

So in the terminal of the vs code i want it to where itll say who joined my server

graceful mulch
jade tartan
#

but in the terminal of vs code

upbeat otter
#
@<bot/client>.command()
async def on_member_join(member):
  member.kick(reason="Enjoy")
  print(member)
slate swan
graceful mulch
#

yes

sage otter
slate swan
upbeat otter
sage otter
#

Ok, I was about to say. oogh

graceful mulch
#

see my bot logging sys

upbeat otter
heavy folio
#

💀

slate swan
upbeat otter
slate swan
#

my english is not good

upbeat otter
#

;-;

graceful mulch
upbeat otter
graceful mulch
#

LOL

jade tartan
graceful mulch
#

ohmg

jade tartan
#

but really it doesnt really work

upbeat otter
graceful mulch
#

omg @slate swan your bot is toooo big

jade tartan
#
async def on_member_join(member):
        guild = client.get_guild(730651046459998218)
        channel = client.get_channel(885464532959526913)
        Myembed = discord.Embed(title= f"Welcome",
        description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
        Myembed.add_field(name="Account Created at:", value=f"<t:{int(member.created_at.timestamp())}:R>" , inline=True)
        await channel.send(embed=Myembed)
        await member.send(embed=Myembed)
        print(member)
        roles_list = ["Unverified","•.¸¸.•:Colours:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Gender:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Sexuality:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•:Distance:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Ethnicity:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Hobbies:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Relationship:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Location:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•",
        "•.¸¸.•::•.¸¸.•`Seeking`•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:DM:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Levels:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•","•.¸¸.•:Games:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•"]
        for roles in roles_list:
            role = discord.utils.get(member.guild.roles, name=roles)
            await member.add_roles(role)
            def check(r: discord.Reaction, u: Union[discord.Member, discord.User]):
                return u.id == member.mention.id and r.message.channel.id == member.channel.id and \
               str(r.emoji) in ["\U00002705"]
        try:
            reaction, user = await client.wait_for(event = 'reaction_add', check = check, timeout = 15.0)
        except asyncio.TimeoutError:
            await member.send(f"{member.mention}, please react with :white_check_mark: on this message in 15 seconds")
            return
        else:
            if str(reaction.emoji) == "\U00002705":
                return
             member.kick(reason="Enjoy")
            await member.send(f"{member.mention}, you didnt react with a ✅ in 45 seconds.")
            await member.send(f"**{member.mention}**, Sorry you got kicked")```
#

this is my code

upbeat otter
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

slate swan
graceful mulch
#

IK

torn sail
graceful mulch
#

i gotta coppy some inspiration

torn sail
#

shouldnt have to code ur bot to do it

graceful mulch
#

?

jade tartan
#

I want my bot to kick the member for me

graceful mulch
graceful mulch
jade tartan
#

ohh damn i cant change my name on this server

torn sail
graceful mulch
graceful mulch
torn sail
graceful mulch
#

change yiur pfp only

torn sail
#

and u may not want that

graceful mulch
#

@slate swan starred your repo

jade tartan
# torn sail

but i want my bot to do that will that not work?

graceful mulch
#

SEARCH GITHUB/stackoverflow

#

@jade tartan

torn sail
jade tartan
slate swan
#

i use replit it to run

graceful mulch
#

so

slate swan
#

yes :/

graceful mulch
graceful mulch
#

my eyes going brrrrrrrr

upbeat otter
torn sail
#

else is for any other error

graceful mulch
#

hey someone help me too

red sundial
#

ask away

graceful mulch
#

do you guys know theme park tycoon on roblox

#

NOT OFF TOPIC

red sundial
torn sail
graceful mulch
graceful mulch
torn sail
#

ok

slate swan
jade tartan
graceful mulch
upbeat otter
graceful mulch
graceful mulch
#

i can get apis but cant use it

graceful mulch
upbeat otter
red sundial
graceful mulch
#

OK

red sundial
#

it'll make your life easier

slate swan
#

where do i add my token @graceful mulch i didnt saw "client.run or bot.run " .

torn sail
#

bot.run('ur token here)

upbeat otter
slate swan
graceful mulch
red sundial
upbeat otter
red sundial
#

may i ask a question too?

full valley
red sundial
#

:/

slate swan
graceful mulch
#

how do i get api

graceful mulch
full valley
graceful mulch
red sundial
# full valley What’s your question

{'coord': {'lon': -74.006, 'lat': 40.7143}, 'weather': [{'id': 800, 'main': 'Clear', 'description': 'clear sky', 'icon': '01n'}], 'base': 'stations', 'main': {'temp': 7.76, 'feels_like': 7.76, 'temp_min': 4.63, 'temp_max': 9.44, 'pressure': 1022, 'humidity': 39}, 'visibility': 10000, 'wind': {'speed': 0.45, 'deg': 262, 'gust': 2.68}, 'clouds': {'all': 1}, 'dt': 1639811066, 'sys': {'type': 2, 'id': 2039034, 'country': 'US', 'sunrise': 1639829707, 'sunset': 1639863028}, 'timezone': -18000, 'id': 5128581, 'name': 'New York', 'cod': 200}so i have all this data, but im having a hard time figuring out how to print it like this:


     \  /       Partly cloudy
   _ /"".-.     +10(8) °C / +50(46) °F
     \_(   ).   ↘ 15 km/h
     /(___(__)  16 km
                0.0 mm```
if someone could help i'd appreciate it
slate swan
#

thanks you guys so much

graceful mulch
#

thank you

#

no plural

upbeat otter
red sundial
upbeat otter
#

lol

graceful mulch
red sundial
full valley
red sundial
#

im just asking how do i get the ascii art

#

according to the weather

jade tartan
red sundial
upbeat otter
#

read the docs, they must have a link to use the weather codes and fetch an image

graceful mulch
#

this is better

#

see this

upbeat otter
red sundial
upbeat otter
graceful mulch
upbeat otter
graceful mulch
#

but this is better

#

thats why i recommended

#

not forcing

red sundial
upbeat otter
#

oof

red sundial
#

@graceful mulch thats what im using

upbeat otter
#

Idk, I

red sundial
#

but i wanna figure it out

#

not copy someone's code

graceful mulch
upbeat otter
#

I'll just leave, best of luck

full valley
#

Yeah no idea about the art Nexxel

red sundial
#

bye!

red sundial
graceful mulch
upbeat otter
red sundial
#

i've been stuck on that for 2 days now

upbeat otter
#

@red sundial api name?

red sundial
upbeat otter
#

oh, openweathermap

red sundial
#

yeah pretty cool api

upbeat otter
#

they have a service to fetch images

red sundial
#

do they

upbeat otter
#

wait for 5 mins

red sundial
#

sure

slate swan
#

help i added the bot to my server and when i run it i doesnt work

upbeat otter
echo lagoon
#

spent far too long just creating a damn utility function for dropdown menus, allows handling upto 375 items ; - ;

when will a user need to select that many items tho . - .

red sundial
#

ill let you know if it works

upbeat otter
#

sure, ping me

slate swan
slate swan
#

@graceful mulch hey it doesnt work

graceful mulch
#

what

slate swan
#

i putted the token at the ( token)

graceful mulch
#

invite me to your prelit

#

replit

slate swan
#

ok

#

user?

graceful mulch
#

prakarsh17-coder

#

send link of your replit too

slate swan
#

dm

upbeat otter
graceful mulch
slate swan
#

okay

sage otter
#

I have no idea why this guy is even asking here. There’s setup instructions in the repos readme.

#

There’s even a dedicated support server for modmail support

upbeat otter
torn sail
red sundial
#

lets gooo

#

thank you so much

upbeat otter
slate swan
#

Nice domain though

upbeat otter
#

yeah

red sundial
#

LOL

graceful mulch
#

you can add this too Descripition
clear sky
Temperature(C)
0°C
Humidity(%)
59%
Atmospheric Pressure(hPa)
1024hPa

#

likediscoription

upbeat otter
#

;-;

red sundial
#

there is description

#

below the title

slender perch
cobalt jacinth
#

the avatar url not working

#

anyone can help me

#

this is url

red sundial
#

what are you trting to do here?

cobalt jacinth
#

i am sending a message to a channel webhhok

red sundial
#

oh interesting, i have no idea about that lol

slender perch
#

im still a bit stuck

cobalt jacinth
#

!discord-webhook

#

nice lib i found

heavy folio
#

what

#

you can literally do

#

!d discord.Webhook

unkempt canyonBOT
#

class discord.Webhook```
Represents an asynchronous Discord webhook.

Webhooks are a form to send messages to channels in Discord without a bot user or authentication.

There are two main ways to use Webhooks. The first is through the ones received by the library such as [`Guild.webhooks()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.webhooks "discord.Guild.webhooks") and [`TextChannel.webhooks()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.webhooks "discord.TextChannel.webhooks"). The ones received by the library will automatically be bound using the library’s internal HTTP session.

The second form involves creating a webhook object manually using the [`from_url()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook.from_url "discord.Webhook.from_url") or [`partial()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook.partial "discord.Webhook.partial") classmethods.

For example, creating a webhook from a URL and using [aiohttp](https://docs.aiohttp.org/en/stable/index.html "(in aiohttp v3.7)"):
heavy folio
#

💀

heavy folio
cobalt jacinth
#

the script is not hosting discord bot

#

it not a discord bot.

cobalt jacinth
heavy folio
#

then why ask in this channel whatpepe2

faint monolith
#

How can I get the verified bot developer badge? By getting my bots verified?

untold token
#

You can't

untold token
#

not anymore

faint monolith
untold token
#

Discord stopped giving badges for a long time

faint monolith
#

Huh.

faint monolith
heavy folio
#

what why

slate swan
#

i need someone help me fill modules

faint monolith
untold token
# faint monolith Why?

The reasons are long but one of the main reasons was, that bot developers where making bots only to get the badge

faint monolith
slate swan
#
local ur mom = workspace.A ```
faint echo
#

Honestly I understand your frustration, when I began coding my own bot I did it mostly for my community but also to in the future publish it and receive that badge.

There were many reasons as to why Discord stopped giving badges but the main reason was people selling their accounts or abusing the system to get the badge.

You should never work hard just to get something like a badge, your bot will still have the verified badge on it.

#

Thinking about it, I think they should just overall delete the badge from every developer. Their solution was to stop giving out badge due to abuse and basically said that it’s just a badge, well then take it away from everyone that obtained it. But that’s also selfish, so idk — hard topic

slate swan
#

i can't find: copy , re , string modules version

boreal ravine
slate swan
#

i can't find: copy , re , string modules version

#

i meant version

boreal ravine
#

they have no version afaik

#

you dont need to install them

slate swan
#

i meant im filling up the requirements.txt

#

to import modules

boreal ravine
upbeat otter
boreal ravine
#

you dont need to type it in that file

upbeat otter
#

;-;

slate swan
faint echo
#

Most modules have a version() method

boreal ravine
#

why are people so stubborn? I said its in-built, YOU DONT NEED TO TYPE IT IN THAT FILE

slate swan
#

how

boreal ravine
#

bro

faint echo
#

Haha

slate swan
#

go touch grass @boreal ravine

boreal ravine
#

bro what

upbeat otter
#

@boreal ravine just leave it, dont waste your energy

faint echo
slate swan
#

help me fill version

upbeat otter
#

No one will help

#

and its off topic

final iron
slate swan
final iron
#

Nobody did

slate swan
#

@graceful mulch said in my dm

#

HE TOLD ME TO PUT THOSE VERSION

final iron
slate swan
#

what?

final iron
#

Misinformation cannot be corrected

slate swan
#

ok

#

"Misinformation cannot be corrected" said by @final iron

#

u fucking weirdo u said that

final iron
#

May I ask, how old are you?

slate swan
#

!mute 699457437929046047 Investigating.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1640067537:f> (59 minutes and 59 seconds).

final iron
boreal ravine
#

lmao

final iron
#

I'm so confused on why he was so overly aggressive

boreal ravine
#

lol

spring flax
#

Does disnake support timeouts

potent light
#

How do we add Add to Server button our Discord bots?

boreal ravine
#

I think that PR adds it

torn sail
potent light
oak epoch
#

what permission is required for giving/removing roles from a member?

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
I get this error

#
@bot.command()
@commands.has_permissions(manage_roles=True)
async def verify(ctx, member: discord.Member):
    role = discord.utils.get(ctx.guild.roles, name="verified")
    await member.add_roles(role)
    await ctx.reply(f"Succesfully Verified {member.mention}    \u2705")
``` When I run this code
#

these are the permissions my bot has

boreal ravine
slate swan
#

Is it?

oak epoch
#

No. Does hierarchy matter even if my bot has Admin permissions ?

oak epoch
#

oook

#

so, when the bot joins a server, its role is automatically in the last as per hierarchy

#

so how do I change its role hierarchy?

boreal ravine
#

uh

#

the owner/mod must move the bots role above the role you wanna give

slate swan
oak epoch
#

oh ok.

untold token
#

They got aggressive for no reason

slate swan
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: add_field() got an unexpected keyword argument 'description'

untold token
#

it takes name and value

#

!d discord.Embed.add_field

unkempt canyonBOT
#

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

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

how to make it like a normal embed

#

like description="Shrek loves donkey!"

untold token
#

You need to add that to Embed constructor

#

!d discord.Embed

unkempt canyonBOT
#

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

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

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

New in version 2.0.

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

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

Yes

#

you need to pass title and description

slate swan
#

it only sends "Please fill out this form:"

untold token
#

Not like that breh

#
embed = discord.Embed(title="...", description="...")
cobalt jacinth
#

can make an embed using formatting ?

#

this is my embed

#

how to add color to this

tawdry perch
pastel cobalt
#

Is there any way to find that bot is going to exceed limit and stop the bot for one minute

pastel cobalt
sinful pasture
#

so uh I need a bot to copy what you said after the command like:

!say InsertTextHere

I can do it without the !say but idk how to get it to get the text after it

cobalt jacinth
#

can you make me understand how it can be done

tawdry perch
sinful pasture
tawdry perch
tawdry perch
sinful pasture
sinful pasture
tawdry perch
#

that stores the value

sinful pasture
#

alr thanks

tawdry perch
#

well not exactly store it, but it's the value given to argument

sinful pasture
#

but what about simply copying whatever comes after the command?

cobalt jacinth
#
webhook = DiscordWebhook(url='your webhook url', content='Webhook content before edit')
sent_webhook = webhook.execute()
webhook.content = 'After Edit'
sleep(10)
sent_webhook = webhook.edit(sent_webhook)

i want to be able to edit this message when next time script starts ? anyone pls help
problem is how do i save the repsonse "sent_webhook" to be used later

sonic gale
#
Traceback (most recent call last):
  File "C:\Users\shimo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\shimo\Documents\bot1\levelsys.py", line 25, in on_message
    if message.channel.id in talk_channels:
TypeError: argument of type 'int' is not iterable
Ignoring exception in command rank:```
#

help

tawdry perch
#

code?

tawdry perch
unkempt canyonBOT
#

Hey @sonic gale!

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

#

Hey @sonic gale!

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

sinful pasture
#

no not entirely

sonic gale
# tawdry perch code?
    async def on_message(self, message):
        if message.channel.id in talk_channels:
            stats = levelling.find_one({"id" : message.author.id})
            if not message.author.bot:
                if stats is None:
                    newuser ={"id" : message.author.id, "xp" : 50}
                    levelling.insert_one(newuser)
                else:
                    xp = stats["xp"] + 5
                    levelling.update_one({'id':message.author.id}, {"$set":{"xp":xp}})
                    lvl = 0
                    while True:
                        if xp < ((50*(lvl**2))+(50*lvl)):
                            break
                        lvl += 1
                    xp -= ((50*(lvl-1)**2)+(50*(lvl-1)))
                    if xp == 0:
                        await message.channel.send(f"{message.author.mention} you leveled up to **level: {lvl}** <3")
                        for i  in range(len(level)):
                            if lvl == levelnum[i]:
                                await message.author.add_roles(discord.utils.get(message.author.guild.roles, name=level[i]))
                                embed = discord.Embed(discord=f"{message.author.mention} you have recived role **{level[i]}** <3", color=0xC4A8B4)
                                embed.set_thumbnail(url= "https://cdn.discordapp.com/emojis/803218181694685204.png?size=96")
                                await message.channel.send(embed=embed)```
sinful pasture
#

only the part where error happens, in this case the on_message part

cobalt jacinth
sonic gale
#

oh i think i got it

tawdry perch
#

but depends a bit of way you want to save it

cobalt jacinth
#

webhook.edit(sent_webhook) only take response as argument

#

how can i save that

slate nymph
#

how to put hex colours in embed?

tawdry perch
#

do you have the hex colour alrd?

slate nymph
#

#00ffff

#

yes

tawdry perch
#

if yes just pass it to colour=hex here

sonic gale
#
    stats = levelling.find_one({"id" : ctx.author.id})```
tawdry perch
#

that # will fail it

sonic gale
#
    async def rank(self, ctx):
        if ctx.channel.id == bot_channel:
            stats = levelling.find_one({"id" : ctx.author.id})
            if stats is None:
                embed = discord.Embed(description="You havent sent any messages </3")
                await ctx.channel.send(embed=embed)```
#

help pls

#
    stats = levelling.find_one({"id" : ctx.author.id})
  File "C:\Users\shimo\AppData\Local\Programs\Python\Python310\lib\site-packages\pymongo\collection.py", line 1114, in find_one
    for result in cursor.limit(-1):```
slate nymph
#

discord.Embed(colour=00ffff)

#

like this?

sonic gale
heavy folio
#

0x[hex]

sonic gale
#

0x00ffff

tawdry perch
#

#db7c16 would be 0xdb7c16

slate nymph
#

got it thanks!

heavy folio
#

or just int('00ffff', 16)

sonic gale
#

example

#

NOW

#

someone help me with my shit

slate nymph
#

ty

tawdry perch
heavy folio
brazen raft
cobalt jacinth
vague sundial
#

how do u create your own events?

#

like I want something like on_message() but I want to define it

slate swan
#

how to search for a specific message using the bot
i want to have a command called "banwave" and it'll search for a list of keywords, get it, send it to logs channel along with user that sent it then ban the user

boreal ravine
proven osprey
vague sundial
#

Is there any other way than just using the inbuilt events?

slate swan
quick gust
sinful pasture
#
@bot.command()
async def bread(ctx, arg):
    await ctx.send(arg)

can I make it send the given messages to another channel?

boreal ravine
#

theres an example on how to do that

sinful pasture
#

k

quick gust
# vague sundial yep

Member object has an attribute send which u can use to dm the member when they use the command

slate swan
vague sundial
tiny ibex
#

How to get an emoji id

#

If you can't use the emoji

quick gust
#

u can right click, copy link or something, and the combination of numbers u see should be the emoji ID

tiny ibex
#

Can't copy link from the tab itself

quick gust
#

¯\_(ツ)_/¯

red sundial
#
@slash_command(guild_ids=[918349390995914792], description="Shows information about a user")
    async def ui(self, ctx, member: discord.Member=None):
        if not member:
            member = ctx.author

        name, status = str(member), member.raw_status
        date_format = "%a, %b %d, %Y @ %I:%M %p" 
        created_at = member.created_at.strftime(date_format)
        joined_at = member.joined_at.strftime(date_format)
            
        roles = [role for role in member.roles]
        rr = " ".join([role.mention for role in roles])

        embed = discord.Embed(title=name, description=status, colour=member.colour)
        embed.add_field(name="Origin", value=created_at, inline=True)
        embed.add_field(name="Joined", value=joined_at, inline=False)
        embed.add_field(name="Roles", value=rr)
        embed.set_thumbnail(url=member.avatar.url)
        await ctx.respond(embed=embed)

```when i use the command in the status it shows offline, but im not offline lol
#

is there anything wrong here?

tawdry perch
#

!d discord.Member.raw_status

unkempt canyonBOT
tawdry perch
#

hm

red sundial
#

yeah

tawdry perch
#

can you try member.status

#

!d discord.Member.status

unkempt canyonBOT
#

property status: discord.enums.Status```
The member’s overall status. If the value is unknown, then it will be a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") instead.
red sundial
tawdry perch
#

are you sure your status was online?

unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

red sundial
#

i have these

boreal ravine
#

you need presence intents

red sundial
#

yeah i have it enabled in the portal

red sundial
tawdry perch
#

ye it shows offline for me as well

red sundial
#

so is this is a bug lol

slate swan
#

using member = ctx.guild.get_member(member)

#

its fixes the issue

craggy cloak
#

I tried to install a requirements.txt file but i get this error

red sundial
slate swan
#

more like a replit bug

red sundial
slate swan
#
@slash_command(guild_ids=[918349390995914792], description="Shows information about a user")
    async def ui(self, ctx, member: discord.Member=None):
        if not member:
            member = ctx.author
        member = ctx.guild.get_member(member.id)
red sundial
#

shows a weird error

tawdry perch
#

it returns None from that I guess

red sundial
#

it says NoneType object has no attribute 'raw_status'

red sundial
vague sundial
#

@client.command(name='say_no') async def say_no(ctx): await ctx.send('No')

#

why does it not work?

tawdry perch
#

wdym by not work

cloud dawn
#

client does not have .command

vague sundial
tawdry perch
#

are you using Client?

cloud dawn
unkempt canyonBOT
#

@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
vague sundial
#

client = commands.Bot(command_prefix='!', intents=intents, case_insensetive=True)

slate swan
cloud dawn
red sundial
#

yeah i don't understand it

cloud dawn
#

member = member or ctx.author shortest method.

slate swan
slate swan
#

sent that already.

red sundial
#

in the if statement?

cloud dawn
slate swan
cloud dawn
#

..?? Okay i won't intervene.

visual island
slate swan
#

or is it>

#

alright , it needs to be an id , sorry

red sundial
#

bro im so confused lol

red sundial
#

lemme try this

slate swan
#

try fetching it

velvet tinsel
#

What’s wrong

vague sundial
vague sundial
velvet tinsel
#

Ok ill eat breakfast

drifting arrow
#

Do decorators work on commands?

#

wait. wtf am i on about. nvm. im being silly. ofc they do lol

vague sundial
drifting arrow
#

yeah

#

I thought of a solution to my issue and was like 'but will it work'

#

then scrolled up and was like 'derp. i use decorators already to run my bot'

slate swan
#

Hey I need help with my Python bot

unkempt canyonBOT
#

Hey @slate swan! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

slate swan
#

Bruh

drifting arrow
#

I mean. the bot has a point

tawdry perch
#

it really has, it is useful

drifting arrow
#

If I had your token and didnt like you I'd totes get your account banned

#

Just remove the token. Put a few x's when you paste the code

slate swan
#
import dicord
from dicord.ext import commands

client = dicord.Client()

@client.event
async def on_message(message):
  if message.author == client.user:
    return
  if message.content.startswith('$hello'):
    await message.channel.send('Hello!')
#

It keeps saying "module dicord not found"

drifting arrow
#

'dicord' is not a module

red sundial
#

you have to install the lib

drifting arrow
#

it's 'discord'

red sundial
#

oh dicord lol

slate swan
#

Freecodecamp's tutorial wrote dicord...

red sundial
#

LOL

drifting arrow
#

freecodecamp is wrong. naughty.

night bear
#

nice one

vague sundial
slate swan
#
import discord
from discord.ext import commands

client = discord.Client()

@client.event
async def on_message(message):
  if message.author == client.user:
    return
  if message.content.startswith('$hello'):
    await message.channel.send('Hello!')
tawdry perch
slate swan
#

Changed.

red sundial
#

yeah it should work now

drifting arrow
#

I didnt do shit @tawdry perch

tawdry perch
#

wait wrong reply

slate swan
#

It does not

#

I tried doing $hello but it does not reply

drifting arrow
#

What language is freecode camp suppose to be?

#

coz it looks wrong.

vague sundial
slate swan
#

I did

drifting arrow
#

Oh so wrong. golly gosh i get the heebies heebies looking at that.

red sundial
#

send the traceback from the console

vague sundial
#

@slate swan paste the full code

unkempt canyonBOT
#

Hey @slate swan! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

slate swan
red sundial
#

bruh just replace the token with "token"

#

lol

slate swan
# vague sundial <@456226577798135808> paste the full code
import discord
from discord.ext import commands

client = discord.Client()

@client.event
async def on_message(message):
  if message.author == client.user:
    return
  if message.content.startswith('$hello'):
    await message.channel.send('Hello!')

client.run("token")
red sundial
#

good

drifting arrow
#

First @slate swan you will want to read this documentation, it's very good and tells you everything you need to know about the discord.py api

Secondly, I can send you a template to get you started if you want. But the rest you need to figure out.

slate swan
#

Ok

drifting arrow
#

Forgot to send the link lol

red sundial
#

yeah read the docs

drifting arrow
#

Ignore the search. that's just what I book marked it as.

slate swan
#

I tried reading https://discord.js.org but I do not understand it

red sundial
#

bruh

vague sundial
drifting arrow
#

That's using Javascript. this is python.

red sundial
#

you're coding in python

night bear
#

maybe you should learn the basic of Python before starting discordpy

slate swan
#

It's different

slate swan
night bear
#

wha

#

erm

drifting arrow
vague sundial
night bear
drifting arrow
#

True true

red sundial
#

if you just wanna make a music bot

#

then just find some code on github and self host the bot

slate swan
#

Like what

#

Any examples?

red sundial
#

what do you mean lol?

drifting arrow
#

No examples. Just google 'github discord music bot'

red sundial
#

yeah and then host it on repl.it or something

vague sundial
red sundial
slate swan
#

I'll find one

red sundial
#

yeah you don't need to code then

heavy folio
#

If you need commands, use the commands extension.
Docs: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html

Why should I use the commands extension?

  • Prevents spaghetti code
  • Better performance
  • Easy handling and processing of command arguments
  • Argument type converters
  • Easy sub commands
  • Command cooldowns
  • Built-in help function
  • Easy prefix management
  • Command checks, for controlling when they're to be invoked
  • Ability to add command modules via extensions/cogs
  • Still able to do everything you can do with Client
heavy folio
#

ok rude

red sundial
vague sundial
heavy folio
#

nah dont use replit as well

red sundial
heavy folio
red sundial
#

he just wants to boast that i made a music bot

#

without actually making it

vague sundial
drifting arrow
#

Hey that's how I feel when I steal NFTs

red sundial
#

lmao

drifting arrow
#

maybe that's why my friends left me? 🤔

red sundial
#

?

slate swan
#

What

red sundial
#

what what?

slate swan
drifting arrow
#

Alright we're getting off topic here.

red sundial
drifting arrow
#

Focus guys. We're professionals here.

#

Focus on the task at hand. Making discord bots.

red sundial
#

yeahh

slate swan
#
GitHub

An advanced discord music bot, supports Spotify, Soundcloud, YouTube with Shuffling, Volume Control and Web Dashboard with Slash Commands support! - GitHub - SudhanPlayz/Discord-MusicBot: An advanc...

GitHub

🎶 A Discord music bot that's easy to set up and run yourself! - GitHub - jagrosh/MusicBot: 🎶 A Discord music bot that's easy to set up and run yourself!

GitHub

A complete code to download for a cool Discord music bot ! - GitHub - ZerioDev/Music-bot: A complete code to download for a cool Discord music bot !

GitHub

🤖 EvoBot is a Discord Music Bot built with discord.js & uses Command Handler from discordjs.guide - GitHub - eritislami/evobot: 🤖 EvoBot is a Discord Music Bot built with discord.js &am...

red sundial
#

the first one is pretty good

#

i think that person has a video on how to host it as well

slate swan
#

Ok

#

is there a way to get today's date then send into a message without it being an epoch?

red sundial
#

you can use datetime.datetime.utcnow()

#

oh wait nvm that returns the time

vague sundial
#

do we have any offtopic channel on this server?

drifting arrow
#

Lol

maiden fable
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
maiden fable
#

You're welcome (:

tawdry perch
#

Ty

#

@red sundial did you get it working by now?

red sundial
slate swan
red sundial
#

so like when you mention someone it works

#

if you do it for your self it doesn't

tawdry perch
#

Is the status fixed?

red sundial
#

yeah only when the mention is there

tawdry perch
#

So when you pass a user id it does not work?

unkempt canyonBOT
#

Hey @loud junco!

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

red sundial
#
@slash_command(guild_ids=[918349390995914792], description="Shows information about a user")
    async def ui(self, ctx, member: discord.Member=None):
        if not member:
            member = ctx.author
            
        name, status = str(member), member.raw_status
        date_format = "%a, %b %d, %Y @ %I:%M %p" 
        created_at = member.created_at.strftime(date_format)
        joined_at = member.joined_at.strftime(date_format)
            
        roles = [role for role in member.roles]
        rr = " ".join([role.mention for role in roles])

        embed = discord.Embed(title=name, description=status, colour=member.colour)
        embed.add_field(name="Origin", value=created_at, inline=True)
        embed.add_field(name="Joined", value=joined_at, inline=False)
        embed.add_field(name="Roles", value=rr)
        embed.set_thumbnail(url=member.avatar.url)
        await ctx.respond(embed=embed)
```this is my code rn, works it a member is mentioned, doesn't work when a member is not mention(displays their activity status as 'offline')
loud junco
tawdry perch
#

Interesting

loud junco
#

lemme screenshot the error

tawdry perch
loud junco
red sundial
red sundial
visual island
loud junco
red sundial
slate swan
#

{datetime.datetime.utcnow()}
datetime not defined

loud junco
#

define it then

tawdry perch
#

import datetime

red sundial
#

yeah

red sundial
tawdry perch
loud junco
#

alright

loud junco
tawdry perch
#

Ty 👍

loud junco
#

thanks btw

slate swan
#

can someone tell me the code for giving a role cause dpy discord has some good staff

tawdry perch
#

!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.
boreal ravine
# slate swan
  1. they arent a staff
  2. they're probably stressed
  3. just go to the channel, that channel is a help channel
#

and if you wanna give a role

#

!d discord.Member.add_roles here

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
#

@boreal ravine what is atomic?

boreal ravine
#

i have no idea

#

the link prolly tells what it does though

tawdry perch
#

Open the docs page

slate swan
#

is *roles meant to be the role?

boreal ravine
tawdry perch
#

Yes, a list of roles or single role

slate swan
tawdry perch
#

Role obj

boreal ravine
#

the role object

#

click the link lol

slate swan
#

there's 4

#

make it 5

boreal ravine
slate swan
#

nvm

heavy folio
#

read channel description when

slate swan
heavy folio
#

you dont use self serve tags in help channels obviously

sinful pasture
#

whats the thing for having a role, for example for permission

server_permissions.administrator

but idk the how you do it for roles

#

and also can someone tell me what the thing is called

spice warren
#

Yeah you broke the rules and then you were a jackass

#

so i treated you as such

#

dont call me bro either

#

grow up

slate swan
#

alright dickhead

elder bear
#

You didnt follow the rules

#

you started to flood help

#

they told you to go to the proper channel and you refused

tawdry perch
spice warren
slate swan
#

420p

#

get a better screenshot host

#

!mute 521325126722125874 Investigating.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1640086573:f> (59 minutes and 59 seconds).

slate swan
#

@spice warren This is no place to bring up off-server drama, please don't do so again - you can report problematic users to us via @novel apex.

slate swan
elder bear
#

Sorry about this Qwerty.

sinful pasture
#
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'

what

elder bear
sinful pasture
#

this is replit

red sundial
heavy folio
#

then dont use replit

#

use some actual ide

sinful pasture
#

;-; ok

slate swan
#

you can do that in replit too

#

there is a shell option.

#

@slate swan mute me for 10 minutes pleaseeeeeeeeee

#

We don't hand out infractions upon request lemon_sweat

#

OK

velvet tinsel
#

I was muted for 2 days

#

🚶‍♂️

velvet tinsel
dire folio
#

Does anyone know why i'm getting this error

File "main.py", line 119, in load_waiting
    waiting = json.load(e)
  File "/usr/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 23 (char 22)

The code

def load_waiting():
    with open("data/waiting.txt", "r") as e:
        global waiting
        waiting = json.load(e)

This is what's in the file

[[686225969467752479, 'Hoster']]
sinful pasture
velvet tinsel
#

whats waiting @dire folio

#

you did a global waiting

dire folio
#

an array

velvet tinsel
#

show me please

#

also JSON shouldn't look like [[]], it should be {}

dire folio
#

it was working like 10mins ago

#

i haven't changed anything and it stopped working

dire folio
velvet tinsel
#

also you did data/waiting.txt it should be data\waiting.txt

velvet tinsel
#

and txt files have nothing to do with json

#

you can't do json.load a txt file

dire folio
#

that's odd cause its been working for a whille like that

#

i restarted my bot today and it just didn't want to work

velvet tinsel
#

well you did something with the txt file

#

you shouldn't do json with txt

#

it doesn't work like that

dire folio
#

cause that's not how files work

velvet tinsel
#

I do \

#

shit

#

you're right

slate swan
#

\ is an escape character ( used with escaped character )

dire folio
#

what does that even mean

slate swan
#

characters like \n \u200b which are used in strings

slim dragon
#

**```
import discord as d
bot = d.Client()

@bot.event
async def on_message(msg):
if msg.author == bot.user:
pass
elif msg.content.startswith('b.se'):
channel = bot.get_channel(ID)
await channel.send('welcome to this channel')

bot.run(BOT_TOKEN)

slim dragon
heavy folio
#

remove "as d" in line 1

#

If you need commands, use the commands extension.
Docs: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html

Why should I use the commands extension?

  • Prevents spaghetti code
  • Better performance
  • Easy handling and processing of command arguments
  • Argument type converters
  • Easy sub commands
  • Command cooldowns
  • Built-in help function
  • Easy prefix management
  • Command checks, for controlling when they're to be invoked
  • Ability to add command modules via extensions/cogs
  • Still able to do everything you can do with Client
slim dragon
heavy folio
#

what

slim dragon
slim dragon
heavy folio
heavy folio
slate swan
#

discord.Bot is not a thing

velvet tinsel
#

sorry, commands.Bot()

slate swan
#

if you're not using pyc~

velvet tinsel
#

and from discord.ext import commands

slate swan
#

yea

velvet tinsel
#

@sarthak.command()

slate swan
velvet tinsel
#

that's how you run the bot

#

lmao

slate swan
#

with a valid toe-ken passed

velvet tinsel
#
import discord
from discord.ext import commands

sarthak = commands.Bot(command_prefix="sarthak!")

@sarthak.event
async def on_ready():
  print("sarthak is ready :)")

@sarthak.command()
async def test(ctx):
  await ctx.send("sarthak")

sarthak.run(TOE-KEN)
slim dragon
#

leave that na

slim dragon
#

just tell me why my code is not working ??😭

slate swan
#
from discord.ext.commands import Bot , when_mentioned

class Dekriel(Bot):
   def __init__(self):
     super().__init__(command_prefix=when_mentioned)
   
   async def on_ready(self):
     print(f"{self.user} is ready ;)")

Dekriel().run()``` ( bad indentation ik ik)
slate swan
velvet tinsel
velvet tinsel
slate swan
#

lmao which one?

velvet tinsel
#

import Bot ,

slate swan
#

there actually is

#

from discord.ext.commands import Bot , when_mentioned

velvet tinsel
#

wait

#

hol up

heavy folio
slate swan
#

ow i see wym py from discord.ext.commands import Bot, when_mentioned here

heavy folio
#

that should be better

slate swan
#

am not doing any importing stuff with it , why is it required there lol?

velvet tinsel
#
if __name__ == '__main__':
  dekriel = Dekriel()
  dekriel.run()
slate swan
#

😏 you still miss a :

slim dragon
heavy folio
#

that made no difference

velvet tinsel
#

or

slate swan
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
slate swan
#

you wont have to change your existing code

velvet tinsel
#
from discord.ext.commands import Bot, when_mentioned
import sys

class Dekriel(Bot):
   def __init__(self):
     super().__init__(command_prefix=when_mentioned)
   
   async def on_ready(self):

     sys.stdout.write(f"{self.user} is ready!")

if __name__ == '__main__':
  dekriel = Dekriel()
  dekriel.run(token)
slate swan
#

bad

velvet tinsel
#

I was being annoying ok

#

😭

boreal ravine
slate swan
#

importing something inside a function is crime 🔪

boreal ravine
#

toxic?

slate swan
heavy folio
#

indents dont match 💀

velvet tinsel
#

his indents suck 🚶‍♂️

slate swan
heavy folio
#

4 spacing indents are better iirc

slate swan
#

it is

#

i mentioned right there that i indented it not too well

velvet tinsel
#

are you on a phone

#

if you are on a PC i'm dissapointed

slate swan
#

yes cause my pc wont allow me to run vsc and discord tghtr lag free

slate swan
#

unless i boot out from windows

velvet tinsel
#

🩸

#

you shall die

boreal ravine
#

discord broke again

velvet tinsel
#

nitro

boreal ravine
#

?

velvet tinsel
#

nevermind