#discord-bots

1 messages Β· Page 490 of 1

pliant gulch
#

I'd understand an sqlite cache but that would not work in this case

river walrus
#

Dpy was pretty much a framework

#

So will be the new project

dapper cobalt
#

Who's Skelmis? And why does everyone love him? I'm just curious.

pliant gulch
burnt ether
#

bbye πŸ˜‹

pliant gulch
#

This isn't something a framework/wrapper should be doing

burnt ether
#

he pog

pliant gulch
#

Just like how earlier in your repo you had env variables

#

It should be the users who decide to set an env var then use that

dapper cobalt
river walrus
pliant gulch
#

Adds an extra dependency for no reason

#

Just my opinion but this is just out of scope but you can choose otherwise

paper bane
#

Not sure if that tiny convenience is worth the overhead

#

i can imagine situations where the end user could have an env variable named "TOKEN" and get confused why their bot is throwing a gateway error

pliant gulch
#

same, esp since I use linux

river walrus
paper bane
#

I was talking about the usage of env variables

river walrus
paper bane
#

i hold the same stance as andy's, i think it should be up to the user

pliant gulch
#

Nothing wrong with redis, just that the setup is a hassle I'd imagine and what if the user did not want it

#

Up to you, your the maintainer but at the very least it shouldn't be a required cache

river walrus
#

What if it automatically configured redis

#

That's what I'm thinking atm

pliant gulch
#

Then what happens when you have a machine incapable of running redis?

river walrus
#

Is redis that heavy?

pliant gulch
#

I'm not sure but hardware limitations should always be kept in mind

burnt ether
twin thicket
#

cannot import name 'ui' from 'discord

#

help

pliant gulch
#

You need to install from the github repo, not from pypi

brave vessel
#

Did you update to the latest vers- what andy said

twin thicket
pliant gulch
dapper cobalt
twin thicket
#

so do I just run

pliant gulch
#

No you would pass in the repo url

twin thicket
#

oh got it

pliant gulch
#

You might need to add git+ as a prefix before the url not sure

twin thicket
#

so I need github downloaded

pliant gulch
#

no

tough lance
#

No

twin thicket
#

py -3 -m pip install -U +giturl

pliant gulch
#

git+

twin thicket
#

ok

pliant gulch
#

not just +

twin thicket
#

oh ok

#

so like py -3 -m pip install -U git+url

pliant gulch
#

err its @ I was wrong

#

git@url

twin thicket
#

oh

pliant gulch
#

the regular url might just work as well

twin thicket
#

cannot detect archive format

#

😦

#
ERROR: Cannot determine archive format of C:\Users\aaml1603\AppData\Local\Temp\pip-install-jj0pmqz2\git_c3f67d9fc45341e9bdc2eb8397ed3cb4```
#

Thats the whole thing

river walrus
#

I found it from the main server

pliant gulch
#

guess I got the + and @ confused

twin thicket
twin thicket
#

oh

river walrus
#

No

twin thicket
#

oke

river walrus
#

Just install git

twin thicket
#

ok done

#

do I re run it

#

oh it did work now

#

now im getting cannot import name 'menus' from 'discord.ext'

slate swan
#

if you're unable to do it with git , just download the discordfolder and paste it in <pythonpath>\lib\site-packages

river walrus
#

In your code?

twin thicket
#

yeah

river walrus
#

iirc

lament mesa
#
python -m pip install -U git+https://github.com/Rapptz/discord-ext-menus
river walrus
lament mesa
#

πŸ˜„

heavy radish
#

Can I use more than one and ??

lament mesa
#

yes

heavy radish
#

Ahh nice

lament mesa
#
if this and that and something_else and bla_bla: ...``` is valid if you have defined everything
heavy radish
#

BTW, Whats the command i use? Like i need to check if the message is from a certain user. Is it message.author.id == 12432123432 ??

heavy radish
#

Thank You!!

heavy radish
#

If I want to lock the command

#

Can I do it with both role and permission??

#

Like you either need manage_channel=True permission or Staff role

boreal ravine
#

yes

#

!d discord.ext.commands.has_permissions

unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
boreal ravine
#

gae

maiden fable
#

Music Bots --> Against ToS --> No Help

slate swan
#

Oh , okay

#

halo nama saya pig python tolong discord bot

fleet axle
#

I have actually created a flask with folder name templates and runned it but it still says template not found

#

Can anyone help?

slate swan
#

seseorang membantu saya?

river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message

river walrus
slate swan
#

english

#

import discord
import os
import requests
import json
import random
from replit import db
from keep_alive import keep_alive

client = discord.Client()

sad_words = ["sad", "depressed", "unhappy", "angry", "miserable", "depressing"]

starter_encouragements = [
"Cheer up!",
"Hang in there.",
"You are a great person / bot!"
]

if "responding" not in db.keys():
db["responding"] = True

def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " -" + json_data[0]['a']
return(quote)

def update_encouragements(encouraging_message):
if "encouragements" in db.keys():
encouragements = db["encouragements"]
encouragements.append(encouraging_message)
db["encouragements"] = encouragements
else:
db["encouragements"] = [encouraging_message]

def delete_encouragment(index):
encouragements = db["encouragements"]
if len(encouragements) > index:
del encouragements[index]
db["encouragements"] = encouragements

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
if message.author == client.user:
return

msg = message.content

if msg.startswith('$inspire'):
quote = get_quote()
await message.channel.send(quote)

if db["responding"]:
options = starter_encouragements
if "encouragements" in db.keys():
options = options + db["encouragements"]

if any(word in msg for word in sad_words):
  await message.channel.send(random.choice(options))

if msg.startswith("$new"):
encouraging_message = msg.split("$new ",1)[1]
update_encouragements(encouraging_message)
await message.channel.send("New encouraging message added.")
ts)

#

how

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
#

e

patent lark
#

you shouldn't use an on_message event for commands

#

you should use discord.ext.commands.Bot rather than discord.Client() as well.

slate swan
#

