#discord-bots

1 messages · Page 982 of 1

visual island
#

discord.ext.commands.Bot covers all method and attribute discord.Client has. If you want to use regular commands, you should use Bot. If you want to use E.g. events only or interactions only you can use both. Note that Bot has much more features than Client.

sacred oyster
#

```fix
"text"

#

yeah

#

and "fix" for orange

sacred oyster
visual island
#

Please show the full traceback, every part of the traceback is always helpful, don't crop it.

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

sacred oyster
#
import discord
import os

client = discord.Client()

@client.event
async def on_ready():
    print("I'm in")
    print(client.user)

@client.event
async def on_message(message):
    if message.author != client.user:
        await message.channel.send(message.content[::-1])

token = os.environ.get("DISCORD_BOT_SECRET")
client.run(token)```(https://paste.pythondiscord.com/sadazuvulo)
@visual island
#

copy the text here

#

and send the link

#

Traceback (most recent call last):
File "main.py", line 17, in <module>
client.run(token)

visual island
#

!traceback Full traceback would look like this.

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

toxic thicket
#
@bot.command()
@commands.has_any_role(692760082085183519, 940008547993927691, 863878825376743475, 902292952381001779, 863879069253894166, 902292952381001779, 863879304110276668, 940008547993927691)
async def пред(ctx, member: discord.Member = None, *, reason = 'Отсутствует'):
    print(45)
    cursor.execute("""CREATE TABLE IF NOT EXISTS warning(guild_id BIGINT, user_id BIGINT, warn INT, count INT, moderator_id BIGINT, reasons VARCHAR)""")
    base.commit()
    print(1)
    
    warnings = cursor.execute("SELECT * FROM warning WHERE user_id = ? AND guild_id = ?", (member.id,ctx.guild.id)).fetchone()
    print("работает")
    
    
    if member is None:
        await ctx.send("Выберите участника")
        return
        
    if warnings is None:
        cursor.execute('INSERT INTO warning(guild_id, user_id, warn, count, moderator_id, reasons) VALUES(?, ?, ?, ?, ?, ?)', (ctx.guild.id,member.id,0,1,ctx.author.id,'Отсутствует'))
        base.commit()
        print(2222)
        cursor.execute(f'UPDATE warning SET warn = warn + 1 WHERE user_id = ? AND guild_id = ?', (member.id, ctx.guild.id))
        base.commit()
        await ctx.send(f"**{ctx.author.name}** Выдал предупреждение #{warnings[2]} {member} (случай # ) {reason}")
    else:
        cursor.execute(f'UPDATE warning SET warn = warn + 1 WHERE user_id = ? AND guild_id = ?', (member.id, ctx.guild.id))
        base.commit()
        await ctx.send(f"**{ctx.author.name}** Выдал предупреждение #{warnings[2]} {member} (случай # ) {reason}")     

how to make it so that if the reason is not specified, then Отсутствуетis not written in the chat?

loud junco
#
bot = commands.Bot(command_prefix = 'rpm ', case_insensitive=True)
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.

loud junco
#

is the case_insensitive = True not working anymore

placid skiff
#

That's because the client doesn t represent a discord Bot, but the application (the one created in the dev portal)
With the application you decide what you want to do with it, a bot, a game, etc

sacred oyster
#

is long

#

i cant copy it

placid skiff
#

PUHAHAHAHAHA I LAUGH

loud junco
#

for godsake

#

how long is this error

loud junco
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.

placid skiff
loud junco
#

use this link

sacred oyster
heavy folio
placid skiff
#

Probably you have tried to make some bot actions in a short time

sacred oyster
loud junco
loud junco
heavy folio
#

yeah

loud junco
#

but its not working

#

bot = commands.Bot(command_prefix = 'rpm ', case_insensitive=True)

heavy folio
#

how did you invoke it?
errors?
code?

loud junco
heavy folio
#

case_insensitive is for commands not prefix

sacred oyster
#

blocked? ;-;

loud junco
#

but no output when i use the prefix as Rpm

sacred oyster
loud junco
heavy folio
#

yeah although there is an example of case insensitive prefix, but it's kinda complicated

loud junco
heavy folio
#
fallback = os.urandom(32).hex()
prefixes = ['pls', 'pls ']

def get_prefix(bot, msg):
    comp = re.compile("^(" + "|".join(map(re.escape, prefixes)) + ").*", flags=re.I)
    match = comp.match(msg.content)
    if match is not None:
        return match.group(1)
    return fallback
bot = Bot(command_prefix=get_prefix)
```![duckshrug](https://cdn.discordapp.com/emojis/920176635565715556.webp?size=128 "duckshrug")
placid skiff
loud junco
#

im crying just by reading this

#

what in tarnation is this

heavy folio
#

some regex shit

#

did you just install 2.0

#

hm

#

are you on discord.py 2.0
because there are two possibilities:

  1. you just installed 2.0 and your linter didnt refresh
  2. you didnt even install 2.0 hence discord.ui isnt a thing
slate swan
#

Is it possible for the bot to do:
,msguild 123456789... hello

This should send the hello to the server with this guild id

heavy folio
#

pip install git+https://github.com/Rapptz/discord.py

heavy folio
sacred oyster
heavy folio
#

wait you cant just message a guild
you can only message in a channel of a guild

slate swan
#

Currently I use a command (send to all guilds) it sends to the channel on top

#

I’m fine with that

heavy folio
#

cuz you didnt import os and what the hell is config

heavy folio
#

because your not on 2.0 as i said

#

2bad4u

#

you cant install 2.0 on replit afaik

brittle flume
#

Idk why but whenever I leave a non required text box empty in my modal it raises

Ignoring exception in modal <ApplicationModal timeout=None children=5>:Traceback (most recent call last):
  File "/data/data/com.termux/files/home/codes/otaku/venv/lib/python3.10/site-packages/discord/ui/modal.py", line 187, in _scheduled_task         await self.on_submit(interaction)
  File "/data/data/com.termux/files/home/codes/otaku/extensions/applications/apply.py", line 69, in on_submit
    await channel.send(embed=application(interaction.user, self.responses))                                                                     File "/data/data/com.termux/files/home/codes/otaku/venv/lib/python3.10/site-packages/discord/abc.py", line 1503, in send                        data = await state.http.send_message(channel.id, params=params)      File "/data/data/com.termux/files/home/codes/otaku/venv/lib/python3.10/site-packages/discord/http.py", line 501, in request                     raise HTTPException(response, data)                                discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body                                                          In embeds.0.fields.4.value: This field is required
#

Oh

slate swan
#

because you cant add spaces to the name when running a file from the cli

#

it will take it as the next argument

brittle flume
#

Add qoutes

#

Like a string

#

@slate swan

#

python Select\ Menu\ (Not\ done\ yet).py

velvet haven
brittle flume
brittle flume
#

Wait I'll try

#

Idk

#

It works for me fine

#

Ig get rid of the parentheses

#

Get rid of ( ) from your file name

slate swan
# velvet haven How do I make welcome messages in discord.py

first of all you store the ids of welcome channels set by a user with permissions in a database (mongoDB [json-based], SQLite, PostgreSQL, MySQL, etc.), then you use the on_member_join event to see which member joined which guild

''' an example of the event '''
@Bot.listen("on_member_join")
async def check_member_join(member: discord.Member):
  ''' attributes and methods of "member" are the same as that of a Member '''
brittle flume
#

Wait it'll this time

slate swan
#

@slate swan change the name of the file to select_menu.py
and run the following command:

#

python select_menu.py

brittle flume
#

Try this python Select\ Menu\ \(Not\ done\ yet\).py

#

It will work for sure

#

?

#

Stay happy

#

Lol

#

Yes

slate swan
brittle flume
#

Like a while ago

slate swan
#

no-

supple thorn
#

You can fix that

lyric apex
#

Bruhh

velvet haven
#

how to get channel id when i pass in a command in that perticular channel

lyric apex
#

My Commands Are Working But The Ids Are Not Getting saved in the database

#

?

unkempt canyonBOT
#

This module provides access to the select() and poll() functions available in most operating systems, devpoll() available on Solaris and derivatives, epoll() available on Linux 2.5+ and kqueue() available on most BSD. Note that on Windows, it only works for sockets; on other operating systems, it also works for other file types (in particular, on Unix, it works on pipes). It cannot be used on regular files to determine whether a file has grown since it was last read.

Note

The selectors module allows high-level and efficient I/O multiplexing, built upon the select module primitives. Users are encouraged to use the selectors module instead, unless they want precise control over the OS-level primitives used.

supple thorn
#

This will get the id of the channel where the command was used in

#

Are you asking people if they have a select menu so you can copy it

lyric apex
#
@client.event
async def on_message(ctx): 
    print(f"{ctx.channel}: {ctx.author}: {ctx.author.name}: {ctx.content}")
    if "python" in str(ctx.content.lower()):
        post = {"_id": ctx.author.id, "score": 1}
        collection.insert_one(post)
        await ctx.channel.send('hi')```
#

This is my event

supple thorn
lyric apex
#

message?

supple thorn
#

You should name it message so people don't get confused

heavy folio
#

yes

lyric apex
#

I should try that?

supple thorn
#

Because it takes message

#

It's just a name but you still should practice good naming conventions

lyric apex
heavy folio
#

how do you know it isnt getting saved

supple thorn
supple thorn
#

Like literally check on the mongodb website

slate swan
#

refresh the website

supple thorn
#

Hello ashley

slate swan
#

Heya Skev

supple thorn
heavy folio
supple thorn
#

Coke slushee taste good

slate swan
#

ew

supple thorn
heavy folio
#

im not asking that literally
i meant "how are you so sure bout it"

supple thorn
supple thorn
supple thorn
#

Blocking

lyric apex
supple thorn
#

Yeah

lyric apex
#

I dont about it

#

What it is?

supple thorn
#

It's so that mongodb is not blocking

#

Makes it async

#

It's an async mongodb driver

#

Since using mongodb on it's own makes it blocking

#

Which freezes your entire bot until that certain task is finished

#

It's like

#

Async you have two arms to do things sync you only have one arm

lyric apex
#

So i have to install it?

supple thorn
#

If you want to make mongodb not blocking then yes

lyric apex
#

How do i do it?

supple thorn
unkempt canyonBOT
supple thorn
#

It should just be pip install motor

loud junco
#

i know its stupid but

lyric apex
#

Ohk

loud junco
#

how do i make it works

#

its working already

supple thorn
loud junco
supple thorn
#

Cause it looks right

loud junco
#

should be 'rpm '

#

i missed the space

frozen patio
#

Is aiosqlite3 a good database for a leveling system?

frozen patio
#

Thank you

#

It has to be better than json

velvet haven
#
@commands.command(name = "addc", help = "Adds the channel to send welcome messages")
async def addc(self,ctx):
    channel_id = []
    id = ctx.channel.id
    channel_id.append(id)
    await ctx.send("You have added this channel to send welcome messages")```
supple thorn
frozen patio
lyric apex
frozen patio
#

But a database will be way better for this

velvet haven
supple thorn
frozen patio
supple thorn
#

Also you should use a database for this

velvet haven
#

i tried using it

velvet haven
supple thorn
#

list items gets removed when the bot dies

#

Or when the bot turns off

frozen patio
#

Yeah

supple thorn
#

If you want the ids to stay for a long time

#

Use a database

frozen patio
#

Use SQLite

supple thorn
#

No

velvet haven
supple thorn
#

Aiosqlite

supple thorn
frozen patio
supple thorn
#

Python is python

velvet haven
supple thorn
frozen patio
supple thorn
velvet haven
frozen patio
supple thorn
#

Also that list's contents you will never see

frozen patio
supple thorn
#

Because all of those contents disappear when the command finishes

supple thorn
#

Why is it 24/7 in the first place

frozen patio
#

Nothing in this world is free

supple thorn
#

If you aren't making money off it

velvet haven
supple thorn
#

It doesn't have to be 24/7

frozen patio
#

Yeah

supple thorn
#

24/7 costs money

frozen patio
#

I have a VPS from New York

#

Very nice

supple thorn
#

If you aren't ready to spend then don't make it 24/7

velvet haven
#

why not

supple thorn
#

Theres no point to 24/7

#

Because it isn't used most of the time

frozen patio
#

Yea

lyric apex
#

Bro you didn't seeyert @supple thorn

heavy folio
unkempt canyonBOT
#

Whether to strip whitespace characters after encountering the command prefix. This allows for ! hello and !hello to both work if the command_prefix is set to !. Defaults to False.

New in version 1.7.

supple thorn
lyric apex
supple thorn
vocal snow
tall pecan
#

How to create a bot using text mode not embed

#

Sorry i'm new at coding

supple thorn
tall pecan
#

1
2
3```
#

like that

supple thorn
#

Just send text

tall pecan
#

idk how

supple thorn
#

!d discord.ext.commands.Context.send

unkempt canyonBOT
#
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=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.10)") 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.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
tall pecan
#

