#discord-bots
1 messages ยท Page 859 of 1
the question is whether the better one is seximal or dozenal
base 1 ๐ฟ
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Pages' object is not iterable
anyone know what this error means?
pages is not an iterable object
how do i resolve it?
!e ```py
[0xfor _ in range(10)]
@pliant gulch :warning: Your eval job has completed with return code 0.
[No output]
you dont iterate through such an object
How do I fix?
Error Below
[92mBot is online!
172.18.0.1 - - [25/Feb/2022 20:16:55] "GET / HTTP/1.1" 200 -
Ignoring exception in on_message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 202, in on_message
bans = json.load(f)
File "/usr/lib/python3.8/json/init.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 45 (char 44)
172.18.0.1 - - [25/Feb/2022 20:16:56] "GET / HTTP/1.1" 200 -
172.18.0.1 - - [25/Feb/2022 20:16:57] "GET / HTTP/1.1" 200 -
Code Below
@client.command()
@commands.check(check_Dev)
async def banlist(ctx):
with open('bans.json','r') as f:
users_list= json.load(f) #ahh i see
text="**All Banned Users Record**\n"
for i in users_list:
text+= "<{}\n>".format(i)
em = discord.Embed(color=discord.Color.red(),description=text)
await ctx.send(embed=em)
uh
i dont knoww what that means
!e
print([a for a in str])
@slate swan :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: 'type' object is not iterable
damn
?
now my bot wont even work
!e
@client.command()
@commands.check(check_Dev)
async def banlist(ctx):
with open('bans.json','r') as f:
users_list= json.load(f) #ahh i see
text="**All Banned Users Record**\n"
for i in users_list:
text+= "<{}>\n".format(i)
em = discord.Embed(color=discord.Color.red(),description=text)
await ctx.send(embed=em)
@neat pagoda :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'client' is not defined
ok
the eval command cant eval dpy code
ok
!e
@bot.command()
async def accept(ctx, *args):
if (ctx.message.author.id == 809386625699151892):
if not args:
await ctx.send("Username is missing!")
else:
requests = await client.get_friend_requests()
for request in requests:
if request.id == args[0]:
await client.accept()
await ctx.send("Friend request was accepted!")
else: await ctx.send("Only foxx can use this command.", ephemeral=True)```
butwhat's wrong
with my code
what??
seems like theyres a char that couldnt get decoded
idk
Oh I was saying that the eval resulted in a error
I tried editing what my guy discu did while I ate lunch, got it working, and then I screwed up and now the original code he put doesn't work
!e
@bot.command()
async def accept(ctx, *args):
if (ctx.message.author.id == 809386625699151892):
if not args:
await ctx.send("Username is missing!")
else:
requests = await client.get_friend_requests()
for request in requests:
if request.id == args[0]:
await client.accept()
await ctx.send("Friend request was accepted!")
else: await ctx.send("Only foxx can use this command.", ephemeral=True)```
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'bot' is not defined
yeah it was an example on the error as you cant iterate through such an object?
Ik now
bot is defined

you haven't defined it in your eval code
you cant pull a bot instance from no where
momento
!e
bot = commands.Bot(command_prefix = ',')
@bot.command()
async def accept(ctx, *args):
if (ctx.message.author.id == 809386625699151892):
if not args:
await ctx.send("Username is missing!")
else:
requests = await client.get_friend_requests()
for request in requests:
if request.id == args[0]:
await client.accept()
await ctx.send("Friend request was accepted!")
else: await ctx.send("Only foxx can use this command.", ephemeral=True)```
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'commands' is not defined
you have to include the modules
like watch
!e ```python
from discord.ext import commands
bot = commands.Bot(command_prefix = ',')
@bot.command()
async def accept(ctx, *args):
if (ctx.message.author.id == 809386625699151892):
if not args:
await ctx.send("Username is missing!")
else:
requests = await client.get_friend_requests()
for request in requests:
if request.id == args[0]:
await client.accept()
await ctx.send("Friend request was accepted!")
else: await ctx.send("Only foxx can use this command.", ephemeral=True)
bot.run(os.getenv('TOKEN'))
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'discord'
I should've import it using the os module lol
as said the eval command cant execute dpy code
Yeah, well, I have a idea
!e
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix = ',')
@bot.command()
async def accept(ctx, *args):
if (ctx.message.author.id == 809386625699151892):
if not args:
await ctx.send("Username is missing!")
else:
requests = await client.get_friend_requests()
for request in requests:
if request.id == args[0]:
await client.accept()
await ctx.send("Friend request was accepted!")
else: await ctx.send("Only foxx can use this command.", ephemeral=True)```
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'discord'
oh dangit
im using pycord
I forgot, my json database for bans from the bot
use a database and not json
has {"id": "",}
!e
import os
try:
os.system('pip install discord')
except:
print('Sorry, but that is a invalid module!')
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix = ',')
@bot.command()
async def accept(ctx, *args):
if (ctx.message.author.id == 809386625699151892):
if not args:
await ctx.send("Username is missing!")
else:
requests = await client.get_friend_requests()
for request in requests:
if request.id == args[0]:
await client.accept()
await ctx.send("Friend request was accepted!")
else: await ctx.send("Only foxx can use this command.", ephemeral=True)
bot.run(os.getenv('TOKEN'))
Okay welp
bro
lol, , that was the problme
Ik now, I was wondering if I can use a try and os.system to import the module
but Ig os.system doesn't work
you cant it doesnt have dpy installed and where is it gonna pull the token from
@slate swan :warning: Your eval job has completed with return code 0.
[No output]
you can use os.system and run a pip command
doesnt matter it wont let you lol
Okay jeez
for safety
why
you can use the pip package
UTILS?
that's the only way
discord.utils.get takes an iterator, and the kwargs you give it are the attributes it needs to follow
that..... is not a good way though?
For an example, utils.get(members, name="foo") would get the member named foo inside of members
For roles, you'd iterate the guild's roles, then pass name=
await ban(*, delete_message_days=1, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
None
falsey
lmao
warn's not a thing on discord
nah bro it only works on mac
yes it does work its a coroutine of Member class of the discord package
why wouldnt it work
my brother, it doesnt matter if its vscode windows or nokia vscode, it would work on any ide's
Basic python lol
guys pls stop trolling
its a beginner set an example
listen to me i dont troll lol
you can warn users with a db for a user history btw
Anyone here familiar with lichess API, I can't decode its resp tho it goes fine
it has special chars?
Just that stupid jsondecode error
!rule 7 ?
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
Don't think so
example on how youre decoding it
Embedded into the bot so not really offtopic ๐
๐ณ
the issue is off topic
await r.json()
mhm have you checked the response body?
Aiohttp req
ik
The content type is html for some reason
they why are you decoding html does it even return data formatted in json?
But the docs say it should return json
๐ฟ
and it doesnt return json?
Yes
can i see the response body?
Just because you're doing whatever this is inside of a bot does not make it dpy related.
"i have a toaster in my house, do i ask a carpenter how to fix it?" - Laggy
Okok chill out
144 lines of html squeezed
You don't really need to
!paste
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.
Maybe I should just try to provide params to data or to json param not to params
is theyre a param that returns data in json?
some apis have this header
"Content-type": "application/json"
so it returns json
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
๐ผ
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
pls go back to topic๐
I got pinged
@bot.command(name="shop")
async def shop(ctx: commands.Context):
await ctx.send("Welcome to the shop!\n")
strange thing is everything else with this line and dif name works fine
async def shop(ctx: commands.Context):
AttributeError: 'Command' object has no attribute 'Context'
yea
yayy, it works now, tyvm :D
yw
I have this json file
{"695229647021015040": {"warning_count": 1, "warn 1": "yes2"}}
and this code
warn_count = 1
warns[str(member.id)] = {}
if str(member.id) in warns:
warns[str(member.id)]["warning_count"] += warn_count
When I run it I get
Key error warning_count
Why is this happening and how to fix it
!e
print({"lol": "ok"}["lmao"])
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | KeyError: 'lmao'
an example on how the error gets raised
you cant use "WHERE" in inserts pretty sure
are you trying to update a row or insert a row?
You cannot use WHERE clause with INSERT
You can however use it with UPDATE
Like, UPDATE users WHERE id = ...
then its
("UPDATE table_name SET cloumn_name = $1 WHERE column_name = $2",i,o)
``` something like that
wait no
Oh sasuke already said this didn't see
hog riders is better tho
Qt Style Sheets support various properties, pseudo-states, and subcontrols that make it possible to customize the look of widgets.
off topic for this channel and I have no idea what I just read
my brain had a full on stroke
Same
check if the nick is in the list of stars
!d discord.Member.ban
here's my code, I need to unban tho
await ban(*, delete_message_days=1, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
no like different
!d discord.Member.unban
await unban(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unbans this member. Equivalent to [`Guild.unban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.unban "discord.Guild.unban").
!d discord.Guild.ban
await ban(user, *, reason=None, delete_message_days=1)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans 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 [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
!d discord.Guild.unban
await unban(user, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unbans 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 [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
not from a server
from a bot like
@client.command(pass_context=True)
@commands.check(check_Dev)
async def ban(ctx, banns): #command: bl!changeprefix ...
with open('bans.json', 'r') as f:
bans = json.load(f)
bans[str(banns)] = banns
with open('bans.json', 'w') as f: #writes the new ban into the .json
json.dump(bans, f)
await ctx.send(f"!!! Banned {banns}")
@client.command()
@commands.check(check_Dev)
async def unban(ctx,banns):
with open('bans.json', 'r') as f:
prefixes = json.load(f)
with open('bans.json', 'w') as f:
prefixes[str("unbanned")] = banns
json.dump(prefixes, f)
await ctx.channel.send(f'Unbanned {banns}')
where it'll log the ban to a data base
so they can't use the bot
json isnt a db lol
a black list?
but, it works fine with the ban, not the unban
!d discord.ext.commands.Bot.check
@check```
A decorator that adds a global check to the bot.
A global check is similar to a [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is applied on a per command basis except it is run before any command checks have been verified and applies to every command the bot has.
Note
This function can either be a regular function or a coroutine.
Similar to a command [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check"), this takes a single parameter of type [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context") and can only raise exceptions inherited from [`CommandError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError").
Example...
Is it possible to make sure that after restarting the bot, the variables are not reset, but there was that value before the restart?
nope
Sqlite3
๐ฟ
๐ฟ
like
yes its a database
I neec oto have the unbanned
first, then the id
not vice versa, and not not at all
And how to do so
this is for an economy bot, that's why I need it
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
a database is the best thing
Ok
json isnt a database, it cant really store data
^
I can ban
but, I can't unban I don't why it don't work
i recommend you use a database and then just use the global bot check
!d discord.Member.unban
await unban(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unbans this member. Equivalent to [`Guild.unban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.unban "discord.Guild.unban").
its a black list
nono not that
oh
lol
yeah, thx anyways
why is the slowmode so big 6s?
lol idk
well he said unban ๐ฟ
yeah but he means to ban them like put them in the black list
rn my friend Guigui (the id)
just say blacklist lol
ikr
cannot use the bot as an example
but, when U unban her, she still cannot, because the json is logging new data
when i invert it do it's
prefixes[str(banns)] = "Unbanned"
it works, but it won't log to the first one
is there any way to just get the "id" and nothing else?
for cogs is it recommended to have super().__init__
Says who?
no is it recommended
do you know what super().__init__() does?
Okay yes but who recommends it?
nope
no one just was wondering
w h a t
You don't need a super().__init__() in your cogs
Nor is it recommended
kk ty
allows you to refer to the parent class explicitly
can someone help me figure out why I'm getting this error: Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "hello" is not found
sort of
thats what super does
super().__init__() just calls the __init__ of the parent class
it calls the init method of the other class iirc
wait I just realized you were asking that guy if he knows what it is ๐
well try to read it, the command isnt found ๐
^
it's there tho
async def on_message(ctx, arg):
if ctx.author == bot.user:
return
if ctx.content.startswith('hello'):
await ctx.channel.send(arg)```
pain
bruh
on_message only takes message
holy fucking shit ๐
Wait
rip
i am
They made a command called on_message ๐ฟ
very confused
so how should this look then
Lmao I saw that
This confused me a lot
probably learn Python first and then how to use dpy or whatever fork you are using
It's like a mix between making commands in an on_message event and using the commands extension
in multiple inheritance its the same or you just call the initiate method lol
!d discord.on_message
discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Warning
Your botโs own messages and private messages are sent through this event. This can lead cases of โrecursionโ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
multiple inheritance ๐ฟ
discord.ext๐๏ธ ๐๏ธ
๐ฉ
this is sensitive content
is this right ```@bot.command()
async def on_message(message):
if message.author == bot.user:
return
if message.content.startswith('$hello'):
await message.channel.send('i')```
sort of
No
Just check this tutorial out:
https://vcokltfre.dev/
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
on_message is an event
not a command ๐
You should only have the member parameter
so you don't know python
This is pretty basic programming stuff, ngl```py
@client.event() # calling it
@client.event # not calling it
Then why are you making discord bots

it's not really a beginner thing, there are many concepts that become super confusing unless you know at least an intermediate level of python
you won't go too far without any basics in python
it's like you want to write in chinese just for fun but you have no knowledge about chinese alphabet
There isn't even an alphabet in chinese
๐ฟ
i tried to make a command where if this author sends this embed
Image
it would say 'HEY ITS A RAT'
i want to identify it with the image url
you cant log everything as said to you.
Yeah, events.
If you do, I will make you a Discord server in return.
mhm.
!rule 9
i can make a server with the + icon
bro its against tos
Fair enough.
You said events are allowed...
yes but you cant save huge amounts of data in discord its agaisnts tod did you ever read my messages?
Many bots have logging features.
Yeah I did lmao
yeah and the only reason is moderation which theyre verified bots
I'm only going to log when messages are deleted, when a member leaves etc
I know
!d discord.on_message_delete
discord.on_message_delete(message)```
Called when a message is deleted. If the message is not found in the internal message cache, then this event will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.
If this occurs increase the [`max_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") parameter or use the [`on_raw_message_delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_message_delete "discord.on_raw_message_delete") event instead.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Of what.
!d discord.on_member_join
discord.on_member_join(member)``````py
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
ah remove
It's as it says
Either do it outside the fstring, or use format
which is outside the fstring...
Yes you do, the newline character
!e ```py
f"{\n}"
it is the issue
@pliant gulch :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | f"{\n}"
003 | ^
004 | SyntaxError: f-string expression part cannot include a backslash
is this a bug? - i added soul music bot to my server, made sure that it can't see any messages except in the bots channel, so when i ran /play and joined a voice channel (that it was not suppsosed to see) it joined it somehow?
which is in the f-string expression..
ask it in their support server not here
alr
its only 11
nitro is way too overpriced
defo fake
wait its real

especially when it costs a few bucks for each
are you saying this dude made a deal with the devil to get discord nitro
no but its kinda off dont you think?
well yeah-
but its legit?
credit card theft
just means its a scam and illegitimate
๐คทโโ๏ธ
;-;
||gimme nitro||
thats nice saw his badge get added lol
if that server exists why not just join and win one
i didnt say youre a liar 
i think giving away scam nitro is probably against the tos of this server
reptile
where do you think they got the nitro from?
๐คฆ
๐
dont use flashy emojis lul, its a rule in the server
i saw the badge get added lol
okimii wants that nitro now
nah i want my prepaid Visa card to go through
cuz it wont go through and i cant get it since discord doesnt accept that method of payment๐

kinda dumb imo
discord out here ripping off naive kids
lol i just want it because of the 100mb upload limit
since the defualt is 8
i hate it its so tiny
you're paying $100 a year to be able to upload a larger file once in a blue moon
great investment
50 if classic
@client.event
async def on_embed(message, embed):
if message.embed.content.contains('https://media.discordapp.net/attachments/940755625472827442/946910305701757078/prediction.png'):
await message.channel.send('ricky rat boy')
how do i get the bot to see if the embed has a certain image url link, send ricky rat boy
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
what is that?
and embed is a string
make code blocks
there is no on_embed event, instead you would have to make an on_message event, check for embeds, convert it to json using to_json method and check is the url is in the image
could you help give me an example? i havent done to much research on json yet
Why do people just assume random events exist
json is used to format data
basically
So i have a leveling module and I want a disable/enable command. I was able to put a new column thats called leveling_is_active but when I enable it it keeps saying that it isnt enabled.
Here is my code and there is no error message py @commands.command() async def rank(self, ctx, user:nextcord.User=None): db = sqlite3.connect('main.sqlite') cursor = db.cursor() cursor.execute(f"SELECT leveling_is_active FROM levels WHERE guild_id = '{ctx.guild.id}'") result1 = cursor.fetchone() if result1 == 1: if user is not None: db = sqlite3.connect('main.sqlite') cursor = db.cursor() cursor.execute(f"SELECT user_id, exp, lvl FROM levels WHERE guild_id = '{ctx.message.guild.id}' AND user_id = '{user.id}'") result = cursor.fetchone() if result is None: await ctx.send("That user is not yet ranked!") else: await ctx.send(f'{user.name} is currently level `{str(result[2])}` and has `{str(result[1])}` XP!') cursor.close() db.close() elif user is None: db = sqlite3.connect('main.sqlite') cursor = db.cursor() cursor.execute(f"SELECT user_id, exp, lvl FROM levels WHERE guild_id = '{ctx.message.guild.id}' AND user_id = '{ctx.message.author.id}'") result = cursor.fetchone() if result is None: await ctx.send("That user is not yet ranked!") else: await ctx.send(f'{ctx.message.author.name} is currently level `{str(result[2])}` and has `{str(result[1])}` XP!') cursor.close() db.close() else: return await ctx.reply("Leveling is not enabled.")
0 = False
1 = True
yes False is 0 and True is 1
Don't connect to the database each time you make a command
2.
sqlite3 is blocking, use aiosqlite instead
!pypi aiosqlite
well 1 the code used to work before without the leveling_is_enabled so i think its fine
- so replace sqlite3 with aiosqlite?
That's not the point
why are you connecting many times?
tbh i dont know ill fix it
aiosqlite is async so you'll need to add awaits appropriately
and follow pep8๐
so then it would be await cursor.execute(f"SELECT leveling_is_active FROM levels WHERE guild_id = '{ctx.guild.id}'")
!sql-fstrings
SQL & f-strings
Don't use f-strings (f"") or other forms of "string interpolation" (%, +, .format) to inject data into a SQL query. It is an endless source of bugs and syntax errors. Additionally, in user-facing applications, it presents a major security risk via SQL injection.
Your database library should support "query parameters". A query parameter is a placeholder that you put in the SQL query. When the query is executed, you provide data to the database library, and the library inserts the data into the query for you, safely.
For example, the sqlite3 package supports using ? as a placeholder:
query = "SELECT * FROM stocks WHERE symbol = ?;"
params = ("RHAT",)
db.execute(query, params)
Note: Different database libraries support different placeholder styles, e.g. %s and $1. Consult your library's documentation for details.
See Also
โข Extended Example with SQLite (search for "Instead, use the DB-API's parameter substitution")
โข PEP-249 - A specification of how database libraries in Python should work
and you can do
if not result:
over
if result is None:
Yes
oh yea i do that
f-strings in sql queries are really bad, use placeholders instead.
alright so move to aiosqlite and dont use f strings in queries
got it
youre ok because youre not getting user input so sql injection is not possible but its good practice
And don't connect to your database in each command
so make this global?
instead of in a command?
No
yes with bot variables
!bot-var
Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"
@bot.command()
async def get(ctx: commands.Context):
"""A command to get the current value of `test`."""
# Send what the test attribute is currently set to
await ctx.send(ctx.bot.test)
@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
"""A command to set a new value of `test`."""
# Here we change the attribute to what was specified in new_text
bot.test = new_text
This all applies to cogs as well! You can set attributes to self as you wish.
Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!
Use this
but then wont it not update if a user gains a level
No
its a global variable bound to your bot obj
ok
i consider it as one but idc
then what is it
iTs A MaRkUp LAnGuAGeE
hypertext markup language
i know that
?
o-o you can code in html toopid
you can use js in it
but if it doesn't count as a programming language then what is it
Itโs got language in the name kek
How is html not a programming language
oh boy here comes a debate
^
okimii trying to shitstir
LOL
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
HTML is great. It defines the structure of webpages and it determines how data is displayed online. What youโre looking [โฆ]
guess Ben Romy is wrong or is he
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
yeah change the topic after you read that page๐
well so
.topic
Suggest more topics here!
more topics for this bot
on a command, after (under it) @client.command() or @commands.command()
@commands.has_permissions(permission here)
so if you wanted admin perm
@commands.has_permissions(Administrator=True)
administrator
or
if you want one to check if the bot has perms
not exactly
It would be easier just to check view_audit_log of Member.guild_permissions
Checking if this is either True or False
oops
:O
what?
?
why suprise
Wdym
I guess it depends on the channel, cause guild_permissions as the name suggests, would be guild wild
so everywhere with sqlite will have to be replaced with await
Not everywhere
await import aiosqlite
๐ฟ
if (message.author.id == '77432345678') {
message.embeds.forEach(function(e) {
console.log(e);
if (e.title && e.title.startsWith('New Meme Post')) {
message.channel.send('thats a meme lol}');
}
});
}
i saw this and i wanted to do something like it but instead of the title i want the image url
uh
why is their js
bro why await import aiosqlite
why not just put it at the top
hes joking lol
buddy go to discord.gg/djs
this is a python server
and the if statement will always be False
youre comparing an int to a str
wait thats js?
javascript
๐
0-o
we dont use {}
no i cant go back to it, i swore not to
you have
console.log
please can it be converted to python?????
no.
WHYYY!Y!!!!!
we dont convert code, we assist not do it for you
how can i remove the 00:07;34.... i am using datetime
but can it be done?
pov: caeden doesnt know js
pov: i know every language on earth
error?
even the love language ๐ณ
js is basically python but they ripped off our syntax
ashley loves me
its tellin me weird shit
who doesnt๐
;)
no need for the pass_context kwarg and bro you forgot a colon its a loop its basic python.
yea just realized always happen after i ask
;))
happens lol
discord.ext.commands.errors.BadArgument: Converting to "int" failed for parameter "minutes".
oof
type hint min to an int
min: int = 1
still wont work
how?
no matter what even if i change it to 1 , it just says disabled
a colon
no i just had a brain fart lol i realzied i was missing ":" after
ah
how would i make it so after they click the button the button is then disabled using discord.py
how do i change bot status when it loads
!d change_presence
No documentation found for the requested symbol.
you can use children and index the list and disable the button
hold on
!d discord.ext.commands.Bot.change_presence
await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the clientโs presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
``` Changed in version 2.0: Removed the `afk` keyword-only parameter.
@commands.command()
async def rank(self, ctx, user:nextcord.User=None):
db = sqlite3.connect('main.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT leveling_is_active FROM levels WHERE guild_id = '{ctx.guild.id}'")
result1 = cursor.fetchone()
if result1 == int(result1[0]):
if user is not None:
db = sqlite3.connect('main.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT user_id, exp, lvl FROM levels WHERE guild_id = '{ctx.message.guild.id}' AND user_id = '{user.id}'")
result = cursor.fetchone()
if result is None:
await ctx.send("That user is not yet ranked!")
else:
await ctx.send(f'{user.name} is currently level `{str(result[2])}` and has `{str(result[1])}` XP!')
cursor.close()
db.close()
elif user is None:
db = sqlite3.connect('main.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT user_id, exp, lvl FROM levels WHERE guild_id = '{ctx.message.guild.id}' AND user_id = '{ctx.message.author.id}'")
result = cursor.fetchone()
if result is None:
await ctx.send("That user is not yet ranked!")
else:
await ctx.send(f'{ctx.message.author.name} is currently level `{str(result[2])}` and has `{str(result[1])}` XP!')
cursor.close()
db.close()
else:
return await ctx.reply("Leveling is not enabled.")```
welp there you go
bro in your bot file you make the bot var
im too lazy to do that but it normally works
e
connecting to a db in each if statement in a command seems inefficient dont you think?
eh as long as it works its fine
yeah no
it works
normally
doesnt matter its bad practice
and inefficient
what ever
im just saying bad practice isnt good
im just saying that it works 
good for you things can work but it doesn't mean it can get better
yes yes yes what ever
im just suggesting you it if you dont follow it not really my problem but im doing it so you dont end up with bad habits.
yes i know
its for your sake after all
Just because it works doesn't mean it's fine
jesus OK
Opening the database everytime you need to access it is terribly inefficient
how do i fix this break? error saying "break can be used only within a loop"
after i was told to add int = 1
could you show a example i'm kind of confused lol
Hey guys, I hope I can ask my question here, I get this error very often and dont know how it gets triggert.
lib?
check their repo on github
only member has that attr
Yeah I know, But my bot has no contact with other bots
what?
Can you name an example of how this could get triggert?
How do i detect if an embed message has the title "a new meme appeared"
could you send the link
its an attr error
message.embeds -> List[discord.Embeds]
attr= attribute?
I mean, does it get triggert if a bot writes a message and my bot tries to read it?
im not sure idk what the code does but its just an attr error lol
I was the last contributor in that folder ๐ฆ
yeah ik๐
its "just" an attr error means? I should ignore it?
Idk I want to know where it comes from.
bro
bro just respond normal xD
its basic oop the User class doesnt have that attribute
so like this? if message.embeds -> List[.title == new meme!] await message.channel.send('thats funny')
yes user has no attr "roles" course bots are "user". I get this... But this is not my question
What is your question?
bro no
Oh no, the -> was just me saying the type of message.embeds, sorry if that was unclear
Robin was juat saying what the attr returns
for embed in messsage.embeds:
# loops through each embed in a given message
what would i have to install to fix ImportError: cannot import name 'Embed' from 'discord.embeds' (/home/runner/rewardbot/venv/lib/python3.8/site-packages/discord/embeds.py)
instead of break use return
How this gets triggert and maybe how I can avoid this error.
And with "how" I mean, exactly what must happen.
(in case you asked me Robin)
A user object doesn't have a roles attribute
break is for breaking loops return is used to return methods
Quite simple
"a new meme appeared" in map(lambda emb: emb.title, message.embeds)
^ something like this would work
You're probably using .roles on an instance of discord.User, and normal discord users don't have a role property to them. discord.Members, on the other hand do, since they are part of a guild and can have roles
like this?
if "a new meme appeared" in map(lambda emb: emb.title, message.embeds):
await message.channel.send('thats funny')
sure that would work
what is lambda btw
Though I would suggest try to understand what it does instead of copy-pasting it
One line function, map() goes through each item in the list, and runs lambda on it
ImportError: cannot import name 'Embed' from 'discord.embeds' (/home/runner/rewardbot/venv/lib/python3.8/site-packages/discord/embeds.py)
could anyone help i'm so confused i'm using replit.com rn
functions can be one line as well
omg same i use repl.it
lambdas are just anonymous functions
i had to do kill 1 cuz i was rate limited for some reason and now when i run again i think my import libraries are all gone
!e
x = [1, 2, 3, 5]
print(list(map(lambda x: x*2, x)))
@sick birch :white_check_mark: Your eval job has completed with return code 0.
[2, 4, 6, 10]
hopefully that helps you understand
both map + lambda since often they are used together
!e
print(list(map(str, [n for n in range(101)])))
i.e
DO NOT use replit.
@slate swan :white_check_mark: Your eval job has completed with return code 0.
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100']
read.
Okay thanks I will have a look at my code.
But why does this error gets triggert so random and even if no message was send on the Server?
#discord-bots message < on replit
๐ค Can we see the code?
@slate swan
why? im on a school chromebook and i cant do anything else ๐ฆ
read the screenshot i sent above.
why not
ill dumb it down, replit is by far the worst host and is even worse for discord bots
AWS provides a free tier, so does Google iirc
oh my god, read the screenshot i sent here @rotund frigate @silent ermine
And those guys are used everywhere, very reliable and have a wide variety of tools for you in the future
^^
i just read it
its line 859. I hope this helps.
700 free hours of t2.micro instances per month for a full year
using replit for your bot is basically shooting your bot in the head
and ignore the first part haha xD
I think they're trying to say don't use repl.it to host your bots, it would be fine if you coded in it I suppose because it's not a horrible IDE but it's not a great host
Can you copy paste the code here? It's difficult to see that
yeah sure
Unfortunately I think many people think replit is a good free host, I can't see people using it as just an IDE when there are far better alternatives such as Pycharm or vscode
@client.event
async def on_message(message):
if message.author.bot or client.emergency == True:
if client.emergency == False and client.guess >=0 and client.mchannel == message.channel and len(message.content.split()) == 5:
client.remove.append(message.id)
elif client.emergency == False and client.guess >= 0 and client.mchannel == message.channel and message.author.bot and len(message.content.split()) != 5:
client.remove.append(message.id)
elif discord.utils.get(message.guild.roles, name=client.rolename) in message.author.roles and message.content ==(str(client.command_prefix) + "stopemergency"and client.mchannel == message.channel):
await client.process_commands(message)
yeye, theyโve upgraded their IDE to a better one lately,
"good free host" is a bit of an oxymoron
aws is it free and online(no download)
ahhh looks bad
yes, free & online
People use it as an IDE when they have no other options, like if they use a school chromebook or something at least from my experience
I agree though, not a great host
also, dont use heroku either, jsyk
that's just as bad yeah
.topic
Yeah these lines are so long ๐ ๐
hm, pretty much all of them are unique because I made my bot for a specific purpose
What exactly are you trying to do here?
most unique by far is my bot logging videos and images without discord deleting it off of their database
like 0.1 of all logging bots log videos as far as i know which makes if special as is
Pretty that breaks the developer tos
what specific purpose?
well all it does is download the video/photo at it core.
any bot that does image logging does that
Yeah that 100% breaks tos
inb4 bot downloads copyrighted material
ah
Logging is kinda scummy anyways imo
so i do student council, and i made a bot to organize things like meetings and events and what not, so it could be organized rather than manually counting it
Ok so I made a giveaway command but I was wondering how to make it first of all so if no one wins the bot sends a msg saying like No one has won the giveaway plus so it doesn't send a error in console,
how to make it so the bot can't win
what does inb4 mean?
And downloading all this stuff just means extra bandwith being used
In before
in before
thought so but didnt work in that context
the bandwith on my vps is relatively good and it doesnโt take up much at all.
nice
"No one wins," so 0 reactions on the message/no one entered the giveaway?
is it safe to do Bot.change_presence during on_ready?
No
Does it not break the user privacy part of the tos?
And what happens if someone sent and deleted a zip bomb or something
how would i do it then ?
if that was the case, any bot that doesnโt that should be deleted, including dyno.
hey what does it mean 12 months free?
@sick birch yeah
You get 700 hours/month for the first 12 months
12 months and all my work is reset?????
it doesnโt log exeโs or zip files ๐
So like if no one enters aka no one wins how to do I make it send a msg instead of sending a error in console
No, you have to start paying afterwards
so its not free?
Ok yea that makes sense
But there's no "work" to be reset, assuming you're using EC2 it's just a virtual computer on Amazon's network
Are your users aware that you're downloading all their content?
You will either have to pay to keep using their servers or find a different host
like uptime robot?
itโs downloading deleted videos and photos, it also deletes it after from the system.
it downloads it for like a brief second and gets rid of it
So I'm going to assume no
No, it's a completely different computer on their networks you can do anything with
Which is what hosting is anyway
They also have other services for free, such as free 5G of S3 data, more here: https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free Tier Types=*all&awsf.Free Tier Categories=*all
im honestly just done with you at this point
So you are breaking tos
Probably doesn't matter, GDPR doesn't cover chat messages
how do i do change_presence automatically but not on_ready
good question tbh.
the second "if" adds the current message to a list -> This message will be deleted after the game ends.
3 if (elif):
same, just with some little extras
4 if (elif) (the error line)
If someone wants to stop the Bot, he (if he s an admin) can type this "stop..." stuff. Then the Bot will skip the "on_message" code below
So the first "if" statements are like always False when the error gets triggert. So they are not important.
And the "if" statement on line 859 checks, if the person has an admin role, if someone writes "stopemerg...." and the last part is useless lol. Its hard to explain tbh.
I can understand if you cant help me with this one, in connection with this answer ๐
bot = commands.Bot(..., activity=..., ...)
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Probably not
1 last thing, can i make it into a list, change it every like 30 seconds random choice ? if so how
no, if it was the case, bots like dyno or mee6 would be gone already.
mee6 should be deleted anyways
true
from discord.ext import tasks, commands
class MyCog(commands.Cog):
def __init__(self):
self.presence_updater.start()
@tasks.loop(seconds=30.0)
async def presence_updater(self):
# change presence here
How can i make it so that it doesnt time out even tho it works, make the bot react to the embed with the emojis (so that users can easily react) and make it so only one emoji can be reacted to so that it doesnt accept other inputs? and how can i make it only "listen" to the user who executed the command?
@sick birch I think I will just delete this lines, they are even pointless, but would be still cool to know why this error occurs.
But in general this question is done, thanks
Looks weird, never seen bot path before and I've done a lot of stuff with DAPI, an in any other case discord uses /science endpoints for metrics
@sick birch
Yes?
So with the giveaway command I only need help with 2 things
- How do I make it so the bot doesn't win and if the bot picks itself it rerolls and picks a actual user
- How do I make it so if no one enters it doesn't send a error in console saying the giveaway winner list was empty
To clarify, you are using reactions, yes?
message.reactions[1:]since I believe the bot is always the first in that list- if
len(message.reactions) == 1since the bot will be the only participant, then send a message saying no one entered the giveaway
How can i make my reaction roles only listen to the command executor? currently it accepts any user..
list_of_emojis = ['๐ด','๐ก','๐ข']
def check(reaction):
if reaction.emoji not in list_of_emojis:
return
elif reaction.emoji == "๐ข":
print('green')
return
elif reaction.emoji == "๐ก":
print('yellow')
return
elif reaction.emoji == "๐ด":
print('red')
return
try:
await ctx.bot.wait_for('reaction_add', timeout=15.0, check=check)
except asyncio.TimeoutError:
print('timed out')
else:
await ctx.send('API Call sent!')
How would I type that code into the actual main.py file
or well how would I enter it
Include that in your check, if reaction.user == ctx.author
if len(users) == 0:
await ctx.send("No winner was decided")
so if reaction.user == ctx.author and reaction.emoji not in list_of_emojis:?
# the user who wins the giveaway
winner = random.choice(message.reactions[1:]
if len(message.reactions) == 1:
await ctx.send("No winner was decided")
that is what I have that makes the bot send a msg if no users enter
That is correct
So those 3 lines of code should make it so 1. the bot can't win and 2. if no one enters no error is sent in console
I removed the : from the 1 because I got a syntax error in console
Yes
await ctx.send("No winner was decided")โ
^
SyntaxError: invalid syntax
the ^ is below the a in await
though I don't see anything wrong with await ctx.send("No winner was decided")
um
Guys
do you care if I dm you a picture of all the code around it
how do I learn discord bot coding
cause the picture also has other tabs I have open in it
!paste
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.
Just copy paste the 4 or 5 lines around it
Learn Python first
Ik quite a bit of python
users = await new_gaw_msg.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(message.reactions[1:]
if len(message.reactions) == 1
await ctx.send("No winner was decided")
await ctx.send(f"Congratulations {winner.mention}! Yuo have won the giveaway for **{prize}**!")
learn basic python then oop than async programming and then you can go for dpy
You need the colon :
where
what's dp
when I put 1: it said syntax error
hover over it
what is an api ?
@sick birch I removed the : there because it gave me a syntax error
now it's giving me a syntax error for the code directly below that
Well : is important
Application Programming Interface
which does what?
If it's giving you an error directly below that it might be your indentation
Is there anything i could put around the 1 so it doesn't give a error
i cant really explain as its a huge topic and youre a beginner it will be quite hard
users = await new_gaw_msg.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(message.reactions[1:]
if len(message.reactions) == 1:
await ctx.send("No winner was decided")โ
await ctx.send(f"Congratulations {winner.mention}! Yuo have won the giveaway for {prize}!")
is this how your code looks like?
define beginner
!resources @subtle kindle
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
google it
So ik when I'm not one
?
bro said google beginner ๐
@sick birch the way you had it before
then close it?
which one should I look into
with the code above if len indentended to the right
..
the recourses page?
which ever you would like :))
So none are more important then others?
!e print(len("lol")
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(len("lol")
003 | ^
004 | SyntaxError: '(' was never closed
yeah whenver I add a : next to the 1 it gives me a syntax error
It's most likely your indents then
I put a : next to the 1 and it gave me a syntax error
Send a picture this time, instead of a code block
nice dude
@subtle kindle ?\
I mean nice that you can code python
Half of this is from tutorials and the other half is primarly me learning how to code
I'm not seeing any squiggly lines? Unless your IDE or whatever that is doesn't show it
still
IDEs usually show squiggly lines underneath where exactly the error happens
!e print(len("i hate you!")
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(len("i hate you!")
003 | ^
004 | SyntaxError: '(' was never closed
figured it out though
Python has basic syntax so it is a very easy language to learn but don't let it fool you
I don't think that shows it
just like this for example
I have my code viewer thing set tto Python
() should always be paired
It's very sensitive to spaces too right
Right
depends
@sick birch do you see anything wrong with that code?
Delete the code and try to write it yourself without copy/pasting, that sometimes fixes it since whitespaces from copy pastes can get messed up
got me
Would me using nextcord mess up that code
pardon?
no no its just pythons syntax
okimii
No
hi
If you have been learning python for 4 months should you be good at it?
depends
Depends on the person
depends on me lol
depends on your learning speed passion time etc
I'm not a quick learner
Took me ~2 years to actually get decent at it and have the confidence in my skills to put it to good use
and what were u like making
what programs
so I can know what level you were on I guess
mostly bots that use apis
What do you expect in this channel
lol
i dont do them anymore tho 
Same, I do mostly javascript now :p
My account got disabled 3 times in the past 2 days for nothing
i make api wrappers and i wrap robins apis๐ณ
I think A discord mod doesn't like me
If only you could make a wrapper for the API we made for the project ๐
which๐
the only one :p
What age did you guys start learning at
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
Hmmm
is that a challenge ๐
14 im 15 now lol
again,
okay
seen people start at 13 tho
lol
Don't beat yourself up over it, people learn at different speeds and at different times
I started coding at 5๐ฟ
if you can make a subclass with multiple inheritance i think youre good
guys.
come on.
u 4 now
3*
dang bro that was funny
binds is a big boy now ๐ค
wasnt meant to be funny ๐ฟ
๐ฟ
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
you enjoy math?
stop fucking talking off topic here.
yes very much
math๐ก
I support Ukraine if that helps
ok bucko clam down
remember, this channel is discord bots not a hangout.
What math lol
!ot
๐
c:\Users\Andrew\Desktop\a\main.py:4: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils import command
``` whats this?
3.12
it means that module is being removed ig
yes
well
i need that module
was just working now it isnt
thanks
idk honestly
;))
Algebra, linear algebra, geometry
๐ฟ
Astronomy > math
true though

trig is nice too
biology > astronomy
python
there *
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
stop talking here about unrelated shit or ill get mods
Teach me grammar then?
a = input("What's your favourite subject?")
if a != 'Math':
print("You're normal")
else:
print('Damn really')
how do you guys get used to putting code in perfect space
someone linked me here?
i use tab to space it for me in my IDE
same I mean
without it how would you guys know
practice I guess ???
1 tab 4 spaces
ye but i dont remember you sorry ๐จ
i do๐ณ
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
we should listen to poor sawsha
๐ด
this is like the 4th time, this channel is not made for off topic stuff.
dont say it to me only๐๏ธ ๐๏ธ
are there any benefits of using the raw discord api in python?
It's a bit faster
But not worth the headache
Yeah that's what i've noticed it's alot faster
my bot which is 150 servers uses raw api for some stuff cause it's faster
idk using the raw api seems sus
Yeah I know, it feels odd
and youll have to make endpoints manually which is allot
Yeah was a pain in the head
no i mean some people use the raw api for nuke bots
Yeah actually that's what i found out recently, cause it's like alot faster and apparently bypasses the rate limit
and not wrappers because wrappers dont have those methods
yes the wrapper handles ratelimits but it makes you more vulnerable to getting ratelimited
Thanks for Letting me know, cheers
Youre very welcome
how can I use a loop to make my bot repeat the result until it gets the desired reply? for example: a random number generator, how could i make it generate a number until the the number 78 is selected
make the loop see if the number it generated is the number you selected
yes, but how....
if statements?
No?
huh?
how would I make the process repeat with a if statement.
!pastebin
@slate swan , hey, so I used interaction.followup.send() and I get a unknown webhook error
basic python?
while True:
if 87 == 87:
await ctx.send("matched")
else:
pass