izinkan saya menggunakan penerjemah google

#

πŸ˜…

#

sorry me no english google translate

upbeat vigil
#
#moderation

async def isAdmin(ctx):
  return ctx.author.has_role(878875536095604757,879248227621273610,879248227621273610)

async def isMod(ctx):
  return ctx.author.has_role(878875536095604757, 879248227621273610, 879248227621273610, 879248261427388437, 879248301487177759)```
#

hey would this work for mod perms?

#

@patent lark

patent lark
#

no, if you are defining this outside of a decorator from discord.ext.commands then ctx in this case isnt commands.Context, on top of that, its written incorrectlty.

slate swan
patent lark
#

discord.ext.commands has a decorator ( @commands.has_any_role() ) , if you'd rather use that than making your own function

upbeat vigil
#

i see

#

so i could do @commands.has_any_role(role ids) instaed?

patent lark
#

yes

upbeat vigil
#

tysm :)

patent lark
#

it can take role ids (as an int), or you could pass the roles names as a string

lone aurora
#

how can i make an if statement of

if message in channel channel is NOT example then the message would be deleted

patent lark
#

are you trying to check if its sent in a certain channel?

lone aurora
# patent lark are you trying to check if its sent in a certain channel?

yes, simply put i want it this way

when someone joins they can only access one channel called #verification, now i want them to do !verify which will give them full server access. I want there to be a feature that if they say something which is not !verify in #verification it gets deleted

patent lark
#

you could use an on_message event.

if message.channel.id != channel_id_goes_here:
  return await message.delete()
 
else:
  #code here```
oak warren
#

^^^

oak warren
#

that can on in the command as well

patent lark
drifting arrow
#

thread = await channel.create_thread(name="Apple", message="Welcome") What am I doing wrong?

boreal ravine
#
websites=discord.Embed(title='3# APIs️ 🌐')
``` it says "invalid character in identifier" why?
lone aurora
#

@patent lark any clue mate ._.

lament mesa
lone aurora
#
@client.command()
async def verify(ctx):
    if (not ctx.author.guild_permissions.change_nickname):
        guild = ctx.guild
        role = discord.utils.get(guild.roles, name="member")
        await ctx.author.add_roles(role)
    else: 
        await ctx.send("You are already verified!!!")``` still not working sadge
bitter perch
#

For the message param

river walrus
bitter perch
#

Not a string

drifting arrow
bitter perch
#

What are you trying to do with that param?

#

What is the issue @lone aurora?

lone aurora
#

File "C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'

drifting arrow
bitter perch
#

Your utils.get is returning None

lone aurora
#

hm

#

it was case-sensitive...

bitter perch
bitter perch
drifting arrow
#

Has to be a public thread

bitter perch
#

Well threads need to be created off of a message

drifting arrow
#

So "message" needs to be set to the message item?

bitter perch
#

Can be a message object or an id

drifting arrow
bitter perch
#

Yes

dire saffron
#

well can someone help me wih muy music bot

reef shell
#

How

drifting arrow
#

Now to figure out how to break a message into multiple embs xD

river walrus
# lament mesa ooh nice

You're more than welcome to join the team if you know a good amount of Python and/or Typescript

slate swan
drifting arrow
#

In embeds.0.fields.2.value: Must be 1024 or fewer in length. I wouldn't suppose discordpy has a solution for long embs πŸ€”

dire saffron
#

i don't know the error specifically my command runs but doesn't give any output

slate swan
dire saffron
#

where can i share my codes so u can pin point where I am making mistake

reef shell
#

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

paste if its long

#

or just send it here

reef shell
#

Or

#

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

drifting arrow
slate swan
drifting arrow
dire saffron
slate swan
#

Or you can split your text in two or more embed pages

drifting arrow
dire saffron
#

actually i am new to python bcz it started in my school this year Thanking you guys

slate swan
#

You must found it

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)
lone aurora
#
@client.event
async def on_message(message):
    if message.channel.name == "verification":
        await message.delete()
    elif message.content.startswith == "!verify":
        print("Verified")``` the code vaskel gave me didnt really work for me so now im using this
#

but the elif statement isnt working

#

any clue why?

reef shell
#

It's startswith('your str') iirc

lone aurora
#

ic

#

@reef shell is there anyway i can make the bot wait like 5 seconds before deleting the message

reef shell
#

Yes

lone aurora
#
@client.event
async def on_message(message):
    if message.channel.name == "verification":
        await message.delete()
``` in this code i mean
reef shell
#

Just pass delay = 5 as a param

#

message.delete(delay=5)

lone aurora
#

mhm

#

aight ill try it

reef shell
#

!d discord.Message.delete

unkempt canyonBOT
#

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

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
lone aurora
#

Ok so the issue im facing now is

drifting arrow
#

Neato πŸ˜„

#

got my reddit unread box thingy to work! 😼

lone aurora
#
@client.event
async def on_message(message):
    if message.channel.name == "verification":
        await message.delete(delay=5)``` if i add this code, then my !verify command stops working which is this

```py
@client.command()
async def verify(ctx):
    if (not ctx.author.guild_permissions.change_nickname):
        guild = ctx.guild
        role = discord.utils.get(guild.roles, name="Member")
        role1 = discord.utils.get(guild.roles, name="Unverified")
        await ctx.author.add_roles(role)
        await ctx.author.remove_roles(role1)
    else: 
        await ctx.send("You are already verified!!!")```
drifting arrow
#

Should see how annoying it is ;D

slate swan
#

What

reef shell
#

!d discord.ext.commands.Bot.process_commands

unkempt canyonBOT
#

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

This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.

By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.

This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").

This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
slate swan
#

Ah

reef shell
slate swan
#

Right mb

lone aurora
dire saffron
lone aurora
#

kraots confoosion

reef shell
#

Using ytdl is Against ToS of yt

dire saffron
#

u told !ytdl so do i have change where i wrote ydl i hve to write !ytdl specifically

reef shell
#

lol

dire saffron
#

OK

#

Thanks

lone aurora
#
@client.event
async def on_message(message, process_commands):
    if message.channel.name == "verification":
        await message.delete(delay=5)
        await process_commands(message)``` like this?