@supple thorn

supple thorn
tall pecan
#

@bot.command()
async def help(ctx, category=None):
await ctx.send('```ini
BOT-HELP-CMD

[ .help ] Get help with a command
[ .admin ] Administration
[ .image ] Image commands
[ .fun ] Funny commands
[ .tools ] General tools```') it work like this?

supple thorn
#

Yes

#

It should

tall pecan
#

but everytime i run it it doesn't work

supple thorn
#

Actually

#

Use multi line strings

tall pecan
#

what is this?

supple thorn
#

""" """

tall pecan
#

sorry i'm new at coding

#

can u teach me?

supple thorn
#

It's just
"""
Multi
Line
String
"""

supple thorn
tall pecan
#

@bot.command()
async def help(ctx, category=None):
await ctx.send("""```ini
BOT-HELP-CMD

[ .help ] Get help with a command
[ .admin ] Administration
[ .image ] Image commands
[ .fun ] Funny commands
[ .tools ] General tools```""") it work like this?

#

like this?

#

where to put """

supple thorn
#

Yes like that

tall pecan
#

okay let me try to run it

tall pecan
#

i have been 3 days trying to do it but not working

supple thorn
loud junco
#

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

loud junco
#

i did rpm craft pog sword

#

and i didnt get any output

#

no error also

#

line 135 is process about crafting pog sword

slate swan
#

i get an error with this line, it says i need to clarify 'self' but i dont rlly know what it means, couldnt fild anything online so i figured i'd ask here

loud junco
#

whats with the (, name=f'box-{i}`)

