#discord-bots
1 messages · Page 682 of 1
writing a novel maybe?
yes
!pypi hikari
ohhh
m-m-m-m-m-m-m-m-m-m-m-m--m-m-m-m-m--m-m-m-m-m-m-m-maybe
why discord creator replace all API tho
not replace, update
but oppositing dpy thing, why
nice, (maybe) she's not done yet
not opposing, the updates may break dpy, thats why
nah, "why"
because of the way its written and the way the API changes
!pypi nextcord
A Python wrapper for the Discord API forked from discord.py
then why update it lol
r u advertising or what
why not
!pypi discord
A mirror package for discord.py. Please install that instead.
I'm not the owner/contributer of that package 🤷
Why would I ?
Once upon a time, lives a human named "Danny". He actually do work as a doctor in a hospital in Japan. He also made an API wrapper of Discord with python as a hobby. It's a big repo with 9k+ starts. But one day, he got pressured & hate so much by the community. Saying probably like "dpy is so slow on development" most of the times. But actually it's fine as all of the Devs does that as hobby and in free times. But finally the Devs decide to quit and yeah Danny also got frustated by the hate and decided to quit the development and archived the repo. Probably 99% of the community are mad at him but imo (and their opinion (the Devs)) it's not worth it. So yeah, now the library is fully undeveloped anymore and will may be unsupported in the near future. The end.
~ Based on real story
disnake >
~~
Essay~~
fail
if the way an update just break old system that gud, THAT'S LITTERALY WINDOWS 10 UPDATE WAY
More like a short story
novel be like:
He actually do work as a doctor in a hospital in Japan?
_sup @boreal ravine _
how do I change the cog_check error
yeah
danny is japanese? or is he just living there
sup
secret feature: import python-covid19
he is japanese
hmm give proof
click the github for proof
If I want to do advertising
Then I would send my own package here lol
If you want proof read about me in my profile
any code where we can give a hyper link in an embed where the link is of an announcement channel and wen the user clicks it kinda follows the channel....if ukwim
what? isn't it how ,url=... work? (in title)
Ya
embed=discord.Embed(title="sup announcement", url="url", description="", color=0xFF5733)
I'll be the owner of my package na 😂
like uhh...if i click it prompts me to follow it to a channel...more or less a "Bot-status" channel without askin evry single user to join the server for following
this ik...
hmm, who's saikerthaan smth then
wut tha hell u want :l
I'm sai keerthan bro
See who's the owner/ maintainer of nextcord
welcoming i'd say....welp nvm m high today
skrphenix? who
A
Me only
oh u have pypi and github profile?
Yes
ooof
ou ok ok ||noice||
hm..
help #2
how many discord friends u hav xd
ok
sup :3
show code
Maybe 5 - 10 as friends and others in random servers
full traceback
does they know that u r the developer of pycord-btns-menus
then how the hell u just have 10 friends?? (no pending friend req?)
You are getting an error in database file in add() func
I'll either reject or accept requests as they come
I think it should be commands.CommandNotFound
At present I have 12 pending requests
it means nothing though
!ot
Off-topic channels
There are three off-topic channels:
• #ot2-never-nester’s-nightmare
• #ot1-perplexing-regexing
• #ot0-psvm’s-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
👍
what
you should have a commands. before it I think
See traceback carefully bro, the error is related to database file not in main.py or anything
Guys how can I assign NULL to a sqlite3 column with a query?
UPDATE TABLE_NAME SET COULMN_NAME = NULL WHERE CONDITION
Guys, is it possible to make multiple nested commands group inside a command group in a Cog?
Like : Command Cog -> Commands Group -> Commands Group -> Commands
how do i make my bot re-invoke a command
yes
@commands.group()
async def do(self, ctx):
...
@do.group()
async def this(self, ctx):
...
@this.group()
async def lol(self, ctx):
...
``` `!do this lol`
!d discord.ext.commands.Command.invoke
No documentation found for the requested symbol.
🤦 im high today ig
o
then what's wrong
oh , so you can basically Context.command.invoke() ;)
https://docs.disnake.dev/en/latest/ext/commands/api.html?highlight=command invoke#disnake.ext.commands.Context.invoke why is invoke in the context class
o
Command.invoke is used for the internals
hm
nah what's wrong ;-;
helo?
you're inserting something that isn't supported by sqlite3
what is it
we need your code
uh it's there with the error screenshot...?
z
the code where you call the function
str() it
hmm
str(ctx.author) -> "name#0000"
btw what is the code for create table if not exist?
CREATE TABLE IF NOT EXISTS tablename (...)
ow ok, thanks
How do I make my bot make another embed if the index was over 10? (a paginator)
!d discord-ext-menus
# Use like this
conn.execute(f"INSERT INTO users_data (NAME, COIN, EXP, MAX_EXP) VALUES ('{name}', 25, 0, 125)")
Try this @small igloo
me thought f-strings bad in sql
hmm
But it's fine if you use it with if-conditions
~~
Same thing tho~~
Maintainence is important
What happen if i pass a variable with None value into a query like that one?
Do not use f strings for sql queries.
They are
IK, but let's check if he's getting the same error or not
.
I'm getting this error even though I already have intents
It'll not work obviously
That's not caused by intents
show code
so how can i add NULL value? i have to check every value I add first and if they are none give NULL to the query?
i think target had a value of None, or defined
most likely had a value of None
send the parent where it errored
You don't need any intents for that code, just as side note.
I given the code, to check whether all the code and database is working or not
It's not for full usage
past the error too
it's above
read the error 
Bro that line is the discord.py package
how to give default value to arguments...lets say i want to have 3 arguments from the command
that's inside the discord.py
No bro, give the full error

i can't check every line of your code D_D
oops wait
def func(arg1, arg2, arg3 = "default"):
# Do something here ...
abc(ctx,one=None,two = None)
yeah i'm checking
not sure how to show the full error on a vps
tracebacks starts with "Traceback (most recent call last)"
it will default value if not specified ?
!traceback
Please provide the full traceback for your exception in order to help us identify your issue.
A full traceback could look like:
Traceback (most recent call last):
File "tiny", line 3, in
do_something()
File "tiny", line 2, in do_something
a = 6 / b
ZeroDivisionError: division by zero
The best way to read your traceback is bottom to top.
• Identify the exception raised (in this case ZeroDivisionError)
• Make note of the line number (in this case 2), and navigate there in your program.
• Try to understand why the error occurred (in this case because b is 0).
To read more about exceptions and errors, please refer to the PyDis Wiki or the official Python tutorial.
Ya
so-
show the full error
how-
we need the entire traceback
ok thanks
how am i supposed to show it in a vps
idk tbh , try running the code locally or find a way to show the full error
Np
are you using pm2 ?
yeah
WHY ARE YOU DEVELOPING INTO A VPS LOL
cause I have multiple bots running in it
what else am i supposed to use, a free server that uses shared IPs??
pm2 logs -err
no, usually it is better to develop in local D_D
well most likely you should develop it first on your device and when everything is working fine i upload it to the vps
exactly
pm2 logs -err botname
or something like that
logs only show the last 15 messages wither its an error or not
@wide tartan seems that ctx.guild is None. Do you invoke the command on dms?
no
Look, i know what the error is, but without knowing the line i can't tell where it raise D_D
Essentially you are passing a nonetype value and using it like a Guild, Channel or User object
@wide tartan can you print role?
hm ok
its the one that's None
what did i missed
give me a sec
not ctx.guild apparently
Is it able that the bot gets the user banner? Same as a avatar command but just as banner
@placid skiff
alr, will do
afaik if you add one as None every arg after is None
sup
!e
def foo(a = None, b): ...
foo()
```nah
@visual island :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | def foo(a = None, b): ...
003 | ^
004 | SyntaxError: non-default argument follows default argument
mhmm
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
idk if this is work or no, but it seems like it is, thamks
their was something that made all arg after it None i dont quite remember
hi
i think it was with kwargs i dont remember
Probably is something that u pass in the overwrites
*args?
Not probably, is it something in the overwrites
nah nah that just makes arg and unknown amount of args
@visual island it returns none
yea
overwrites (Dict[Union[Role, Member], PermissionOverwrite]) – A dict of target (either a role or a member) to PermissionOverwrite to apply upon creation of a channel. Useful for creating secret channels.
@wide tartan
yeah, probably the role doesn't exists
can you try with the ID instead?
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
how do I add 2 buttons in a discord message
@bot.command()
async def donate(ctx):
await ctx.send("doante below", components=[Button(style=ButtonStyle.URL, label="Steam", url="utl")])
interaction = await bot.wait_for(
"button_click", check=lambda inter: inter.custom_id == "button1"
)
await interaction.send(content="Button Clicked")```
put 2 Button in the components list?
yes
Alright it works, ty
What's your using package ?
yup, nice 
yea, just make one more Button to the list
you mean library?
ya, discord.py or pycord
discord.py and discord_components
oh ok
is this will work?
def add_coin(name, amount):
conn.execute(f"UPDATE users_data set coin = coin + {amount} where NAME = {name}")
It'll work bro, but don't use f-strings in sql queries
Use them for testing purposes only
wait what :) u told me to use that
why?
For testing I told
where are you hosting your discord bot?
also what's the long for "f" in f-string lol
format
pycharm E replit sucks
ow ok
f strings are used for injections right?
then i must use what :l
after it gets public? or done with testing
wym?
f-strings are bad with sql databases
f strings are vulnerable to injections
then i must use waht ;-; not use f string = error code
forever you will host on pycharm while your laptop/pc is on for 24x7?
why is that so?
ig..?
ohh okay
:v
just asking
ok
There was this funny comic that explained this perfectly
sup @sick birch
hmm, lemme see
show?
i remember reading it
lol
.execute(f"SELECT bla FROM bla WHERE {a}") lets say a is a param from a command. And let's say the value is "true; DROP TABLE bla" and the table will be deleted
python has explanation to not use f-strings with sql databases i forgot what command it was
!tag injections
maybe bcuz i'm a newbie i don't understand it, imma save it for later when i already mastered SQL database...
nah
.bm
whats ALTER?
bhre typing so fast will cause that, lemme fix
wait, where ALTER
Alters a table
i am asking what is ALTER and what does it do?
bhre i'm a newbie in SQL, u think i will know E
you guys cant Find walter?
It lets you alter tables. An example would be adding an entirely new column to a table
you just said "i masterd sql" and so-called
The ALTER TABLE query is used to add, delete, or modify columns in an existing table
correct
imma save it for "later" when i already mastered it E
Is it able that the bot gets the user banner? Same as a avatar command but just as banner
!d discord.Member.banner
property banner```
Equivalent to [`User.banner`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.banner "discord.User.banner")
thanjs
wow it's exist
How can I make a change prefix command?
ty
in 2.0 yes
:stackoverflow: oh there's no emoji
huh