#

im dumb hold my hand

dire saffron
#

but now how can i create my music bot T_T

reef shell
#

client.process......

lone aurora
boreal ravine
reef shell
#

Also why are you passing an extra arg

lone aurora
#

kek ok

boreal ravine
#

Or bot if you're using that as the variable

boreal ravine
lone aurora
reef shell
boreal ravine
#

did u get undefined when u did await process_commands(message)?

slate swan
leaden anvil
#

Ok I want to add buttons to my embed if the user has done a particular format but it say gives me the error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'ButtonStyle' object is not callable here is the code: py @client.group(invoke_without_command=True) async def feedback(ctx, *,text = None): try: text = text.split("|") report=discord.Embed(color=0xfff868) report.add_field(name='Pending Confirmation', value=f"\`\`\`{text[1]} #Tittle \r {text[2]} #Description\`\`\`") await ctx.channel.send(embed=report) except: await ctx.reply("Please enter `/feedback format` to check how to format.") else: y=Button(style=ButtonStyle.green(), lable='Yes', id="yes") n=Button(style=ButtonStyle.red(), lable='NO', id="no") newreport=report=discord.Embed(color=0xfff868) newreport.add_field(name='Pending Confirmation', value=f"\`\`\`{text[1]} #Tittle \r {text[2]} #Description\`\`\`") await ctx.edit(componenets=[y][n],embed=newreport) what the problem ? also ignore\

lone aurora
#

new error :/

lone aurora
#

oh wait its process_commands

boreal ravine
#

ok

drifting arrow
#

This is what I just made

boreal ravine
#

wtf did anyone know u can watch youtube vids on discord

reef shell
#

Yes

lone aurora
reef shell
#

In emb.

drifting arrow
#

@lone aurora πŸ˜„

slate swan
#

@slate swan hi remember we chatted some time ago how can i now check if im still ip banned

#

sorry for the ping

leaden anvil
drifting arrow
#

@lone aurora @leaden anvil I basically wanted to create a way to read my reddit notifications without actually going to reddit itself.. then reply.

boreal ravine
reef shell
#

RatelimitsπŸ—Ώ

boreal ravine
leaden anvil
#

Oh ok but still if u aren't do it for your self then its evil and plain annoying

drifting arrow
reef shell
#

Cloudflare bansπŸ—Ώ

boreal ravine
#

πŸ—Ώ

drifting arrow
#

And also if you make a thread and manually delete your comment the thread was on, it'll delete the thread. BUT! If you delete the comment using a bot. hehe thread remains

boreal ravine
heavy radish
leaden anvil
dire saffron
#

Any idea how can i add spotify,soundcloud etc links to play music in my music bot since ytdl can't be used what changes i have to make

boreal ravine
leaden anvil
boreal ravine
heavy radish
#
@commands.has_permissions(manage_channel=True)
@commands.has_role('STAFF')

This command means: Both people with staff and people with manage_channal can use right?

#

They don't need both..

heavy radish
#

Nice

drifting arrow
#

And using description worked out aight imo

heavy radish
#

Thank You!!

boreal ravine
heavy radish
#

Oh

#

Okay Thanks

leaden anvil
slate swan
leaden anvil
#

error

slate swan
#

oh lemme see

reef shell
#

Which line

#

Error in which line

leaden anvil
#

y

slate swan
#

ok

lone aurora
reef shell
#

@leaden anvil the error is bcz you are using parentheses unnecessarily

reef shell
#

ButtonStyle.green

#

ButtonStyle.red

#

!d discord.ButtonStyle

unkempt canyonBOT
#