#

whats the , doing in there

slate swan
#

im typing before that and i was trying diff things

#

anyway, whats with the 'self' thing?

slate swan
#

refers to "class" thing, i believe you're using Cogs

#

but what do i put in self

#

..

#

for self, put self

loud junco
#

an example for self

supple thorn
slate swan
#

@slate swan the first agument that you've passed in init function is 'self'

supple thorn
slate swan
supple thorn
#

Hello kayya

slate swan
#

that's what we do most of the time.. so..i hope u got my point ")

#

Happy Easter everyone💜

loud junco
slate swan
#

💜

loud junco
slate swan
#

today's easter? :'/ i didn't even know :'/

loud junco
#

ye

supple thorn
slate swan
#

we don't have here in our country, fuck :'/

#

anyways, happy easter ya'all :'>

supple thorn
#

Why are you using a default discord.Guild

loud junco
supple thorn
#

Use your message object to get the guild attribute

slate swan
# slate swan

eh @slate swan .. despite of getting help with it.. i suggest u to learn about how to make commands

#

like.. we don't use message event like that

slate swan
#

:>

loud junco
slate swan
#

im new to discord.py so im trying my best, but hey if it works it works, but its cleared up now thanks, btw i will learn further no worries

#

Heloo 🇲🇾 :>

loud junco
#

but make sure to learn python first
like at least until classes(min req LOL)

slate swan
#

just saying, we don't make commands using on_message event

supple thorn
loud junco
slate swan
#

i was thinking to wrap the discord api should i?pithink

loud junco
supple thorn
supple thorn
#

Ayo someone stole my name

slate swan
#

hard

loud junco
slate swan
#

bro

supple thorn
#

@slate swan

slate swan
#

bro

#

@supple thorn

#

:>

supple thorn
#

Imposter

loud junco
slate swan
#

😂

slate swan
#

at least delete the space between the words

loud junco
#

can u hear this msg?

slate swan
#

yes

#

blackpink?

loud junco
#

...

slate swan
#

bro

#

nvm 😂

loud junco
#

not dudu dudu du

#

that one haizzzz forget it

slate swan
#

😭 omgg i'm sorry

loud junco
#

its the amongus song

slate swan
#

oooo

loud junco
#

du du du du du du du

slate swan
#

😳

loud junco
#

do re mi fa mi re do

#

if u sing in solphage

slate swan
#

now better

loud junco
#

idk how to spell solphage whatever

slate swan
#

we can't hear u sing or spell anyways.. so nobody gonna know

loud junco
#

what about

#

never gonna give u up

slate swan
#

never gonna let u down

loud junco
#

LOL u can hear it

slate swan
#

me too 😂

loud junco
#

before mod come and tells us to go to offtopic

slate swan
#

lmaoo

#

Im excited the new thread pithink

loud junco
#

?

#

what thread

slate swan
#

same question

supple thorn
slate swan
#

Threat*

loud junco
slate swan
#

lmao

loud junco
slate swan
#

the new advance thread!

#

:>

#

when we get the thread we have to say thank you to mina for surepithink

boreal ravine
slate swan
#

🤨

slate swan
#

it's alr.. but still? do they really? wtf

supple thorn
slate swan
#