Very informative answer, ngl, ty
# Try this
conn.execute("INSERT INTO users_data (NAME, COIN, EXP, MAX_EXP) VALUES ('?', 25, 0, 125)", (name,))
Try this @small igloo
ok, back to the f-string, can give explanation why it's not recommended
also where "name" from def add(name): oh it;s there, nvm
is it for a guild or overall?
not understand :l

# Try this
conn.execute("INSERT INTO users_data (NAME, COIN, EXP, MAX_EXP) VALUES ('?', 25, 0, 125)", (str(name),))
what is yert xd
pls work ;-;
online 3D game in discord >:3 with ASCII characters
not very suited for my bot lol
1 fps?
working or not ?
seems like enough
Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Users\thosiba\Downloads\d-bots\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\thosiba\PycharmProjects\main.py\main.py", line 11, in start
database.add(str(name))
File "C:\Users\thosiba\PycharmProjects\main.py\database.py", line 11, in add
conn.execute("INSERT INTO users_data (NAME, COIN, EXP, MAX_EXP) VALUES ('?', 25, 0, 125)", (str(name),))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\thosiba\Downloads\d-bots\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\thosiba\PycharmProjects\main.py\main.py", line 21, in on_command_error
raise error
File "C:\Users\thosiba\Downloads\d-bots\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\thosiba\Downloads\d-bots\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\thosiba\Downloads\d-bots\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: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.