class discord.ButtonStyle```
Represents the style of the button component.

New in version 2.0.
leaden anvil
# reef shell !d discord.ButtonStyle

yay another error :/ this time it discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: __init__() got an unexpected keyword argument 'lable'

drifting arrow
lone aurora
reef shell
#

Replace all lable with label

drifting arrow
#

How do i see if the command was run in a thread or not? πŸ€”

leaden anvil
drifting arrow
reef shell
#

ctx.message.edit

boreal ravine
#

!d discord.Message.edit

unkempt canyonBOT
#

await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.
drifting arrow
#

You can send multiple embs in 1 message?

reef shell
#

Probably

boreal ravine
drifting arrow
leaden anvil
#

ok how do I solve this I am sorry discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: list indices must be integers or slices, not Button

slate swan
#

U can

boreal ravine
slate swan
#

There's embeds kwarg which takes a lit of embed objects and sends them in 1 messages

#

The limit being 10 embeds per message

reef shell
#

Learn python

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.

drifting arrow
reef shell
#

Learn/read the docs first before making discord bots

slate swan
#

No

leaden anvil
slate swan
#

Only 1 embed has the max 6k+ or whatever the total limit was

drifting arrow
#

So I could send 60k characters in 1 message coz 10 embs?

slate swan
#

Probably

reef shell
#

Lmao no ig

slate swan
#

Never actually tried it

reef shell
slate swan
#

Yeah no u can only send 6k characters per message

river walrus
slate swan
#

But embeds is extremely convenient for logs

slate swan
#

By the bot

river walrus
boreal ravine
#

Bots have nitro right?

#

πŸ¦† πŸ€”

slate swan
#

Nope

#

They just have nitro cheats πŸ˜‚

boreal ravine
#

Lmfao

drifting arrow
#

if I create a thread in a private channel, is that thread still publicly viewable?

slate swan
#

Afaik u can only join a thread if you can see the channel so no

drifting arrow
#

Neato

drifting arrow
#

Btw. ya'll know how this is currently annoying? well. im planning on moving all this reddit stuff to a background task and having it do its thing every minute or so

#

😼

slate swan
#

can someone help...

#
* Serving Flask app '' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://172.18.0.4:8080/ (Press CTRL+C to quit)
Traceback (most recent call last):
  File "main.py", line 405, in <module>
    client.run(os.getenv('TOKEN'))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
    return future.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 666, in start
    await self.connect(reconnect=reconnect)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 601, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
ξΊ§ 172.18.0.1 - - [23/Sep/2021 05:10:23] "GET / HTTP/1.1" 200 -
#

why do i feel something illegal in this code sus_phone

drifting arrow
#

are your intents on the bot like this?

slate swan
slate swan
boreal ravine
slate swan
boreal ravine
#

πŸ‘

drifting arrow
slate swan
#

@drifting arrow thx to you too

boreal ravine
drifting arrow
#

\o/ yay

slate swan
#

lmao i was thanking you too

drifting arrow
#

I helped for a change. So gosh darnit I want my credit

white plinth
#

is there a way you could declare a command with a variable?

lament mesa
#

yes

tiny ibex
white plinth
lament mesa
slate swan
#

Β―\_(ツ)_/Β―

slate swan
#

well i was ip banned some damn friend of mine got banned a few months ago -_-

#

and now all good nice Sc_Cat_Lmao

#
@bot.command()
async def botinfo(ctx):
    embed = discord.Embed(
        title=f"ChrimataGame's Info",
        color=0xffcc00)
    embed.add_field(name=f'{len(bot.users)} users use ChrimataGame', value='__ __')
    embed.add_field(name=f'{len(bot.guilds)} servers invited ChrimataGame', value='__ __')
    await ctx.send(embed=embed)

how does only one user uses it? there are almost 100 members in these servers

reef shell
#

It's the count of total users bot can see

#

For precise count use
s=0
for g in bot.guilds:
s+=g.member_count

slate swan
#

the location of my main app is for example : "python\discord"
I am trying to reach that location from this location : "python\discord\cogs".
How can I "go back" in the directory in python? ty ahead

tiny ibex
slate swan
#

Β―\_(ツ)_/Β―

tiny ibex
slate swan
#

No

steep estuary
#

how to react if someone reply a user

slate swan
#

But an embed's description can have 4k characters

tiny ibex
steep estuary
boreal ravine
#

speak english plz

steep estuary
#

-_-

#

i have an afk command

#

if someone mention a afk user

#

bot tell him that he is afk

#

but i want bot to tell the user on reply also

slate swan
#

how do i use an opensource code?

#

i mean... i got modmail open source code but i dont know how to use js ( basically i dont know how to apply the stuff to my bot ( i mean token ) )

tiny ibex
#

In files?

slate swan
#

ye

#

config.js

tiny ibex
slate swan
#
exports.TOKEN = '';

exports.PREFIX = '';

exports.news_API = '';

exports.giphy_API = '';

exports.AME_API = '';
#

ooh ok thanks

#
@bot.command()
async def with(ctx):

i have a syntax error, because with is already a function, what do i do?

tiny ibex
#

And prefix and api

slate swan
tiny ibex
#

And all that

slate swan
tiny ibex
slate swan
drifting arrow
#

AM BACK

#

Did you almost miss me?

valid niche
#

So it’s forbidden to have functions and variables be that name

jade jolt
#

could do _with and use the name kwarg in @bot.command()

slate swan
slate swan
valid niche
#

Do as @jade jolt said

jade jolt
#

yup

slate swan
#

ok, tyall!

jade jolt
#

np c:

slate swan
#

coughs its coming again and again how do i add the bot to server

#

....anyone here?.....

maiden fable
slate swan
#

one sec

maiden fable
#

Disable the Code Grant checkbox

slate swan
#

done

slate swan
lofty heron
#

hi i'm not sure why looking for ~/cogs/previousids.txt returns in the console file not found. can somebody explain why?

slate swan
#

i know im asking lots of junk but... can someone tell me how do i run the code for javascript ( probably stupidest question ever but im not familiar with js )

lofty heron
#

npm start kek

#

you need to install dependencies tho

oak warren
#

how do i convert an embed object to an embed

oak warren
slate swan
drifting arrow
#

Aight. Reddit inbox feature done

#

yay

lofty heron
#

nice

drifting arrow
#

Now whenever I get reply on reddit I can get pinged on discord 😼

lofty heron
#

lol

slate swan
#

c o m m a n d n o t f o u n d

lofty heron
#

e

vast gale
#

Hi

#

I'm curious, this is subjective what are the core features that any bot needs. I'm talking true core, like help command and error handler.

#

I think what's needed is error handler, help command, cog loading system, and maybe a paginator?

slate swan
#

Yes, + jishaku

tiny ibex
#

Gimme the github link

serene lynx
#

does discordpy work for python in version 3.10?

trail breach
#
@bot.command()
async def code():
    # username = arg
    embed = discord.Embed(
        title = "Title",
        description = "This has a description",
        colour = discord.Colour.blue()
    )
    embed.set_footer(text = "This is a footer")
    embed.set_thumbnail(text="Thumbnail")
    embed.set_author(name="Author Name")
    embed.add_field(name="Field Name",value='Field value', inline=False) 
    embed.add_field(name="Field Name",value='Field value', inline=True) 
    embed.add_field(name="Field Name",value='Field value', inline=True)


    await bot.say(embed=embed) 

'''The error

discord.errors.ClientException: Callback for code command is missing "ctx" parameter.'''```
#

did this from a tutorial

trail breach
#

for that person this works

serene lynx
serene lynx
tiny ibex
#

And bot.say is no more used

trail breach
#

oh

gloomy quest
tiny ibex
trail breach
#

RIP

serene lynx
tiny ibex
#

use
ctx.send

gloomy quest
trail breach
#

the vids 3 yrs old

tiny ibex
trail breach
#

chill ppl