😐 oh

supple thorn
#

I experienced it myself

slate swan
loud junco
#

lol

slate swan
#

it for sure uses on_message events

loud junco
#

on_message

#

it hurts my eyes

slate swan
#

isnt commands the same as on_message they just call get_context and get_prefix i think im not sure how the internal works with detecting commands

boreal ravine
slate swan
slate swan
#

tbh i never looked into the lib.. i just always referred docs lmao

loud junco
#

what about me

slate swan
#

i dont even read docs

slate swan
slate swan
boreal ravine
slate swan
#

me nub, i need help sometimes :'/

#

src is better imo

loud junco
loud junco
slate swan
slate swan
slate swan
boreal ravine
slate swan
#

omg, this is going off-topic, lmao

slate swan
unkempt canyonBOT
#

discord/ext/commands/bot.py line 1369

async def on_message(self, message: Message, /) -> None:```
slate swan
#

shit*

#

no

#

oh no

boreal ravine
slate swan
#

:'/

#

thats sift💀

#

😂 oh sorry

loud junco
slate swan
#

😂

loud junco
#

;-;

#

i wiill marry u if u fix this bug

slate swan
#

LMFAOOO

loud junco
#

jkjk

slate swan
#

got nice meme btw

#

thanks

#

🤨

slate swan
#

😂

slate swan
slate swan
loud junco
slate swan
#

and any on_message, since that may block your commands from running

#

oki dont hide yourself

loud junco
#
@bot.event
async def on_ready():
  activity = discord.Game(name="RPMinecraft", type=3)
  await bot.change_presence(status=discord.Status.online, activity=activity)
  print('We have logged in as {0.user}'.format(bot))
bot.remove_command('help')
#

no more althought this is not on_message

slate swan
#

😔

loud junco
#

only 1

slate swan
#

my_emote is a class right?

loud junco
#

yye

slate swan
slate swan
# loud junco yye

ill assume that the command works when you supply a single word arg or the number

#

right?

#

change the parser to cosume all the words in the command invocation ```py
async def craft(ctx, *, arg: str):

loud junco
#

thankss

#

idk how but its working LMAO

slate swan
# loud junco idk how but its working LMAO

lemme explain
basically the code you had parsed only 1st argument so suppose you used the command as !craft pog sword, the arg variable is just pog sword is ignored, adding the * makes the command parse all the words which appear after the command invocation

loud junco
#

oo

#

so 2 word argument need to add *?

slate swan
#

yeah

#

not really, it just consumes all the words after

#

*,arg

loud junco
#

so 999 words also can

#

okok understood thanksssssssssssssss

slate swan
#

no *,arg = !do my job output = my

#

yea

slate swan
#

.topic

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

Suggest more topics here!

frozen patio
#

Umm

slate swan
frozen patio
#

Hmm

slate swan
#

.ideas

frozen patio
slate swan
#

yeah 😦

#

.topic

#

hard finding ideas these days

frozen patio
#

I’m making a leveling system, ig

slate swan
#

i've made things that are unique and noone ever tried making them before

#

like a fivem server status bot

#

a game controller lol

#

through bot

frozen patio
#

Yea I am not that advanced

slate swan
#

it isn't that hard

frozen patio
#

To make unique things, no

slate swan
#

tbh, i find databases & leveling things quite confusing & hard

slate swan
#

.topic

lament depotBOT
#
**What feature would you like to see added to the library? What feature in the library do you think is redundant?**

Suggest more topics here!

frozen patio
slate swan
#

back in 2021 they left dpy to rot like sh*t 💀

frozen patio
#

Ikr

#

I use nextcord

slate swan
#

i never tried any other lib for bot developing

final iron
#

Modals are so useful

frozen patio
#

I need to learn disnake

slate swan
#

btw, do you guys know, how i can use the await timeout func cuz i can't seem to understand it

slate swan
frozen patio
#

I do not know that lib

slate swan
frozen patio
#

Nor do I know pycord

final iron
#

What lib are you using?

slate swan
#

pycord is horrible i hate it

#

is it like await timeout(time in seconds,membername,reason)?

frozen patio
final iron
#

What lib are you using

slate swan
#

!d discord.Member.timeout

unkempt canyonBOT
#

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

Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").

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

This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.edit "discord.Member.edit").
slate swan
#

that delay

frozen patio
#

Ikr

slate swan
#

@slate swan i did look into the docs for it, but i was unable to understand it

final iron
slate swan
slate swan
#

you just use the method on a class instance of the Member class

slate swan
#

no

#

could you give me a short example?

#
await member_instance.timeout(float, reason="no reason")
final iron
#

You know how a string object has a lower() method right?

slate swan
winged bone
slate swan
#

i haven't opened my ide for ages

slate swan
#

but the problem is i can't understand what it is

winged bone
#

From the docs (master)

slate swan
#

wait nvm

slate swan
winged bone
#

datetime.datetime is a date
and datetime.timedelta is a duration

#

e.g. when you subtract two datetime.datetime you get a timedelta