? Shouldn't be quoted
what is it about E
?
yea ?
multifunctional
Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Users\thosiba\Downloads\d-bots\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\thosiba\PycharmProjects\main.py\main.py", line 11, in start
database.add(str(name))
File "C:\Users\thosiba\PycharmProjects\main.py\database.py", line 11, in add
conn.execute("INSERT INTO users_data (NAME, COIN, EXP, MAX_EXP) VALUES ('?', 25, 0, 125)", (str(name),))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\thosiba\Downloads\d-bots\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\thosiba\PycharmProjects\main.py\main.py", line 21, in on_command_error
raise error
File "C:\Users\thosiba\Downloads\d-bots\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\thosiba\Downloads\d-bots\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\thosiba\Downloads\d-bots\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: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.

then use it lol, it's for game fuction
Remove quotes and try
:l what quote
nahhhh
''
try to understand what the actual error is
you pasted the entire tracebook usually the line which is causing error and why is in the traceback
# try this
name = str(name)
conn.execute("INSERT INTO users_data (NAME, COIN, EXP, MAX_EXP) VALUES (?, 25, 0, 125)", (name,))
dis " or '
supply smth
yes so copy that and paste that only
C: it seems like work, tamks
pycharm not scroll when select
np
funny emoji, check
you can just str(name) in the conn.execute()
await ctx.send("Arigato-Gozaimashita For Using This Command\nWe Currently Accept Donations Down Below", components=[Button(style=ButtonStyle.URL, label="Steam", url="url2",), Button(style=ButtonStyle.URL, label='Paypal', url='url`')])
interaction = await bot.wait_for(
"button_click", check=lambda inter: inter.custom_id == "button1" "button2"
)
await interaction.send(content="Button Clicked")```
the buttons are horizontol how do I make them vertical?
command ideas?🧍♂️
what?
badword detected!!! banned 3 days
Ya, for better understanding declaring earlier is also fine
teleport to another universes, can u do this C:
no
._.
safe public eval
uhm, now can someone explain how to use select?
i cant even do a private eval smh
then try to do that C:
to many modules for it
SELECT col, col2, ... FROM table the most basic use
import *
stole one
waht
pep8 is screaming rn
await ctx.send(eval(code)) :>
wont work lmfao
wont it?
all results go to terminal and with a exception it does but results never get shown
cursor = conn.execute("SELECT name, coin, exp, max_exp from USERS_DATA")
i just know this, and how to take spesific value like from coins or exp
try to guess my gender from all of my messages
SELECT coin, exp FROM USERS_DATA?
skeleton
based on your pfp: male
oh, this?
coin = conn.execute("SELECT coin from USER_DATA")
exp = conn.execute("SELECT exp from USER_DATA")
im just gonna learn sql bye now
breh that's sans, not me
lol
lol ok
why u still here
why so many questions
is this will work?
you'll learn it in 5 mins for sure
idk, i'm a kid with so many questions in mah head
pretty easy im liking it
im a kid to lol
then why i still struggle even i alr learn it in 1.5 hours ;-;
you need to fetch it
either fetchall() or fetchone()
what
how to use?
!d sqlite3.Cursor.fetchall
fetchall()```
Fetches all (remaining) rows of a query result, returning a list. Note that the cursor’s arraysize attribute can affect the performance of this operation. An empty list is returned when no rows are available.
why does everyone assume because you know python that your old lmfao😭
coin = fetchall(conn.execute("SELECT coin from USER_DATA"))
...?
no
you're or your
the what
🧍♂️
conn.execute(...)
result = conn.fetchall()
the code
bye now
and come back after 1 sec
conn.execute("SELECT coin from USER_DATA")
coin = coin.fetchall()
I’ve been doing Python for almost 2 years know and I still feel quite stupid, it just takes time
conn.fetchall()
u off, and u suddenly on, perfect
not coin
oh right xd
conn.execute("SELECT coin from USER_DATA")
coin = conn.fetchall()
do u know 'em IRL
Slow and Study wins the race
no
o ok
experience plays vital role
tech and smort wins the race-
try it
😅
one more check, is this right?
def check_coin(name):
name = str(name)
conn.execute("SELECT coin from USER_DATA where NAME = ?" (name,))
coin = conn.fetchall()
return coin
:D ok, thanks
Anyone here good with asyncio tasks
this code creates this error, why
def check_coin(name):
name = str(name)
conn.execute("SELECT coin from USER_DATA where NAME = ?" (name,))
coin = conn.fetchall()
return coin
no no, not me
but for docs, here https://docs.python.org/3/library/asyncio-task.html
you don't have to do str(name)
what? (btw sup)
it's alrd a string afaik
name is a discord.Member/User object
eh.. then how to do
they need to do that
oh I did not know that
xd ok
can you show the full traceback
AE then why str object not callable
use a different arg/var name
can you show your full code and the error you get ( my internet's kinda weak so i cant slide up)
@bot.command()
async def clone(ctx, role : disnake.Role):
new_role = await ctx.guild.create_role(name="Altmute")
for channel in ctx.guild.channels:
overwrites = channel.overwrites_for(role)
await channel.set_permissions(new_role, overwrites=overwrites)```
this raises `it says invalid permission given to the keyword now`
hmm, ok
full code here, wait
import sqlite3
conn = sqlite3.connect('database.db')
conn.execute('''CREATE TABLE IF NOT EXISTS users_data
(
NAME TEXT NOT NULL,
COIN INT NOT NULL,
EXP INT NOT NULL,
MAX_EXP INT NOT NULL
);''')
def add(name):
name = str(name)
conn.execute("INSERT INTO users_data (NAME, COIN, EXP, MAX_EXP) VALUES (?, 25, 0, 125)", (name,))
def add_coin(name, amount):
conn.execute("UPDATE users_data set coin = coin + ? where NAME = ?", (amount, name))
def check_coin(user):
user = str(user)
conn.execute("SELECT coin from USER_DATA where NAME = ?" (user,))
coin = conn.fetchall()
return coin
and also it shows this
ooooh ok ok, ig i know it
for channel in ctx.guild.channels:
perms = channel.permissions_for(role)
await channel.set_permissions(new_role, perms)``` try this
you have to pass permissionsoverwrites?
ok, what is it
!d discord.TextChannel.set_permissions
await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sets the channel specific permission overwrites for a target in the channel.
The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that belongs to guild.
The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.
If the `overwrite` parameter is `None`, then the permission overwrites are deleted.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this...
anti_add = 'on'
@client.event
async def on_message(message):
global anti_add
if ".link" in message.content.lower():
if anti_add == 'on':
await message.delete()
await message.channel.send("Απαγορεύετε να στέλνετε λίνκς!")
await client.process_commands(message)
``` hey how can i add more links.. like .com?
connection object has no fetchall
let me find my sql things
eh... so any alternative?
you should do cur = conn.cursor() in the top
then change to cur.fetchall()
same error
or cause if you want to hardcore it
where to put or
its overwrite kwargs, not with an s
if statement1 or statement2
def check_coin(user):
user = str(user)
conn.execute("SELECT coin from USERS_DATA where NAME = ?", (user,))
cur = conn.cursor()
coin = cur.fetchall()
return coin
um yea you can do that. But that's not what I meant
Invalid overwrite type provided. is now raised
so what u mean
did you use overwrites_for or permissions_for
can you show the current code and the full traceback
!d discord.TextChannel.overwrites_for
overwrites_for(obj)```
Returns the channel-specific overwrites for a member or a role.
i'm supposed to be using overwrites for right?
yeah
.... what do u meant
ok worked but now it keeps deleting the answer and pastes it again
hi
Try this ```py
rows = await db.execute("YOUR STATEMENTS HERE")
data = await rows.fetchall()
hi
db = connection object
Hello
define cur below the line that you define conn
uh waht
it must be the cursor....
wdym?
hi how ARE you?
ow ok
I just said what that variable meant in my case
Ok
he's using sqlite, it isnt async
await?
ah
byeeeeeeeeeeeeeeeeeeeeeee
btw it finnaly can send this, but why the coin empty, and from my observation, it's a list...?
I used async version of SQLite, aiosqlite
@visual islandcan you tell me pls
where can i spam?
BYEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
no where, you don't spam
^ @small igloo
😦
seems that the result is empty so it returns an empty list
i want to spammmmmmmmmmmm
please don't do that here
ok...k
#ot0-psvm’s-eternal-disapproval but still you can't spam
:l what, wait, i can turn it imto a variable right, ok nvm that, but why empty
ur own server...?
is there a tutorial on discord-ext-menus
put 30 emojis in 1 msg
cause there's nothing on the db maybe?
btw discord hav chill mode lol
no, the best you can have is examples
it should be cur.execute tho not conn.execute
o thanks
there was a tutorial I had used but I don't think I remember it, let me see my history
i cant
yea and get muted
ok worked but now it keeps deleting the answer and pastes it again
must have 25 there
lul
u wont understand
"pastes it again"?
i can put 100 of them...?
@small igloo
if i don't spam i will always get irritated
about?
yeah the answer when it deletes the msg
Don't spam here, easy
!d sqlite3.Connection.execute
ow ok, wait, wait what?
execute(sql[, parameters])```
This is a nonstandard shortcut that creates a cursor object by calling the [`cursor()`](https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.cursor "sqlite3.Connection.cursor") method, calls the cursor’s [`execute()`](https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.execute "sqlite3.Cursor.execute") method with the *parameters* given, and returns the cursor.
spamming
try it
hmm, should work eitherway
why does it matter tho?
bruh maybe i will get muted, no
nah, my mistake
jhmf
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
ya sure
thank
@small igloo have you commited the INSERT INTO statement?
so ? @visual island
wait wym?
!rtfm
.rtfm
can you show your updated code?
conn.commit() at the INSERT INTO statement
ok, now u started spamming IN DISCORD BOT, go to #ot2-never-nester’s-nightmare breh
invis msg
u said cur.commit()...?
huh?
anti_add = 'on'
@client.event
async def on_message(message):
global anti_add
if ".link" or 'discord.gg' or '.com' or 'xyz' or 'www.' or 'www' in message.content.lower():
if anti_add == 'on':
await message.delete()
await message.channel.send("dont spam links!")
await client.process_commands(message)
can you not...
eh wait, cur.execute()
yea
??
below it put conn.commit()
!or
When checking if something is equal to one thing or another, you might think that this is possible:
if favorite_fruit == 'grapefruit' or 'lemon':
print("That's a weird favorite fruit to have.")
While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.
So, if you want to check if something is equal to one thing or another, there are two common ways:
# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
print("That's a weird favorite fruit to have.")
# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
print("That's a weird favorite fruit to have.")
~can i not what?~
can you not spam here
below what E
ok
at least go to off topic ;-;
~i know html5~
below <cur/conn>.execute()
hi
huh just put conn.commit()?
no, this is PYTHON
@barren oxide #ot0-psvm’s-eternal-disapproval
hmm, all of them?
no, thats for another guy
for me
read this embed
im an idiot
i know
when i opened the channel for a sec i thought im in #databases
lol
uh for me?
no
tell me what to do please cause a lot of spam here
bruh this is getting confusing
@slate swan
just ping me when reply
btw imma sleep, gn all
@small igloo
😥
con.close() used or no
the one which needs to be commited (saved) such as UPDATE, INSERT INTO, ALTER TABLE ..., etc
mm ok, thanks
you dont need it
ok :3 thanks, and gn
gn 👋
I'll also sleep in a sec, gn
finally the spam is gone
yeah just ignore things like that and they will eventually leave
I just press the block most of time
I made a temp mute command once and now the whole thing is broken down (database broke)
is there a method to get a cog by name?
and unload it after
get_cog(name)```
Gets the cog instance requested.
If the cog is not found, `None` is returned instead.
in <string>' requires string as left operand, not tuple py anti_add = 'on' @client.event async def on_message(message): global anti_add if ('www','https','.com','link','xyz','www.','.link','.gr') in message.content.lower(): if anti_add == 'on': await message.delete() await message.channel.send("dont spam links!") await client.process_commands(message) @visual island
if message content in tuple
your saying if tuple in message content
its like doing py if [python discord\'s members] in Mr.Katsaa:
no they want to see if a string in the content
aha thx!
you can either use any with comprehension or multiple or statements
if list in "str":
is what your doing
any() is the best
what does this error mean and how can i fix it?
@client.command()
async def buy(ctx, itemm):
await register(ctx.author)
users = await get_bank_data()
bal = users[str(ctx.author.id)]["balance"]
for i in range(len(shopp)):
if itemm.lower() in shop[i]:
item = shop[i]
break
shop is a command
you have a command named users , or shop
oh users is defined , so its shop
and indentation isnt correct
its correct , but too less spaces used
it is correct isn't it
so like this py anti_add = 'on' @client.event async def on_message(message): global anti_add if message.content.lower in ('www','https','.com','link','xyz','www.','.link','.gr')(): if anti_add == 'on': await message.delete() await message.channel.send("dont spam links!") await client.process_commands(message)
?
i think its how i pasted it
why is it itemm instead of item are you doing some global shit
how does one add the commands of a discord bot into the / commands
just do message content no need for lower
wait lemme take a look
well slash command is not a think in og discord.py you gotta use some forks
!PEP 8
oh what really?
it aint
i dont think its following
yep
yea the library is no longer maintaned
bruh
I have a question
tuple' object is not callable
!pypi disnake is what i'd suggest or other forks like nextcord / pycord etc
thats acc really sad i didnt know that
you cant call the tuple
uhh what can i do
if message.content in ('www','https','.com','link','xyz','www.','.link','.gr'):
in a command if i use py await asyncio.sleep(10) will it wait 10 seconds but still asynchrnously run the command?
ill take a look at it ty for telling me
correct
nice! So i could mute a user for 15 minutes, and mute another user meanwhile!
not quite
as when the command is invoked the time restarts
youll need a db to store the time
not really
okay
no, it will create a different object
wait im confused
a different task
explain?
mb
damn thats acc really painful, hes the sole reason why im good in python in the first place
it will call the function every time someone invokes the command
rip
the other function's session will still be running
so i don't need to store the time i a dt base?
nice so no dtbase, much easier
then how?
but , if your bot restarts , it wont continue with the function's older session.
thats why you need a db
python handles all that, it will wait 15 minutes then remove it but meanwhile the script will be running fine
obvi, but will it create a new session for the async command if the bot doesn't restart?
you can call the function again
yes but as sarthak said it isnt a great way
yea sure
k, because this is just a small project anyway
imagine the person getting muted and never unmuted xd
yea it isn't, just tryna correct what you said
xd
i suppose hes trying to make a func that will add a role sleep with asyncio and then remove it
how you know?
because its just 15 minutes
sussy baka, anyway thnx!
Your welcome lol
is pycord one of the best maintained forks of discord.py?
yes
ig you can say that
wouldnt say best but it is a good fork
disnake is great
oh alrighty
!pypi disnake
has buttons and slash command and same syntax
what are the benefits of disnake/pycord vs discord.py?
slash commands
np
slash commands and maybe faster implementation of new stuff if using disnake
oh
is discord.py and disnake very similar, because i don't want to rewrite 1010 lines of code.
change the imports, you're good to go
nice
just change discord to disnake
its pretty easy
k
and most ides have a find and replace which makes it easier
even notepad
or just import disnake as discord lol
epic moment
await ctx.send("A", components=[Button(style=ButtonStyle.URL, label="Steam", url="url1",), Button(style=ButtonStyle.URL, label='Paypal', url='url2')])
interaction = await bot.wait_for(
"button_click", check=lambda inter: inter.custom_id == "button1" "button2"
)
await interaction.send(content="Button Clicked")```
the buttons are horizontol how do I make it vertical?
unlimited big brain
afaik you cant
not sure if you can do that without having 5 buttons on each row though
also what lib are you using
just a sm0L doubt , is disnake's old method of making slash command deprecated ? or both new and old methods work
discord components
action rows
idk then, use some forks (discord.py 2.0.x will have everything except slash cmds)
far from it
disnake however, yes
what's the best discord.py fork i could alternatively?
disnake
disnake
yeah im looking at disnake its looking great
nice im doing that then
not pycord?
no
whys that?
the only thing pycord does better than disnake is the advertising, all they got is popularity and shit code
lmao
kraots always on the go :^)
take a chill pill xD
i am chill wdym 👁️
i heard they use converters to even typehint args as int, is that true
never used pycord , so cant say
Im trying to do thanks system:
thanks = await self.db.execute("SELECT thanks FROM thxcounter WHERE user_id = ?", (member.id,))
await self.db.execute("INSERT INTO thxcounter (thanks, user_id, guild_id) VALUES (?, ?, ?)", (thanks + 1, ctx.member.id, ctx.guild.id))
Its giving me this error:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: unsupported operand type(s) for +: 'Cursor' and 'int'
Well one shit thing with pycord is that you cant have multiple of the same named cogs at the same time
discord.py was an api wrapper of the entire discord api
commands is just a command handler for bots it should have remained as an extension
😂
thanks is your Cursor object , and you cant add 1 to it
So how i can add one?
you can add ints only with ints
Hello guy how are you ?
I'm learning to develop discord bot in python but I wonder
how Can I make the bot handle multiple servers ?
Example?
use some api wrapper for the discord api
they handle all the sharding
Select statements need to be ferched
How do i ferched the statementa
can anyone tell how to fix dat
!d discord.Guild.kick
await kick(user, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Kicks a user from the guild.
The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`kick_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.kick_members "discord.Permissions.kick_members") permission to do this.
not discord.ext.commands.Bot.kick
member.kick
i want to create a text channel only for one user, like only one guy will see this channel. how to do this? will be very greatful!
self.cursor.fetchall() replace self.cursor with the cursor object
hmm what do you mean ?
or fetchone
elaborate
...
use discord.py but if you're looking for slash command implementation, use forks of it, disnake as an example
looking at r. danny's source code, what type of object is rows?
your trying to kick a member which you have a arg as a member obj so use it
ok so it's not possible to handle multiple discord server with discord.py ?
Pycord has advertising?
the definition is above the marking, check what db.fetch returns
I mean, my problem is , if an admin want to modify the prefix of the bot
¯\_(ツ)_/¯
ok-
How would I? ok
Hey myxi
I dont want it modify for ALL servers
well you make a command for it
yes, they did the marketing better which got them more popularity, they aren't popular because of their code, they're just popular because of that yt guy
Hi carrot
wait the end haha
if people were to actually choose based on code, pycord would be at rock bottom
I never seen people advertising packages
I want the bot be able to have different "setting" on different server
Do you use disnake 🤔
github has some feature, hold the ctrl key then click on it, then it should pop the source code to that if its type hinted properly
yes
Ok
otherwise clone it locally and use your ide's features
Wtf is that profile
maybe on 1 server the admin want the bot to write in a B channel , but not on another
?
:/
there probably isnt
another way would be to just replace github.com to github.dev, it will open the thing in web version of vscode
where you could like hold the ctrl key and click on the name and see what it returns
it basically is trained with lots of code from stack overflow and stuff idk much about it tho
also not the right channel
So, when i try to log a message on the console it can't log dm's okay so i added a try/excepts blocks to and the except block contains a lot of errors, and the attributeerror but it still raises an attribute error because the dm guild has no id, so it raised an error instead of printing out 'log error', why?!
It doesn't log "log error" instead it raises an error, it just doesn't work
It doesn't pose a big threat, it's just weird
does printing to console slows down the bot ?
like when two people use commands same moment
no
the console can only print one command output
there aren't enough ppl in my server lol
or checks if the first value is None, use tuple
printing something is like the lightest shit to do in python
except (exc1, exc2):```
no, it just raises an attribute error when the except block should be stopping it from raising an attribute error
That's the problem
the problem is you're not supposed to use or keyword there
TypeError: can only concatenate list (not "int") to list
what u think
!e print(None or "it should print this")
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
it should print this
thats the job of or
if 100 people use command same time
use tuple.
like that.
console cant print all
it must wait
i am saying because i noticed my bot pausing to print the commands ran simulatenosly
okay got it i think
any falsy value, not just None
my bad
False or None basically
!e print(False or None or "its gonna print this")
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
its gonna print this
!e
print("a string is truthy.", bool("str"))
print("however an empty one isnt.", bool(""))
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
001 | a string is truthy. True
002 | however an empty one isnt. False
@sullen shoal can u help me?
with?
New code:
thank = await self.db.execute("SELECT thanks FROM thxcounter WHERE user_id = ?", (member.id,))
thanks = await thank.fetchall()
await self.db.execute("INSERT INTO thxcounter (thanks, user_id, guild_id) VALUES (?, ?, ?)", (thanks + 1, ctx.member.id, ctx.guild.id))
Error: TypeError: can only concatenate list (not "int") to list
which line is the error from, whats the content of it
the line number is included in the traceback
This:
await self.db.execute("INSERT INTO thxcounter (thanks, user_id, guild_id) VALUES (?, ?, ?)", (thanks + 1, ctx.member.id, ctx.guild.id))
TypeError: can only concatenate list (not "int") to list
looks like thanks is a list?
can anybody give me command ideas im kinda bored
done with learning sql yet lol?
How bruh
class type(object)``````py
class type(name, bases, dict, **kwds)```
With one argument, return the type of an *object*. The return value is a type object and generally the same object as returned by [`object.__class__`](https://docs.python.org/3/library/stdtypes.html#instance.__class__ "instance.__class__").
The [`isinstance()`](https://docs.python.org/3/library/functions.html#isinstance "isinstance") built-in function is recommended for testing the type of an object, because it takes subclasses into account.
wdym?
not really i just found some parts complicated so i stopped so i can take it in i just work like that
i like learning things slowly
there it is, you cant basically add int with a list
if you go for learning basic sql first , and then a library like sqlite or mysql , it would be lotta easier
thats what im doing lmfao
!e
[] + 1
@sullen shoal :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | TypeError: can only concatenate list (not "int") to list
im learning sqls syntax so i can go to sqlite3 and then jump to postgresql
Make a command that asks the user about their biodata and deploy the data on the dark web
How to fix?
lmao
aha cool then!
slice the list to the item you need
yep
What i need to change in the code?
excuse me?
idk thats your project not mine, you gotta use your thinking for that
excused
the erroring code
!e
l = [1,2,3,4,5]
print(l[2])
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
3
2 is the index, not to be confused
No way
@slate swan im learning from sqlbolt and when i learn parts and find it a bit complicated i stop so i can understand it and then i start from the start and work my way more then the time before
At Least someone here is humorous
pretty good
oh is that some tutorial or something?
i learned sql in my school lol
yeah its a tutorial and exercises for sql
🗿
lol here it is -> https://sqlbolt.com/
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
i want to make a command and it should be "when bot has logined, bot will send message to where i want"
k
on_ready?
uh
use on_ready event ,
Bot.get_channel to get the channel and use .send
It’s really simple
!d discord.on_ready
discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.
Warning
This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
smh
The whole thing is 3 lines of code
!d discord.ext.commands.Bot.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
can make it less
Doubt
i think
i know it but idk how can i set channel with id idk
semicolon supremacy
The decorator and function declarator is 2
since 1 has to be the decorator surely
exec
@bot.event
async def on_ready():
a = await bot.get_channel(int).send("msg")
what i would do
no even need for a var
2
@Cog.listener('on_ready')
async def send_message(self) : await self.bot.get_channel().send('blah')```ez
@maiden fable wont work mr
!e
def func(f): f()
exec("@func\ndef f():print('hello')")
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
hello
hehe
good one
ik that is why I deleted my message (:
LMFAO await was for .send because get is async
@bot.event
async def on_ready(): return await bot.fetch_channel(int).send("msg")
yea saw it later
lol
won't work tbh (or it will? probably not)
it will
it will
@client.command()
async def buy(ctx, itemm):
await register(ctx.author)
users = await get_bank_data()
bal = users[str(ctx.author.id)]["balance"]
item = {}
for i in range(len(shopp)):
if itemm.lower() in shopp[i]:
item = shopp[i]
break
name = item["name"]```
why?