tiny ibex
serene lynx
#
@bot.command
async def code(ctx):
    # username = arg
    embed = discord.Embed(
        title = "Title",
        description = "This has a description",
        colour = discord.Colour.blue()
    )
    embed.set_footer(text = "This is a footer")
    embed.set_thumbnail(text="Thumbnail")
    embed.set_author(name="Author Name")
    embed.add_field(name="Field Name",value='Field value', inline=False) 
    embed.add_field(name="Field Name",value='Field value', inline=True) 
    embed.add_field(name="Field Name",value='Field value', inline=True)


    await ctx.send(embed=embed)```
trail breach
serene lynx
tiny ibex
trail breach
#

ignore

gloomy quest
#

kay

sweet merlin
#

how do i make if the user react to 1st emoji and then 2nd emoji, the 2nd emoji that user react will be remove?

serene lynx
#

@trail breachcan?

trail breach
#

damnthis is dope ty @serene lynx @tiny ibex

trail breach
sweet merlin
serene lynx
trail breach
gloomy quest
#

tin can

serene lynx
gloomy quest
#

and yeah

#

BUTTONS ARE COMPLIACTED

#

Like

#

innit

#

_super__innit

#

LIKE WHAT?

#

whats with those innits?

#

And

#

SELF_

#

what does those innits and self and stuff mean

trail breach
gloomy quest
#

it will show you the format

#

i think

serene lynx
trail breach
#

no @trail breach this

#

can this mention be embedded

valid niche
trail breach
#

i can use text and embed though lemme try that

serene lynx
trail breach
gloomy quest
trail breach
valid niche
serene lynx
# trail breach pls share src code
@commands.command(aliases=['warning', 'peringatan'])
@commands.has_permissions(kick_members=True)
    async def warn(self, ctx, user: Member, *, reason=None):
        if reason == None:
            await ctx.send('you have to add a reason')

        else:
            description = f'''
**Information :**

Author : {ctx.author}
User : {user}
Reason : {reason}```'''
embed = mbed(
description=f"{description}", color=ctx.author.colour, timestamp=ctx.message.created_at,)
embed.set_author(
name=f'{user} Has Been Warned', icon_url=str(user.avatar_url))
embed.set_footer(
text=f'command used by : {ctx.author}', icon_url=str(ctx.author.avatar_url))
if user.bot == False:
await ctx.send(embed=embed)
await user.send(embed=embed)
await ctx.message.delete()

        else:
            await ctx.send(embed=embed)
            await ctx.message.delete()```
valid niche
#

that will return name#discriminator

trail breach
#

k tysm

valid niche
serene lynx
trail breach
boreal ravine
#

How does one go about getting a users join date and then changing/converting it to a unix timestamp?

valid niche
#

which you can convert however you like

#

!d datetime.datetime

unkempt canyonBOT
#

class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)```
The *year*, *month* and *day* arguments are required. *tzinfo* may be `None`, or an instance of a [`tzinfo`](https://docs.python.org/3.10/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass. The remaining arguments must be integers in the following ranges...
trail breach
#

user:Member is for the author??

novel rampart
#

Yes

#

@trail breach

trail breach
#

oh

#

k ty

#

im taking a mention as an argument if i print it shows me id

#

how can i convert it to name

#

any1

novel rampart
#

ctx.user

novel rampart
trail breach
#

ohk lemme try

novel rampart
#

For get name

novel rampart
trail breach
#

'Context' object has no attribute 'user'

plucky shoal
#

!d discord.ext.commands.Context.author

unkempt canyonBOT
trail breach
#

no i want to take a mention arguement to use in a command

#

if i print it prints user id

#

not name

novel rampart
#

One sec

#

I will tell you

trail breach
#
@bot.command()
async def code(ctx,lang,mention):```ok
novel rampart
#

ctx.author.mention

trail breach
#

not the author

novel rampart
novel rampart
trail breach
#

whom the author mentions

novel rampart
#

Oh Ok one sec

trail breach
#

!command @novel rampart

#

kk

drifting arrow
#

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

novel rampart
#

@bot.command()
async def whois(ctx, member : discord.Member):

novel rampart
#

The member that you want

#

Athor mentioned is the member

#

@trail breach

trail breach
#

ok lemme try

novel rampart
#

This code should be working

boreal ravine
unkempt canyonBOT
#

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

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

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

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

hash(x) Returns the member’s hash.

str(x) Returns the member’s name with the discriminator.
trail breach
#

it works ty @novel rampart

novel rampart
# unkempt canyon

@trail breach read this document also then u understand what is that code

boreal ravine
novel rampart
trail breach
jagged wigeon
#

hey

boreal ravine
#

yes

jagged wigeon
#

ok

#

can someone please help me with a suggest command?

#

with the bot = command.Bot

#

like, not client, bot

novel rampart
#

That is your creative mindset

jagged wigeon
#

hmm

#

but, i dont know how to do it

novel rampart
#

What

boreal ravine
jagged wigeon
jagged wigeon
#

or that language

novel rampart
jagged wigeon
#

i am new in python

novel rampart
#

Oh

boreal ravine
jagged wigeon
#

no no

novel rampart
jagged wigeon
#

let me explain

novel rampart
#

Mm

jagged wigeon
#

but it metter

boreal ravine
jagged wigeon
boreal ravine
jagged wigeon
novel rampart
jagged wigeon
#

i use bot

novel rampart
#

No

jagged wigeon
#

ok whatever

boreal ravine
slate swan
jagged wigeon
#

can you help me?

novel rampart
#

The bot and Clint is only a variable name

jagged wigeon
jagged wigeon
jagged wigeon
novel rampart
#

Oh I understand

#

Nee hat did you mean

jagged wigeon
#

so, cand someone help me?

novel rampart
boreal ravine
#

what

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.
jagged wigeon
#

to make a suggest command

boreal ravine
#

Im confused

jagged wigeon
#

why

boreal ravine
#

he said discord.Bot

jagged wigeon
#

yes

boreal ravine
#

Which isn't a thing apparently

slate swan
#

It isn't

jagged wigeon
#

how

slate swan
#

It's commands.Bot

jagged wigeon
#

oh wait

boreal ravine
jagged wigeon
#

commands.Bot

novel rampart
jagged wigeon
#

srry

boreal ravine
#

ok

jagged wigeon
spring flax
jagged wigeon
#

...

novel rampart
jagged wigeon
#

...

spring flax
jagged wigeon
#

can anyone else help me?

boreal ravine
jagged wigeon
spring flax
jagged wigeon
jagged wigeon
#

you know it?

novel rampart
#

Then what did you want

jagged wigeon
#

help!

#

that s what i want

novel rampart
#

What help

spring flax
novel rampart
jagged wigeon
#

to make, a ,suggest, commad

jagged wigeon
#

but can anyone help me ?

#

or i am wasting my time πŸ™„

spring flax
#

It's best if you read it first getting a basic understanding of the library

jagged wigeon
#

...

spring flax
#

what?

jagged wigeon
#

nothing

#

i can't read rn

#

i need some help rn but.. anyway

#

can i post a picture?

boreal ravine
#

Just make a command and make it send 2 that specific channel or the channel where it was used

spring flax
jagged wigeon
#

i want to show you how i want to look the command like

#

can i do it or i get banned/warned?

hasty iron
#

what’s the issue

jagged wigeon
#

look, this

#

thats how i want the command to be

hasty iron
#

okay

spring flax
jagged wigeon
#

and i want, if someone say it like in general, to move it in suggestions

hasty iron
#

okay

jagged wigeon
#

do u understand what i am saying?

boreal ravine
#

well you'll need to get the channel first to send it

hasty iron
#

make an embed, send it to the channel, add the reactions and wait

boreal ravine
#

!d discord.ext.commands.Bot.get_channel

unkempt canyonBOT
jagged wigeon
#

ok

jagged wigeon
#

i am neww, and i dont have time for reading

hasty iron
#

!d discord.Message.add_reaction

unkempt canyonBOT
#

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

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
spring flax
hasty iron
#

Messageable.send returns a Message object

spring flax
#

We are not going to spoonfeed

jagged wigeon
#

ok ok, sorry

novel rampart
jagged wigeon
#

...

novel rampart
#

Then you can make without our help

jagged wigeon
#

ok, whatever

icy seal
#

With diabolical here. If I wanted to write somebody’s code, I’d get a job LOL

novel rampart
#

Lol

boreal ravine
jagged wigeon
#

so

#

how can i make the command like?

icy seal
#

Wdym by that..? You can familiarise yourself with a module β€œlearning the basics”

jagged wigeon
#

i need a little spoonfeed

novel rampart
jagged wigeon
#

omgg

#

wow

boreal ravine
#

!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.
icy seal
#

ty

jagged wigeon
#

!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.
spring flax
jagged wigeon
#

oh yea

icy seal
#

You need to learn what that is

novel rampart
spring flax
#

Not really

novel rampart
jagged wigeon
#

not for you

novel rampart
#

It is very easy

boreal ravine
icy seal
#

We’re here to answer specific questions you have if you’re finding it difficult. But you have to give us the impression that you’re at least trying…

jagged wigeon
#

okok

icy seal
jagged wigeon
#

wait a sec

spring flax
#

But, of course, first starting with a basic understanding would be a lot easier, than first trying to create this suggestion bot.

jagged wigeon
#

i made a little help command

#

with embed

#
@bot.command(aliases=['Help'])
async def help(ctx):
    em = discord.Embed(
    description='**Admin Only** \n ```$clear [number] - Clears the number of messages you want```\
    \n ```$create-channel [name] - Creates a text channel with the name that you want```\
    \n ```$create-vc [name] - Creates a voice channel with the name that you want```\
    \n ```$kick [member] - Kicks a member of your choice from the guild```\
    \
n ```$ban [member] - Bans a member of you choice from the guild```\
    \n ```$unban [member] - Unbans a member of you choice from the guild```\ 
novel rampart
#

That is better

#

For you

spring flax
#

So you know embds

#

now just do reactions

novel rampart
boreal ravine
icy seal
#

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

jagged wigeon
spring flax
#

!d discord.Message.add_reaction

unkempt canyonBOT
#

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

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
jagged wigeon
#

so how it would look like

#

like that?

novel rampart
#

Yes

spring flax
#

you can make it the same as the screenshot

jagged wigeon
#
@bot.command()
async def suggest(ctx):
em= discord.Embed(
bot.get_channel(id) 
description = 'A help command')
#

so thats the start

jagged wigeon
#

thats what i am trying to do

spring flax
#

make the embed, send it in a channel, add the reactions

jagged wigeon
#

ok

jagged wigeon
#

the reactions are ok, but how i send it in a channel?

boreal ravine
jagged wigeon
#

how

boreal ravine
#

!d discord.ext.commands.Bot.get_channel

unkempt canyonBOT
jagged wigeon
#

ok

spring flax
#

!d discord.abc.Messageable.send

unkempt canyonBOT
#

await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message
https://github.com/AA1999/Disthon

GitHub

Discord API wrapper for Python built from scratch. Contribute to AA1999/Disthon development by creating an account on GitHub.

boreal ravine
#

no

jagged wigeon
#

where do i put it then

boreal ravine
jagged wigeon
#

indent?

boreal ravine
boreal ravine
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

spring flax
#

indents are wrong there

jagged wigeon
#

ok ok

#

whats next in my code?

boreal ravine
stuck flare
#
from discord.ext import commands

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

@bot.command(name = "hello")
async def hello_world(ctx: commands.Context):
    await ctx.send("Hello, World!")```
#

if i type !hello the bot sends messg twice

boreal ravine
stuck flare
#

wdym

jagged wigeon
#
@bot.command()
async def suggest(ctx):
em= discord.Embed(
description = 'A help command'
bot.get_channel(id))```
#

@spring flax gud now?

boreal ravine
#

In this case I said multiple so do you have multiple instances of your bot running?

stuck flare
#

i dont think so

jagged wigeon
#

how do i do them?

boreal ravine
jagged wigeon
#

idk

stuck flare
boreal ravine
jagged wigeon
#

ohhh

spring flax
#

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

jagged wigeon
#

i just need help

#

just one time

#

with indents

boreal ravine
#

!indents

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

jagged wigeon
#

the rest i will try to learn

stuck flare
#

how do i stop my bot running from command propmpt

jagged wigeon
#

@boreal ravine

#
class suggestions(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command(description = 'Add a suggestion for this community!')
    async def suggest(self, ctx, *,suggestion):

        
        await ctx.channel.purge(limit = 1)
        channel = discord.utils.get(ctx.guild.text_channels, name = 'πŸ’‘β”‚suggestions')

        suggestEmbed = discord.Embed(colour = 0xFF0000)
        suggestEmbed.set_author(name=f'Suggested by {ctx.message.author}', icon_url = f'{ctx.author.avatar_url}')
        suggestEmbed.add_field(name = 'New suggestion!', value = f'{suggestion}')

        await channel.send(embed=suggestEmbed)

def setup(bot):
    bot.add_cog(suggestions(bot))```
#

gud?

spring flax
jagged wigeon
#

oh

#

but is the last command gud?

#

i didnt

spring flax
#

are you copying code...?

stuck flare
#

@boreal ravine i didnt realize that the code was also running in vsc lol

boreal ravine
#

No :)

spring flax
#

you are missing a required kwarg on making the embed instance i think

stuck flare
#

now i get this error discord.ext.commands.errors.CommandNotFound: Command "ping" is not found

#
@bot.command(name="ping")
async def ping(ctx: commands.Context):
    await ctx.send(f"Pong! {round(bot.latency * 1000)}ms")```
jagged wigeon
jagged wigeon
#

eh whatever

#

i will stop, no one helps me

stuck flare
#

bruv dead chat

#

!cogs

#

!cog

drifting arrow
#

oh

#

@stuck flare oh

maiden fable
drifting arrow
#

is that command in a cog @stuck flare ?

stone palm
#

hi

maiden fable
drifting arrow
# maiden fable No

his comments are !cog and !cogs, i assume he wanted it to be in a cog. hold up.

stone palm
#

so um
how do i send a menu

drifting arrow
maiden fable
maiden fable
jagged wigeon
stone palm
# maiden fable Select Menu?

yes...```py
class Select(discord.ui.Select):
def init(self):
super().init(custom_id="Some identifier", placeholder="Placeholder", min_values=1, max_values=1, options=[discord.SelectOption(label="Hello", emoji="😳")])

    async def callback(self, interaction: discord.Interaction):
        await interaction.response.send_message("Hello", ephemeral=True) # to get the selected options, you can use interaction.data
maiden fable
jagged wigeon
#

i abondonated it

jagged wigeon
#

idk how to do it

#

in commands.Bot thought

maiden fable
maiden fable
jagged wigeon
#

please

maiden fable
#

Get the channel where u want to send the message with channel = guild.get_channel(id)

Then just do channel.send(suggestion)

#

!d discord.Guild.get_channel

unkempt canyonBOT
#

get_channel(channel_id, /)```
Returns a channel with the given ID.

Note

This does *not* search for threads.
maiden fable
slate swan
#
async def check_perms(check: str):
                fetch_arg = check
                db_func = discord.utils.get(bot.get_all_channels(), name=fetch_arg)
                channel_id = db_func.id
                db_user = bot.get_channel(channel_id)


                msg_info = discord.utils.get(db_user.history(limit=100).flatten())
                msg = msg_info.content
                msg_id = msg_info.id
                msg_fetch = db_user.fetch_message(msg_id)
                return msg


# Permission Variables
mod_one = check_perms("mod_one")
mod_two = check_perms("mod_two")
mod_three = check_perms("mod_three")
perm_on_member_join = check_perms("perm_on_member_join")
content_on_member_join = check_perms("on_member_join_content")

So, instead of the function returning the message inside a channel, it returns:

<coroutine object check_perms at 0x7fc11dfed830>

Anyone know why it's doing that?

maiden fable
#

Ah

stone palm
maiden fable
#

await check_perms()

#

Cz it's async

#

You forgot to await it

stone palm
#

wait what do i import

#

?

slate swan
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 30007): Maximum number of webhooks reached (10)
``` how would i catch that error in a except block ?
slate swan
jagged wigeon
#

yes?

maiden fable
maiden fable
jagged wigeon
#

oh

#

its not that easy

#

but man

#

i wanted a suggest command

maiden fable
#

Well I have made it before, sooo I can say it is easy once u figure out the logic

#

I ain't spoonfeeding, if u want that, sorry

jagged wigeon
#

oh

#

ok

slate swan
slate swan
# maiden fable except discord.HTTPException:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 30007): Maximum number of webhooks reached (10)``` ![aPES_Think](https://cdn.discordapp.com/emojis/493353113332219924.webp?size=128 "aPES_Think")  it raised the error then send the message
stone palm
#
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot.py", line 886, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/runner/BetaBot/cogs/buttons.py", line 6, in <module>
    class Buttons(commands.Cog):
  File "/home/runner/BetaBot/cogs/buttons.py", line 17, in Buttons
    view = discord.ui.View()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ui/view.py", line 166, in __init__
    loop = asyncio.get_running_loop()
RuntimeError: no running event loop

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

Traceback (most recent call last):
  File "main.py", line 16, in <module>
    client.load_extension("cogs.buttons")
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot.py", line 958, in load_extension
    self._load_from_module_spec(spec, name)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot.py", line 889, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.buttons' raised an error: RuntimeError: no running event loop
#

how do i run it?

#

await view.start()?

slate swan
# maiden fable await check_perms()
def check_perms(chid: int):
                db_user = bot.get_channel(chid)
                msg_info = discord.utils.get(db_user.history(limit=100).flatten())
                msg = msg_info.content
                return msg


# Permission Variables
mod_one = check_perms(890184706669301760)
mod_two = check_perms(890184726688710697)
mod_three = check_perms(890184754169774130)
perm_on_member_join = check_perms(890182787557097552)
content_on_member_join = check_perms(890180502982656030)

well it's now AttributeError: 'NoneType' object has no attribute 'history'

hasty iron
#

get_running_loop raises an error if no loop is running as you can see

#

it has nothing to do with the view

#

oh nvm

#

its disnake's fault

#

actually

#

you have to instantiate a view inside a command

#

or when the bot is running

boreal ravine
hasty iron
#

not before

stone palm
#

oh

slate swan
#

I get that - but why

hoary gust
#

guys how can i run a different file from one another file

slate swan
hoary gust
#

i mean i am trying to run a file of my dashboard from my main file

hasty iron
slate swan
hasty iron
#

do those operations after the bot starts

hoary gust
#

@hasty iron can u plz help me

hasty iron
hoary gust
#

i want to run the file from my main file but how

slate swan
hoary gust
#

bot.loop

stone palm
#

why do i keep on getting this?

hoary gust
#

???

slate swan
hasty iron
# hoary gust quart

ok so quart has an async function that runs the application that is app.run_task, import your app variable to the bot file, and use bot.loop.create_task(app.run_task())

hasty iron
stone palm
#

how should i be doing it...?

hasty iron
#

there is no reason for you to nest classes

stone palm
#

ok

slate swan
#

getting the same error

stone palm
hasty iron
#

??

#

why are you trying to do that

hoary gust
#

ok wait i got the way

hasty iron
#

you're trying to get the bot?

#

into the app?

stone palm
hasty iron
#

not talking to you

stone palm
#

oh

#

im trying to make a simple menu ;-;

stone palm
#

it isnt working :/

drifting arrow
#

Now to monitor my reddit application and make loads of comments and posts to ensure it works as intended.

stone palm
#

added something similar

hasty iron
#

thats no where as similar to the example

stone palm
#

hmmmm

hasty iron
#

dont know where they added nested classes in the example

boreal ravine
#

How would I go about converting my account creation date (2020, 6, 9) to an epoch time?

hasty iron
#

you mean a unix timestamp?

boreal ravine
#

yes

hasty iron
#

!d datetime.datetime.timestamp

unkempt canyonBOT
#

datetime.timestamp()```
Return POSIX timestamp corresponding to the [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") instance. The return value is a [`float`](https://docs.python.org/3.10/library/functions.html#float "float") similar to that returned by [`time.time()`](https://docs.python.org/3.10/library/time.html#time.time "time.time").

Naive [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") instances are assumed to represent local time and this method relies on the platform C `mktime()` function to perform the conversion. Since [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") supports wider range of values than `mktime()` on many platforms, this method may raise [`OverflowError`](https://docs.python.org/3.10/library/exceptions.html#OverflowError "OverflowError") for times far in the past or far in the future.

For aware [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") instances, the return value is computed as:

```py
(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()
```   New in version 3.3.

Changed in version 3.6: The [`timestamp()`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime.timestamp "datetime.datetime.timestamp") method uses the [`fold`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime.fold "datetime.datetime.fold") attribute to disambiguate the times during a repeated interval.
boreal ravine
#

hmmm

stone palm
#
class Dropdown(discord.ui.Select):
    def __init__(self):
        super().__init__(custom_id="Some identifier", placeholder="Placeholder", min_values=1, max_values=1, options=[discord.SelectOption(label="Hello", emoji="😳")])
    
    async def callback(self, interaction: discord.Interaction):
        await interaction.response.send_message("Hello", ephemeral=True) # to get the selected options, you can use interaction.data
    

class DropdownView(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.add_item(Dropdown)

    @commands.command()
    async def select(self, ctx):
        view = DropdownView()
        await ctx.send("ok", view=view)
#

ok now?

hasty iron
#

why is the command inside the view?

stone palm
#

its a cog '_'

hasty iron
#

yeah clearly from the code you just sent

stone palm
#

so...?

hasty iron
#

so what

#

you didnt instantiate Dropdown

boreal ravine
stone palm
#

hmmmmm

grim oar
boreal ravine
boreal ravine
# unkempt canyon

I got the hang of it I just dont know how you can use member.created_at inside the time.time thing or the datetime thing

hasty iron
#

what

#

member.created_at returns a datetime object

#

time.time returns the current time

#

!d time.time

unkempt canyonBOT
#

time.time() β†’ float```
Return the time in seconds since the [epoch](https://docs.python.org/3.10/library/time.html#epoch) as a floating point number. The specific date of the epoch and the handling of [leap seconds](https://en.wikipedia.org/wiki/Leap_second) is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds since the epoch. This is commonly referred to as [Unix time](https://en.wikipedia.org/wiki/Unix_time). To find out what the epoch is on a given platform, look at `gmtime(0)`.

Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.
reef mica
#

how do I convert and int or str to discord.Member

#

any ideas

slate swan
#

and

#

int

#

or string_

#

can you tell me the code

reef mica
#

rn i dont have any

#

my idea is to use the get_member

#

so I input an int

#

and it puts the int in the get_member function

#
member = int(input("Member Id To Move: "))
channel = int(input("Channel Id To Move: "))
member = client.get_guild(713310556572090439).get_member(member)
await member.move_to(client.get_channel(channel))
print("Moving")
#

dont know if this gonna work

hasty iron
unkempt canyonBOT
#

class discord.ext.commands.MemberConverter(*args, **kwargs)```
Converts to a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member").

All lookups are via the local guild. If in a DM context, then the lookup is done by the global cache.

The lookup strategy is as follows (in order)...
reef mica
#

another question

#

how can I implement

    while True:
        member = int(input("Member Id To Move: "))
        channel = int(input("Channel Id To Move: "))
        member = client.get_guild(713310556572090439).get_member(member)
        await member.move_to(client.get_channel(channel))
        print("Moving")

#

so it runs all the time

#

and doesnt cancel the other listeners

#

i put it in onready but that didnt work

jade jolt
#

iirc you cant

reef mica
#

bruh