slate swan
#
timee = datetime.timedelta(seconds=time)
    await member.send(f'You have been timed out for {reason}')
    await timeout(timee, member, reason)``` something like this? time & reason are args
#

@winged bone

#

😶

winged bone
#

Close, timeout is a member method, so you have to do member.timeout(...)

slate swan
#

!d disnake.Member.timeout

unkempt canyonBOT
#

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

Times out the member from the guild; until then, the member will not be able to interact with the guild.

Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.

You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.

New in version 2.3.
slate swan
#

this does take a float tho

vocal snow
#

👎

winged bone
slate swan
slate swan
winged bone
slate swan
#

no its src

#

💀

winged bone
slate swan
#

good thing i dont use masterpithink

winged bone
slate swan
winged bone
slate swan
#

whos talking about slash commands💀

winged bone
#

You said you don't like the master branch somehow

slate swan
#

yeah but whos talking about slash commands🤨

#
  • indian guy
#

.topic

lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

winged bone
slate swan
# lament depot

it can control my pc from cmd to deleting or uploading files or writing in them

slate swan
slate swan
#

youre trying to prove a point that isnt even related to this conversation and that i already know of so im not sure what you want to prove

#

brainmon , just stop the argument man

#

and listen to

lament depotBOT
#
**Do you think there's a way in which Discord could handle bots better?**

Suggest more topics here!

modest plover
#

how do i do timestamps n shit?

slate swan
#

tbh it would be easier if message_content was not an intent but a scope instead

#

if the guild owners want them they could have just invited it with that scope, just like its done for slash commands

pliant gulch
#

!d discord.utils.format_dt

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
slate swan
#

oh, that exists too

modest plover
#

ok... buuuuuuuuttttt how do i work out the integer?

#

because im wanting to put something in the bots about me

maiden fable
modest plover
#

what about for a specific date?

#

ima need em in a giveaway

swift imp
#

How to display the ping and the author's message at the same time?
I tried to do something like thispy @bot.command(pass_context=True) async def send(ctx, member: discord.Member = None, arg): user = bot.get_user(member) text = arg await user.send(text)
The idea is that when you write !send @Member my best text the message should go to PM @Member and the text of the message should be "my best text", but I could not do it

modest plover
#

hmmth

winged bone
modest plover
swift imp
#

yes

winged bone
modest plover
#

what error

swift imp
#

(ctx, member: discord.Member = None, arg):
^^^
SyntaxError: non-default argument follows default argument

modest plover
#

arg: str?

#

try that

swift imp
#

no

boreal ravine
swift imp
#

okay thx

#

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

#

i send !send @swift imp message by me

winged bone
#

Hi, do you know how I can add a event listener to my commands.Bot subclass?
I have something like this:

class Bot(commands.Bot):
    
    @commands.Bot.listen("on_ready")
    async def on_ready1():
        assert self.user is not None
        print(f"Logged in as {self.user} (id: {self.user.id})")```but that obviously does't work, because Bot.listen is an instance method which takes self and name
sick birch
#

You can leave out the decorator

#

And change on_ready1 to on_ready

#

That way you override the default listener

winged bone
#

hm yeah.

sick birch
#

But if you want to add a listener as opposed to a event you’ll have to use self.add_listener() in your constructor

winged bone
#

oh ok

#

!d discord.ext.commands.Bot.add_listener

unkempt canyonBOT
#

add_listener(func, /, name=...)```
The non decorator alternative to [`listen()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.listen "discord.ext.commands.Bot.listen").

Changed in version 2.0: `func` parameter is now positional-only.
winged bone
#

like this? self.add_listener(self.on_ready1, name="on_ready")

sick birch
#

Yup

#

Exactly like so

winged bone
#

thx

#

I was a bit confused, because when using Cogs, you can do this:

class MyCog(commands.Cog):
    @commands.Cog.listener()
    async def on_ready(self):
        ...```
vocal plover
#

not that there is a default listener for on_ready anyway iirc, but yeah

grave summit
#

hi guys is it possible for my discord bot to take a screenshot of website and send it as a message in a channel?

slate swan
split merlin
#

Hello, So i wanted to connect paypal with my discord bot, something like donate bot, where you pay via paypal and you get privileges like roles or etc
I have created an app in paypal development account but all the tutorials i see online are django related and i am not sure how i should apply that to a discord bot, like in commands. I would appreciate any tips or leads, Thanks a lot

olive osprey
# modest plover how do i do timestamps n shit?

I personally use timestamps with the datetime API:

import datetime

Just use it in your command like this:

@bot.command()
async def test(ctx):
  x = datetime.datetime.utcnow().timestamp()
  await ctx.reply(f"{round(x)}")

And there you go with the timestamp. To format it, you need to use it like this:

await ctx.reply(f"<t:{round(x)}>")

You can also use this:

await ctx.reply(f"<t:{round(x)}:R>")
dawn lion
#

@swift imp hi, can you give invite to your server and give me owner (co owner)?

boreal ravine
#

don't give random people owner

dawn lion
slate swan
#

bro

split merlin
#

hmm?

dawn lion
#

I am not random peop

slate swan
#

friend?

dawn lion
#

@MZshnik hi, can you give invite to your server and give me owner (co owner)?

dawn lion
slate swan
olive osprey
grave summit
#

im doing a discord bot that is requesting html and sending it but getting trouble installing lxml

#

pip3 install lmxl not working

#

not sure if i can ask this here an tecnically not question about discord bot

grave summit
boreal ravine
grave summit
#

i was getting that yes but

#

it just worked randomly haha

#

pip3 install lxml the first one i tried

#

just worked , i dont get it

gaunt ice
#

mh

little shell
gaunt ice
#

hm

#

wrong reply

boreal ravine
little shell
#

oh

slate swan
gaunt ice
#

ig he didnt add it in PATH

frozen patio
#

Yeah

lyric apex
#

How do i set if statement if user exists in db reply this ?

slate swan
lyric apex
maiden fable
gaunt ice
lyric apex
#

Lol i hate it

slate swan
#

Same but free is free

#

Also I can Dos on it

#

there are better, free options

#

and thats not even a host, a webserver is required to keep it running 24/7

slate swan
#

Hekoru? Or something?

#

railway.app is a good choice, given that you would need a git repository ( either public or private )

#

K

#

another thing, the file system is ephemeral ( which is same for replit too)

#

K

#

I'm on it now

unkempt canyonBOT
#

Threads for #discord-bots? 🧵
A temporary thread for the meta-discussion of topical threads specifically for discord-bots.

#

Discord Bot Hosting
For the discussion of deploying your bot and taking the next steps to make your bot available 24/7.

#

Discord API & Gateway
For the discussion of Discord API endpoints and Gateway without using an existing wrapper.

slate swan
#

Ok

#

thanks mina, that was really needed :D

frozen patio
#

What? this should work...

slate swan
unkempt canyonBOT
#

Threads for subtopics within discord-bots
#965291480992321536 how do I reliably make my bot performant and available 24/7?
#965291516031549500 how do I work directly with Discord's API without a wrapper/library?
#965291445999239258 (temporary) I have a suggestion for a Discord bot subtopic!

velvet compass
#

It's happening

slate swan
frozen patio
slate swan
# frozen patio Ye

could you show the whole traceback, like the above part which you sent?

#

what do you set the value of member if its None

#

nvm sarthak god here

#

oh no ash

#

yes it is

slate swan
# frozen patio

try removing the str() even though maybe it wont, but give it a try

frozen patio
#

I tried

#

same error

frozen patio
slate swan
#

set the value to?

frozen patio
#

I did set it

winter canyon
#

Hi guys! I need help with my discord bot code. I try to make it activated 24/7 but it gives me weird errors, I use UpTimeRobot. I will copy paste the code here so if someone knows how to fix it, I will be so glad! ( I use Replit for it )

main.py

#Libaries Importation
import discord
from discord.ext import commands
import os
from keep_alive import keep_alive

#Client

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

@bot.event
async def on_ready():
    print(f'{bot.user.name} has connected to discord!')

@bot.event
async def on_member_join(member):
  await member.create_dm()
  await member.dm_channel.send(f'Welcome {member.name} to Magic-Tent server!\n Make sure to read the rules and verify.')

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

#Running the client
token = os.environ.get('Token')
keep_alive()
bot.run(TOKEN) 

keep_alive.py

from flask import Flask
from threading import Thread

app = Flask('')

@app.route('/')
def home():
    return "Hello. I am alive!"

def run():
  app.run(host='0.0.0.0',port=8080)

def keep_alive():
    t = Thread(target=run)
    t.start()
slate swan
#

uptimerobot banned replit and this question belongs to the thread ashley mentioned

winter canyon
#

So how should I make the bot online for 24/7

#

I didn't find much information in google or youtuble tutorials...

maiden fable
#

ic new threads

slate swan
# frozen patio

weird since, avatar returns an Asset not an str, how are you running the command? (like mentioning a member or not)

frozen patio
#

so just

#

!level

winter canyon
#

Jonathan, how are you using VSCode for Bot coding?

#

I tried to use but it was super weird...

frozen patio
#

I downloaded it on my PC

winter canyon
#

You added discord to your Pip3?

maiden fable
slate swan
winter canyon
maiden fable
frozen patio
#

Maybe I use nextcord instead

slate swan
slate swan
winter canyon
#

I think I have it already

slate swan
winter canyon
#

Yeah I did all of these.

maiden fable
#

Wait, @slate swan do u know how to see the active threads in the callstack? I have been using the threading module lately but it doesn't show the active threads

slate swan
#

so i want my view to continue running

#
    @commands.Cog.listener()
    async def on_ready(self):
        view=View(timeout=None)
        view.add_item(select)
        view.add_item(select2)
        self.bot.add_view(view)
slate swan
maiden fable
#

Nope

#

Well, probably

slate swan
#

but instead of class classname(discord.UI.view) i have class classname(command.Cogs)

slate swan
maiden fable
#

I cannot see those in the VSC UI

slate swan
slate swan
frozen patio
winter canyon
#

So how do I make my bot activated 24/7 in VSCode?

frozen patio
#

You do not

winter canyon
#

If UpTimeRobot doesn't work and Replit..

frozen patio
#

It is a code editor

winter canyon
#

DEATH

frozen patio
#

Not a host

#

Unless you keep your PC on 24/7 to keep the file on

winter canyon
#

So how Dyno, ModMail and these bots are activated at all the time?

slate swan
frozen patio
winter canyon
slate swan
hollow quarry
#

it's in no way related to VSCode

junior verge
#

A VPS

winter canyon
#

So in-case I want to make my bot active 24/7, which code editor or place should I use?

junior verge
#

This has nothing to do with a code editor mate

winter canyon
#

Aw man :(

slate swan
junior verge
#

Yeah

winter canyon
#

I see..

#

Cry

#

Cry cry ;-;

slate swan
#

sad

winter canyon
#

Yep.

#

So do you recommend me to use VSCode instead of Replit?

frozen patio
#

YES

winter canyon
#

Why caps lol

frozen patio
#

Because repl trash

winter canyon
#

Oki then o7

#

I'll change it.

frozen patio
#

👍

winter canyon
#

Thanks for the help and patience guys, I appreciate it.

frozen patio
#

😄

brave forge
#

I have a command to just send any message to the participant in the bos, but when I try to do the same thing, an error is issued here

slate swan
#

send the message before you kick, because the bot can only dm userd who are in the same guild as your bot's

brave forge
#

@slate swan thank you ❤️

slate swan
#

How to get the person that did the interaction?

#

With buttons

#

thank

#

wait what

pliant gulch
#

!d discord.Interaction.user

unkempt canyonBOT
slate swan
#

oh

#

thank

pliant gulch
#

Some wrappers have it as author, and some have it as user so I was a bit confused

slate swan
#

ye it works :P

#

How to get interaction channel?

pliant gulch
#

!d discord.Interaction.channel

unkempt canyonBOT
river swift
#

how can i turn on my bot im new to this :,,v

junior verge
#

Where do you have your bots code?

sick birch
slate swan
slate swan
pliant gulch
#

Running my bot with punch cards

final iron
#

Good idea

junior verge
#

word is a good editor

brave forge
#

and the event for greeting and saying goodbye to participants who have logged on to the server now works with restrictions ?

maiden fable
#

Yea, u need members intent

brave forge
junior verge
#

Code?

slate swan
#

Hey guys how could I check if my string is already a key in a dict in a json file?

#

with open("users.json","r") as w:
users = json.load(w)
if user.id in str(users.keys()):

#

fuck me

#

thx

pliant gulch
#

Not a big deal, but you don't need the keys() call at the end, you can just do ```py
str(user.id) in users

vocal plover
#

That's very vague, what exactly isn't working, in exactly what way is it not working, and what steps have you taken to fix it so far?

#

You still haven't actually told us anything

cloud dawn
#

Could you show your project directory layout?

vocal plover
#

All we see is a line under the word config

cloud dawn
#

I mean the files

#

How it's structured.

junior verge
#

Why do you need config?

cloud dawn
#

try from .config import *

unkempt canyonBOT
vocal plover
#

You need to provide a bot token to run() so it can login to Discord, if you're using getenv() you could be returned None if you're trying to get an env var that isn't set, so I'd recommend using os.env["TOKEN_OR_SOMETHING"] so you either get a valid token or an error that makes sense

#

ye I hit enter too soon

sacred oyster
#

Just the "token" variable

#

Put token

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.

normal lark
#

hi can u help me for this ? Traceback (most recent call last):
File "C:\Users\skand\PycharmProjects\pythonProject1\main.py", line 26, in <module>
** @bot.command()**
AttributeError: module 'discord.ext.commands.bot' has no attribute 'command'

slate swan
#

Docs.....

#

!d discord

unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

torn sail
narrow grail
#

what is the easiest way to make a submit system where people can submit a text?

winged bone
narrow grail
#

fine I got an idea. The simplest way is to send a message to me from the bot

thick skiff
#

hey how would i select a different part of an argument

#

so say my argument is *args and i have 2 arguments ('1366', '0') how would i only select the second argument that being zero if i want it to send a message with that second argument and not the first or both

#

so if run !command 1366 0 it will send two messages being the first number and then the second number

pliant gulch
#

It's a tuple, so just index it

#

!e ```py
print(("foo", "bar")[1])

unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your eval job has completed with return code 0.

bar
thick skiff
#

ohhh ok

#

ok so i may be trying to control my computer from a discord bot just for the fun of it and how would i get that to work in pyautogui.click

#

when i try and do it for positions it gives me errors

#
@bot.command()
async def clickat(ctx, *args):
    argz = args
    await ctx.send(args)
    pyautogui.click(x=((argz)[1]), y=((argz)[2]), clicks=1, interval=1, button='left')
#

this being my code for that

#

just calling from args didnt work so idk

full lily
#

is there an error

thick skiff
#

it gives me this discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: tuple index out of range

#

not the full error if you need the entire error i can give

#
Traceback (most recent call last):
  File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\marti\Documents\Discord bots\Why\bot.py", line 124, in clickat
    pyautogui.click(x=((argz)[1]), y=((argz)[2]), clicks=1, interval=1, button='left')
IndexError: tuple index out of range

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

Traceback (most recent call last):
  File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: tuple index out of range
Ignoring exception in command clickat:
Traceback (most recent call last):
  File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\marti\Documents\Discord bots\Why\bot.py", line 124, in clickat
    pyautogui.click(x=((argz)[1]), y=((argz)[2]), clicks=1, interval=1, button='left')
IndexError: tuple index out of range

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

Traceback (most recent call last):
  File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: tuple index out of range
pliant gulch
#

If you wanted to access the first element, use [0], the second, [1], and so on

thick skiff
#

ohhh

#

ty

#

that makes sense

#

keep in mind i have what is commonly called the big stupid

junior verge
#

Anyone got any discord bot ideas

thick skiff
#

that solves that error but its giving me this now Ignoring exception in command clickat:
Traceback (most recent call last):
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\marti\Documents\Discord bots\Why\bot.py", line 123, in clickat
pyautogui.click(x=((args)[0]), y=((args)[1]), clicks=1, interval=1, button='left')
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui_init_.py", line 598, in wrapper
returnVal = wrappedFunction(*args, **kwargs)
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui_init_.py", line 980, in click
x, y = normalizeXYArgs(x, y)
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui_init
.py", line 661, in normalizeXYArgs
location = locateOnScreen(firstArg)
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui_init
.py", line 175, in wrapper
return wrappedFunction(*args, **kwargs)
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui_init_.py", line 213, in locateOnScreen
return pyscreeze.locateOnScreen(*args, **kwargs)
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze_init_.py", line 373, in locateOnScreen
retVal = locate(image, screenshotIm, **kwargs)
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze_init_.py", line 353, in locate
points = tuple(locateAll(needleImage, haystackImage, **kwargs))
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze_init_.py", line 262, in _locateAll_python
needleFileObj = open(needleImage, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '1366'

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

Traceback (most recent call last):
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\marti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: FileNotFoundError: [Errno 2] No such file or directory: '1366'

vocal plover
#

There are some good ones :P

pliant gulch
#

The error pretty much tells you what is happening, 1366 doesn't exist

#

You need to make sure you have a real file name 1366

thick skiff
#

im tryna have 1366 be where to move click on screen

#

1366 being the far right edge of my screen

lofty pecan
#

I'm trying to find a way to host my discord bot, I have old pc home but honestly letting them run 24/7 sounds very bad for my personnal electricity consumption, and it means I would have to instal python all over again (doesn't sound that bad tho), and after talking a bit with a discord bot developper (a very very good one), he told me about a service called soyoustart, and that I need linux knowledge that I clearly don't have. I don't have Linux, just windows, and maybe he wasn't talking about that one lol. Anyway I see a lot of video online about hosting for free etc, but it seems stupid and the pinned message about that also explains I shouldn't use free services, It's just that I don't understand how to put my bot on a VPS or something like that, would there be any good documentions about the topic by any chance ?

jolly geyser
sick birch
#

But the best way would be to dockerize your bot, and deploy it to your VPS

#

You'd basically SSH into the machine your VPS gives you, which is like controlling a remove computer somewhere else, as if you were sitting in front of it

jolly geyser
sick birch
#

From there, depending on if you have your bot dockerized, you would install python, your app's dependencies, etc. With docker you won't have to do this

sick birch
jolly geyser
#

i want to restart my server

sick birch
#

So delete it and make a new one

frozen patio
#

I made enable/disable commands for a leveling system, but when I disable it it will not work anymore unless I retype all the code? Why is that? (There is no traceback for this)

@bot.command(aliases=['e', 'en'])
@commands.has_permissions(manage_guild=True)
async def enable(ctx):
    async with bot.db.cursor() as cursor:
        await cursor.execute("SELECT levelsys FROM levelSettings WHERE guild = ?", (ctx.guild.id,))
        levelsys = await cursor.fetchone()
        if levelsys:
            if levelsys[0]:
                return await ctx.send("The leveling system is already enabled.")
            await cursor.execute("UPDATE levelSettings SET levelsys = ? WHERE guild = ?", (True, ctx.guild.id,))
        else:
            await cursor.execute("INSERT INTO levelSettings VALUES (?, ?, ?, ?)", (True, 0, 0, ctx.guild.id,))
        await ctx.send("Successfully enabled the leveling system!")
    await bot.db.commit()

@bot.command(aliases=['d', 'dis'])        
@commands.has_permissions(manage_guild=True)
async def disable(ctx):
    async with bot.db.cursor() as cursor:
        await cursor.execute("SELECT levelsys FROM levelSettings WHERE guild = ?", (ctx.guild.id,))
        levelsys = await cursor.fetchone()
        if levelsys:
            if not levelsys[0]:
                return await ctx.send("The leveling system is already disabled.")
            await cursor.execute("UPDATE levelSettings SET levelsys = ? WHERE guild = ?", (False, ctx.guild.id,))
        else:
            await cursor.execute("INSERT INTO levelSettings VALUES (?, ?, ?, ?)", (False, 0, 0, ctx.guild.id,))
        await ctx.send("Successfully disabled the leveling system. :/")
    await bot.db.commit()
sick birch
#

Because automating this could easily be used maliciously

jolly geyser
#

like to delete all channels and make new one

#

i want to automate my server

daring olive
#

so no, please don't ask for help on this

sick birch
#

Right, so I'm reluctant to advise you on how to do so

sharp wasp
#

Hi, I've got a question : I've got Py-cord and discord.py both installed (via pip), which one will be imported when I type import python ?

jolly geyser
#

if i make a nuke bot discord will ban me because that is breaking ToS

sick birch
#

Right

junior verge
jolly geyser
#

wait is that from stack overflow?

sharp wasp
sick birch
frozen patio
#

or do import discord

sharp wasp
#

It says import could not be resolved for pycord. When I go to pycord github, then import "discord" : @frozen patio

frozen patio
#

I do not use those so idk

junior verge
#

pycord hm

frozen patio
#

do

#

pip install pycord in your terminal

sharp wasp
#

done

#

@frozen patioapparently pycord is a fork of discord.py. So they're imported using the same command (import discord), but how does python know which one I want ?

boreal ravine
frozen patio
#

I can use nextcord & python seperately with no questions asked

boreal ravine
#

and don't ping people for help, there are tons of other people that can help around here

sharp wasp
#

Sorry for pinging

boreal ravine
lofty pecan
sharp wasp
frozen patio
frozen patio
lofty pecan
boreal ravine
frozen patio
boreal ravine
frozen patio
boreal ravine
boreal ravine
frozen patio
boreal ravine
#

by adding it.. inside your enable command

frozen patio
#

I do not use print debug commands so I do not know how to add those

boreal ravine
#

print statements
print()

frozen patio
#

What do you want me to print

boreal ravine
#

anything

frozen patio
#

Oh ok

lofty pecan
#

Just print something like It works

#

And put it where you think there is a problem

boreal ravine
#

no

#

add it everywhere

frozen patio
#

I did that

lofty pecan
#

That's usually what I do

frozen patio
#

No traceback

lofty pecan
#

I usually print problematic variables to see what they are

boreal ravine
sick birch
#

From there, you can run your bot file like you might on your regular computer

#

That is,

python3 <filename>.py
lofty pecan
#

hoo

boreal ravine
lofty pecan
#

using a vps I can create a folder ?

#

and then use that command to run the bot ?

sick birch
#

Sure you can: mkdir

frozen patio
sick birch
lofty pecan
#

that sounds so out of my range of skills omg

sick birch
#

A little bit of linux knowledge would be helpful

boreal ravine
lofty pecan
#

ye I know nothing haha

sick birch
rotund creek
#

!pypi discordbotweb

unkempt canyonBOT
sick birch
#

I use it to SSH into my AWS EC2 instance where I host my bot

frozen patio
sick birch
# unkempt canyon

As someone currently making a dashboard for my bot I find this very offensive 😂

frozen patio
#

Nothing else

lofty pecan
vocal plover
#

svelte my beloved

boreal ravine
frozen patio
rotund creek
#

Pretty simple

sick birch
lofty pecan
#

yeah lmao

#

So I'm just making my own project to learn new stuff

rotund creek
#

Im tryna also make people websites for money

lofty pecan
#

and well discord bot was a very cool experience

boreal ravine
sick birch
#

If you want to, you can buy yourself a raspberry pi and host it yourself

rotund creek
#

Discord bots are coool

sick birch
#

Electricity and internet bills are basically nonexistent

sick birch
lofty pecan
#

Ho that's nice

sick birch
lofty pecan
sick birch
#

Well I did. Before I got an AWS instance

#

Now I just run it on there

rotund creek
lofty pecan
#

Internet bill isn't an issue If i'm on wifi lol

sick birch
lofty pecan
rotund creek
#

I could also make websites with flutter

cloud dawn
#

If I were needed to compute a lot something like pillow but with a web request that needs to return a lot of data and filtering using regex and sync bs4. Is it best to make an API for that and just have it run trough aiohttp with my bot?

sick birch
normal lark
#

hi can u help me for this I installed pip install discord-py-slash-command and py -3 -m pip install -U discord-py-slash-command

cloud dawn
sick birch
rotund creek
#

I need to make a extra few bucks for my friend

sick birch
#

No prob