#discord-bots
1 messages · Page 681 of 1
becoming tech support --> Bad
For discord? Yes
no I mean having public bot => you become a tech support
Haha true tho
DMs be like: "How to use the bot"
async def on_message_edit(before, after):
await before.channel.send(f"{str(after.content)}\n \n Editado por: {before.author}")```
Can someone help me, its not working...
how do i use a cog_check method for my cog
why cant i understand any of this code
wdyum?
idk i dont understand shit
ah i feel like i will never understand it
ahhahahahaha, well im starting to feel that way aswell, i cant make that thing work
ahh damn im really new to coding so im not good at it
Hello bro
hm, at python coding or discord python coding?
ofc we all did at some point
ah how long did it take for u to master python
im not a master or even close ahahha, but i can handle myself on normal programing
which code
i think he's just new and tryin to learn, idk iff he has some actual code rn
It takes in a ctx arg
i know, i tried
async def cog_check(self, ctx):
return ctx.author.id == 1234
i tried this ```py
async def cog_check(self, ctx):
return ctx.guild.id == ...
It does work
it didnt
does it work for events too?
!d discord.ext.commands.Cog.cog_check
cog_check(ctx)```
A special method that registers as a [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") for every command and subcommand in this cog.
This function **can** be a coroutine and must take a sole parameter, `ctx`, to represent the [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context").
No
oh
Only commands
async def on_message_edit(before, after):
await before.channel.send(f"{str(after.content)}\n \n Editado por: {before.author}")```
can u help with this?
its not working whatsoever
i once made it work but not the way i wanted
What's the error
it doesnt even give an error
it was like its not even reacting to the event
Whether guild and direct message related events are enabled.
This is a shortcut to set or get both guild_messages and dm_messages.
This corresponds to the following events...
<
Can i code a discord bot if I understood basic python??
>
you can do anything you want
kinda, i recomend u to watch some videos on yt
Hm
do custom checks work with events
depending on your objectives ofc
sure
hi, here is my code:
@commands.group()
async def what(self, ctx):
try:
await ctx.send()
except:
pass
@what.group()
async def is(self, ctx):
try:
await ctx.send()
except:
pass```
raceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 660, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 839, in exec_module
File "<frozen importlib._bootstrap_external>", line 976, in get_code
File "<frozen importlib._bootstrap_external>", line 906, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/runner/choithediscordbot-3/cogs/general.py", line 52
async def is(self, ctx):
^
SyntaxError: invalid syntax
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "main.py", line 52, in <module>
bot.load_extension(f"cogs.{filename[:-3]}")
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 732, in load_extension
self._load_from_module_spec(spec, name)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 663, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.general' raised an error: SyntaxError: invalid syntax (general.py, line 52)
this is my error
cant have keywords as function names
!e
def is():
...
is()
@boreal ravine :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | def is():
003 | ^^
004 | SyntaxError: invalid syntax
ok
^
@commands.has_role("Owner")
async def reroll(ctx, channel : nextcord.TextChannel , id_ : int):```
What id do i have to use here>??? after the nextcord.Textchannel
I don't think so.
what id?
message id or wot
@client.command()
@commands.has_role("Dumb Idiot")
async def reroll(ctx, channel : nextcord.TextChannel , id_ : int):
try:
new_msg = await channel.fetch_message(id_)
except:
await ctx.send("This was entered incorrectly.")
return
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(users)
await channel.send(f"Congratulations! The new winner is {winner.mention}.They won {prize}!")
use that then?
whats the error then
error says argument missing
which id is this?
it's a random message ID
Hey guys
^^
it doesnt work
codeblock it please
Whats the error
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: list index out of range
the message doesn't have any reactions
or the bot didnt react ig
oh
yep
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'prize' is not defined
bot did react
i copied the id of the message that has the reaction
define it
o
he popped the bot from the list
that's why it gave an error
nobody else except the bot reacted
people did
no clue then ¯\_(ツ)_/¯
hmm
are you sure you copied the right message id
i am not sure
double check
k
i think
i used the right id
extcord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'prize' is not defined
what does this mean now??
hm
do i have to change prize to any other
any other what
name 'prize' is not defined
define it then?
!e
print(prize)
``` i dont think i need to help you with this
@boreal ravine :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 'prize' is not defined. Did you mean: 'print'?
didnt i already defined it
Where’s the code 😳
@client.command(name='shop')
async def shop(ctx):
embed = discord.Embed(description = "Here are the items available in the shop.", color = 0xF5F5DC)
for item in shopp:
name= item["name"]
price= item["price"]
desc= item["description"]
embed.add_field(name = f"{name} ・ {price} :cherries_:", value=f"{desc}", inline = False)
embed.add_field(name="", value = "Not sure how to earn :cherries_:? run `m.help`", inline = False)
embed.set_footer(text="Do you know you can earn 1000 cherries just by subscribing to milkylatte on YouTube?")
await ctx.channel.send(embed=embed)
this gives an error, why doesnt it work :(
name is required
it cant be an empty string
error never lies, show code
Hi kayle
ty
why my code send CommandNotFound error message when there is a comand about that and why when my code not found it send the message twice...?
Can you show the command's code and how you defined your Bot instance?
breh it litteraly send everything twice
k, wait
You must have two instances running at the same time.
In other words, your bot might be hosted twice.
HMMMM
Nice undertale fan
breh no, just 1
And you use scratch
lol yeah
import discord
import requests
import youtube_dl
from discord.ext import commands
from discord.ext.commands import CommandNotFound
bot = commands.Bot(command_prefix="sal! ", help_command=None)
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, CommandNotFound):
not_found = discord.Embed(title="command not found!", description="command not found! might be in progress, check sal! help for the available commands", color=ctx.author.color)
await ctx.send(embed=not_found)
raise error
@bot.event
async def on_ready():
print("ready")
@bot.command()
async def help(ctx):
help = discord.Embed(title="all the commands available",description="",color=ctx.author.color)
help.add_field(name="help", value="shows this message",inline=True)
await ctx.channel.send(embed=help)
#nvm the closed code below, just some ytdl stuffs
||@bot.command()||
||async def play(ctx, url: str, channel=None):||
||if channel == None:||
||channel = 'General'||
||else:||
||channel=channel||
||voice_channel = discord.utils.get(ctx.guild.voice_channels, name=channel)||
||voice = discord.utils.get(bot.voice_clients, guild=ctx.guild)||
||await voice_channel.connect()||
bot.run("token")
@commands.command(pass_context=True)
async def join(self, ctx):
channel = ctx.message.author.voice.channel
voice = get(client.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
await voice.disconnect()
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
print(f"The bot has connected to {channel}\n")
await ctx.send(f"Joined {channel}")
this is on cogs, anyone help me, Im getting red lines in the part:
voice = get(client.voice_clients, guild=ctx.guild)
Why are you using spoilers
isn't ytdl breaking yt ToS smth?
!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.
Then I’m not helping you
If it’s breaking TOS
ngl, That's true, even a mod said to stop teaching people here about ytdl
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
breh i'm not here because need help on ytdl ;-; i just ask why the code send everything twice
Ok I’m gonna go back to class bye~
i need help not about ytdl ;-; pls dude, i just ask why it send everything twice
Do u have bot.process_commands in your on_message?
on message...?
Fixed it?
so like when i said..
!help
this bot says that
U got two instances of your bot running tbh
Can ya tell me what it shows when u hover over the line?
why doesnt this work? it doesnt show an error either
@client.command(name="give", aliases = ('send','dash'))
@commands.cooldown(1, 30, commands.cooldowns.BucketType.user)
async def give(ctx, user : discord.Member, amount = 0):
await register(ctx.author)
await register(user)
users = await get_bank_data()
bal = users[str(ctx.author.id)]["balance"]
if amount > bal:
await ctx.send(embed=discord.Embed(":( poor child. You don't have enough money to give out", color = 0xf5f5dc))
elif amount <= 0:
await ctx.send(embed=discord.Embed("Don't be selfish! No negative numbers >:(", color = 0xf5f5dc))
else:
await update_bank(user, amount, "balance")
await update_bank(ctx.author, -1*amount, "balance")
await ctx.send(embed=discord.Embed(f"Done! {ctx.author.mention} just gave {user.mention} {amount} :cherries_:", color = 0xf5f5dc))
get?
underfined name "get"
undefined name "client"
U do amount: int = 0 @valid barn
hmmmm
from discord.utils import get
What is this lol?
Also
version problems
the default amount is 0 tho @upbeat otter
!d discord.Guild.voice_client
property voice_client: Optional[VoiceProtocol]```
Returns the [`VoiceProtocol`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceProtocol "discord.VoiceProtocol") associated with this guild, if any.
U already have it @copper gulch
ohk
;-; pls help
if an amount is specified, it is a string
yeah?
ctx.guild.voice_client will return the voice client of the current guild (;
What should i need to install to fix the version problems?
lemme try it
why the bot send everythin twice ;-;
I did this and now client is undefined
idk which package?
wherein this is on cogs
@copper gulch
btw sup
regen the token
k
hmmm
ok thanku
ok lemme try
show full error
Uhhh it was for Winszy but welcome
@upbeat otter@maiden fable still doesnt work, no error
wrong
No*
huhhh, show code again
voice = ctx.guild.voice_client
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'voice_clients'
client*
typehinting always doesnt work
ohh
fixed thankyou
@client.command(name="give", aliases = ('send','dash'))
@commands.cooldown(1, 30, commands.cooldowns.BucketType.user)
async def give(ctx, user : discord.Member, amount = 0):
await register(ctx.author)
await register(user)
users = await get_bank_data()
bal = users[str(ctx.author.id)]["balance"]
if amount > bal:
await ctx.send(embed=discord.Embed(":( poor child. You don't have enough money to give out", color = 0xf5f5dc))
elif amount <= 0:
await ctx.send(embed=discord.Embed("Don't be selfish! No negative numbers >:(", color = 0xf5f5dc))
else:
await update_bank(user, amount, "balance")
await update_bank(ctx.author, -1*amount, "balance")
await ctx.send(embed=discord.Embed(f"Done! {ctx.author.mention} just gave {user.mention} {amount} :cherries_:", color = 0xf5f5dc))
welcomeeee
amount: int = 0 bro

is this JSON?
which package?
full thats like half of it
yes
use a db
use discdb
bs4?
what the heck is that now
i did , oop i sent the code that i didnt update
but it still doesnt work
!pypi bs4 used for scrapping websites
😐
bs4 is just a dummy package, just like discord
Nothing leave it
I was asking if bs4 is giving an error but fine
..elp-
Lol
i
Try adding dummy print statements in every other line and see which lines are being executed
@valid barn print something after every step and see where the text stops printing, thats where the erorr will be
wow
kk
i have no idea, thought it was a version problem. Maybe some packages are outdated
I came across a problem with my discord bot... when I am trying to active "respond to keywords" it is printing a message of putting it off... here is the screenshot
Tbh you should have just done the @ bot.command() stuff
i mean he did say keywords
Eh
commands require a prefix
hmmm... so how can I fix it ...???
whats the error
I don’t think there is one
I would have just used async def but ok
he is though
I printed the value... but the value is 'true' but still it is showing keywords is off
He’s doing startswith
this doesnt work
async def on_message_edit(before,after):
if before.channel_id == 917179419255250974:
await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )```
this works
```@client.event
async def on_message_edit(before,after):
await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )```
can someone help me, i want it to only react to messages that are on a specific channel
thats an attribute though
Alright
its channel.id
if I make a remind command, can I just make it wait a delay with asyncio.sleep?
The channel ID.
I have used async in the top of the code...
Ok
sure, just hope you have a good vps
would it work with multiple users as well?
yes but it will not complete if u restart the bot
sure
they already did that
already tried it
What did it return
.
Currently the host is kind of fked up, I will be switching to aws/gcs or smth in next year
scroll up
it returned true
what host are you using?
That’s weird
Good to know, thx 😄
Try using an if statement to check if it is db[“responding”] is True
but the output in discord is not what i am expecting... yeah I know it is weird it has not happened before...
ok...
epikhost atm, it's free so I took it (it worked perfectly with 24 hour uptime but no there are bugs)
@upbeat otter @maiden fable elp i realized i didnt put 'description' before writing the desc of embed in the last line, everything printed correctly but my balance and the bal of person i give to didnt change >:/
@client.command(name="give", aliases = ('send','dash'))
@commands.cooldown(1, 30, commands.cooldowns.BucketType.user)
async def give(ctx, user : discord.Member, amount : int = 0):
await register(ctx.author)
print(1)
await register(user)
print(2)
users = await get_bank_data()
print(3)
bal = users[str(ctx.author.id)]["balance"]
print(4)
if amount > bal:
await ctx.send(embed=discord.Embed(":( poor child. You don't have enough money to give out", color = 0xf5f5dc))
print (6)
elif amount <= 0:
await ctx.send(embed=discord.Embed("Don't be selfish! No negative numbers >:(", color = 0xf5f5dc))
print(7)
else:
await update_bank(user, amount, "balance")
print(8)
await update_bank(ctx.author, -1*amount, "balance")
print(9)
await ctx.send(embed=discord.Embed(description = f"Done! {ctx.author.mention} just gave {user.mention} {amount} :cherries_:", color = 0xf5f5dc))
print(10)
Sweet
wait no... I am trying to take the input from the user after the command !respond... so.. then I am setting db['responding'] = True.
Try checking if that is True then send the message
hmmm ok...
Otherwise send the other message
i tried it before, and im tryin it rn and doesnt work........
so rn its like
async def on_message_edit(before,after):
if before.channel.id == 917179419255250974:
await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )```
but still doesnt work
So what’s wrong?
Cool
Hunter!!! Hi
..
does client.get_channel need to be awaited @maiden fable?
No
yeah that's probably the issue then
Only fetch methods need to be awaited
help
Ok
create a seperate channel variable
What do you need help with
so i dont need the "await" there
and then send it
no
but if u remove await, it won't send so, create a seperate channel variable and then send the message
how to make my bot randomly say something at a random time
but like, i put the variable before the "if before.channel.id == 917179419255250974:" or " await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )" and for what
async def on_message_edit(before,after):
if before.channel.id == 917179419255250974:
await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )```
use random and then use asyncio.sleep() I think or
tasks
like this? @quick gust
if before.channel.id == variable```
I should probably start doing discord bots again
enough adventuring on Tkinter for a day
or like
await variable.send(f'{after.content}\n \n Editado por: {before.author}' )```
variable = client.get_channel(id)
await variable.send("whatever")
yep
but like it works iff it doesnt have the "if"
I need help
no
how do you think the xp levelling system should work
@velvet tinsel It is working... I changed the code a little bit... though... This is the code ^
let me show what i meant
well I have to go right now
sweet
this works
async def on_message_edit(before,after):
await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )```
okay then what's the problem?
this doensnt work
async def on_message_edit(before,after):
if before.channel.id == 917179419255250974:
await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )```
thats the problem
then the channel ID is probably not that
it is
k
print the both of IDs before if statement as well?
otherwise try printing before.channel.id and see what it shows
yeah
still doesnt
do that
!indent
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
?
!d discord.ext.tasks
No documentation found for the requested symbol.
What’s that profile sarthak
when I am running my bot i am getting this error... I am new to discord bots... so... can anyone help me with this? I am not able to run my bot...
if str(before.channel) in channel2: ```
this worked in a message event, but its not working on a message edition event, and its exactly the same
??????????????????????
is it the before.channel?
get rate limited
replit uses shared IP, that means if a replit user got banned from discord API (rate limited), then everyone using the same IP (including you) will got ban also.
not true
hmm so what should I do?
im using replit right now, im not banned though
it is true
then u r just lucky (:
cause they got multiple machines
like google has like hundreds of machine in your country
very
more than a thousands
so... what should I do to get unbanned
yea maybe
so like its rare for people to get banned if one person got banned
since it has lots of databases
if one person gets banned on a machine, everyone on that machine will get banned
- Wait
- Go to another IDE and run it from there
hmmm another ide? that will alter the code... like.. I mean I am using database in replit... so..
if they have > 100 machines then yes. Lower than that no
hm
database?
machines i meant
ah yea
so... should I create a new account? or something?
in replit?
i dont think that'll solve it
that's the problem, once you use replit database then you cant migrate your bot anywhere
Can someone help me its giving me this error
async def on_message_edit(before,after):
await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )
channel2 = [":page_with_curl:・central"]
if str(before.channel) in channel2:
if before.channel.id == 917179419255250974:```
i cant still find out whats the error there
!indent
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
your indent
since i used the same method on message event
https://i.capy.host/1EV4k6GB You've got an unexpected indentation here.
ik, but i havent fin out why and how can i solve it
hmmm... yeah... so @visual island or @boreal ravine, will making a new account work... cause... the changing of database is like not possible it will take double of the time...
print("Hello") # Correct
print("World") # Unexpected indentation
# However...
if True:
print("World") # This is correct
i have the same thing on my program above and it works so idk why
I just explained it twice.
new database will probably solve it but i dont think you can move the database to the new project can you?
it works here
async def on_message(message):
channel1 = [":page_with_curl:・central"]
content = message.content
author = str(message.author)
if message.author == client.user:
return
(the rest off the program wich includes more if's)```
They can get each field and its value from the current database and create new ones on the new database.
Just loop through it using a for loop.
https://i.capy.host/26iDt4ln here, they're all on one indentation level.
https://i.capy.host/1EV4k6GB here, there's an unexpected indentation.
!e
print("Hello")
print("World")
@dapper cobalt :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | print("World")
003 | IndentationError: unexpected indent
!e
print("Hello")
print("World")
@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.
001 | Hello
002 | World
Not on the correct and same level.
On the correct level.
!e
print('Hello'); print('World')
``` saves one line
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
001 | Hello
002 | World
PythonScript? Haha
lmao
!e
exec("print('saves nothing')")
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
saves nothing
:skull;
Failed attempt to use an emoji
🕴️
say "aye" if you use await bot.get_channel or say "cool" if you use bot.get_channel
async def on_message_edit(before,after):
channel2 = [":page_with_curl:・central"]
if str(before.channel) in channel2:
await client.get_channel(918425787420508170).send(f'{after.content}\n \n Editado por: {before.author}' )```
cool
no.. u cant... and btw did you mean new account or database?
then explain me why this doesnt work
idk what else 2 do, i tried so much things and still doesnt work
client.get_channel is already await 🕴️
without the await
rly
it's still awaited
let me try
but the .send() won't work, but ngaf so make your client.get_channel() into a var
and then do <variablename>.send("msg here")
still doesnt work
async def on_message_edit(before,after):
channel2 = [":page_with_curl:・central"]
if str(before.channel) in channel2:
channel3 = client.get_channel(918425787420508170)
channel3.send(f'{after.content}\n \n Editado por: {before.author}' )```
You can. #discord-bots message
does it have to await before "channel3.send()"?
should i make a leaderboard command for my xp system
?
L
send is a coro. You forgot to await it.
How does your levelling system work
I don’t know how it should work
whats a coro sounds wierd i saw in discorfd.py
ok, ill try it out
using a database
I was thinking of adding 10 xp each time you comment but that doesn’t work I think
its pretty simple
why wouldn't it?
An async function.
I know how it works I don’t know how it should be working…wait…that doesn’t make sense
you could in theory use replit db for a levelling system too 🤔
Eh people can just spam
slowmode ¯_(ツ)_/¯
i did it but its still not responding to a message edit on that channel or else
async def on_message_edit(before,after):
channel2 = [":page_with_curl:・central"]
if str(before.channel) in channel2:
channel3 = client.get_channel(918425787420508170)
await channel3.send(f'{after.content}\n \n Editado por: {before.author}' )```
before.channel.name
and i dont really think spamming is much of an issue tbh
yep
RIP your nitro
i add xp on every message
Ok
k
still not working, or should i keep the str(before.channel.name)?
if before.channel.name in channel2:
Me too
Print before.channel.name.
what is it showing?
nothing
any error?
hmm
an error or whatsoever
And I prefer you change channel2 to a string that's equal to what you have there, and check if before.channel.name == channel2.
Try printing before.channel.name.
still not working
What is not working?
like it doesnt register the edited message from the specific channel in the channel i want
What’s wrong 😭
db = {}
db['levels'] = {}
@bot.event
async def on_message(msg):
db['levels'][str(msg.author.id)] = {}
db['levels'][str(msg.author.id)]['xp'] += 10
``` ~~not a good way to make a level system but eh~~
No
Add a print system at the start of your event, see if your event is triggered at all.
ahahah
Put it in different intervals
And print what’s happening if it does it
then why did you ask earlier 🤔
That'll just reset the user's xp everytime.
You need to check first whether they already exist in the db or not.
It’s just I don’t know how it should work
Add 10xp each time someone comments?
🤔 or what
yes
Ok then
but didnt register it
thats the point, it was just an example
try:
db["levels"][str(msg.author.id)]["xp"] += 10
except KeyError:
db["levels"][str(msg.author.id)] = {}
db["levels"][str(msg.author.id)]["xp"] = 10
easier
it does print the "a"
I prefer double quotes, they look more containing for me. It doesn't really matter eitherway.
but doesnt respond to the if comand
I like double tbh
!e
data = {}
print(data["life"])
@dapper cobalt :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | KeyError: 'life'
Me too
im tryin this for hours
😂
Same
im still cant do this thing...
Single quotes look ugly

And even the shift key is near the quote key so yh
what makes this happen? https://paste.pythondiscord.com/efegagetas.sql
single quotes are meant for character type data in many languages lol , they look good with them
The cog path is invalid
Eh, yeah I guess
I made a test and
async def on_message_edit(before,after):
print('a')
channel2 = [":page_with_curl:・central"]
channel3 = client.get_channel(918425787420508170)
await channel3.send(f'{after.content}\n \n Editado por: {before.author}' )```
that part works wonders but this doenst
```@client.event
async def on_message_edit(before,after):
print('a')
channel2 = [":page_with_curl:・central"]
channel3 = client.get_channel(918425787420508170)
await channel3.send(f'{after.content}\n \n Editado por: {before.author}' )
if str(before.channel.name) in str(channel2):
channel3 = client.get_channel(918425787420508170)
await channel3.send(f'{after.content}\n \n Editado por: {before.author}' )```
eh... this is about sqlite
how to create a row with system like...
def add(name):
conn.execute("INSERT INTO users data (NAME,COIN,EXP,MAX_EXP)
VALUES ('(that name from def)', 25, 0, 125 )");
I’m having a headache looking at all the code
My mobile phone is too small
I can’t wait to play splitgate 😩
Ah, here's the issue. You're using the emoji :like_this:. You should use the unicode of the emoji instead.
it's half spanish-
Holidays are soooo near
😭
\📃
go go go my school just in 2 days
That's the emoji you'd need.
but why does it work here then? (let me get it)
...?
Splitgatteee I’m coming
ah there was also a similar command in there which caused the error
I saw it after it got fixed path
async def on_message(message):
channel1 = [":page_with_curl:・central"]
content = message.content
author = str(message.author)
if message.author == client.user:
return
#other ifs in between
if str(message.channel) in channel1:
message.channel = client.get_channel(918425787420508170)
await message.channel.send(f"{str(content)}\n \n Escrito por: {author}")```
Replace :page_with_curl: with \📃
where u gonna play it? windows or xbox or PS4?
like i dont get it
Windows
lolk
We’re getting off topic
That's a Discord emoji, not a default system's emoji.
LOL so true
i have it like that alr
Also, why do you have channel2 as an array and not just a string?
so how can i do it
replit goes brr
yes XD
hmm
quit replit as fast as possible u can
Why aren't you using id of channel2 instead of its name?
because it didnt work asweel
why?
bhre too much error and the database don't even friggn support url smth (i quit yesterday)
hm, i might change later iff i have those problems
@client.event
async def on_message_edit(before,after):
channel2 = "📃・central"
channel3 = client.get_channel(918425787420508170)
if before.channel.name == channel2:
await channel3.send(f'{after.content}\n \n Editado por: {before.author}' )
u litterally have that error
Host it.
Yes
and it does work
Use a hosting service, or buy a vps.
LOL u think they support hosting?
Every free hosting service is trash
keep ur PC online
yep
ik thats why i use replit
but smh it doesnt work
asdmasmdaskasfkskak
https://i.capy.host/edaWH6x4 I do not think so.
my brain is dying atm
LMFAO yes, it doesn't work, finnaly u understand
idk what 2 do
Self h0st
Oh noice
i use a portable computer, and im on college so its rly anoying
i need it running perm.
Then, use a hosting service.
wat is this
The problem was something else now we're taking about something else
yep XD
Yes
ok, imma leave this here, pls help
@dapper cobalt can u help me wth the free host? and explain me how it works?
or how could i make it work
They have a full guide.
hm...
Free and paid hosting
.bm
thx imma check it out
What was the epikhost you were talking about cyberweapon?
No problem.
I personally prefer sneakyhub as host
Uh help?
It’s not related to discord bots
What is this?
rate my replit uptime
It’s not related to discord bots
Just press resend
And it’s not related to discord bots
I did. Not working
A screenshot.
lol
oh replit? 10/10 dude
Check your email. And click on verify
As a former replit user, 8/10
Ah, I did not see that at the bottom. You need to verify your email address.
use Flask
Can you send me more server related to discord.py
Replit lmao
My bot is online from 2 weeks'
i actually just restarted the bot 💀
Nvm key sent it
why?
Don’t ask how though
What
😳 we don’t talk about that
k
that is litteraly the longest uptime i ever seen (my bot just can run for littraly 20 minutes and boom "working (rwplit user must be know what is this about)")
But I should look at the disnake server
Getting banned in discord.py server is easier than adding python to PATH,bet
i think i was banned for shitposting
Yeah simple
It’s easier than just printing hello world
I didn’t even last 3 hours in that server lmao
I should join disnake server ;; they may be nicer
what does this part mean (when it requires login)
a simple tutorial how to get banned in every python server:
- ask for tutorial of javascript
- spam it
Oh sh
No
You'll join the support server.
We do not have a panel yet, so you'd have to join anyway.
can I deny their access to my profile after?
Nahhh it’s simpler than that
we? you own it?
I'm a staff there.
😳 probably
oh nice
Sweet
don't think so , youll need to visit their afk page occasionally
for points
I need points to host..?
Ok
I need help
Nice
.... no one helping me, now my question burried up there
what is it?
Ain't a hard task , and it's free...
You just keep the page open for some mins and get points
wait a minute 🙂 burried in the air lol
wait, lemme reply to it
k
Your doubt pls?
or you could use railway
I'll stick with epikhost as it does not require anything
Can anyone send me more coding related servers in my dms
its like heroku, but it doesnt have a 1 month limit so its totally free
Sweet
.bm
here's mah question
.bm
Your input was invalid: You must either provide a valid message to bookmark, or reply to one.
The lookup strategy for a message is as follows (in order):
- Lookup by '{channel ID}-{message ID}' (retrieved by shift-clicking on 'Copy ID')
- Lookup by message ID (the message must be in the context channel)
- Lookup by message URL
Usage:```
.bookmark [target_message] [title=Bookmark]
I can't believe
kinda funny-
Lmao
Can anyone send me more coding related servers in my dms??
i should add this feature to my bot
ye
execute("Insert into users data (name , coin , exp , max_exp) values ( ? , 25 , 0, 125)" , (name))```
sarthak pro sql'er
how question mark work? (and can it work with multiple inputs or just 1)
@client.command(aliases=['rules'])
async def rule(ctx,*,number):
await ctx.send(rules[int(number)-1])
user's data is the table name?
@client.command(aliases=['rules'])
async def rule(ctx,*,number):
await ctx.send(rules[int(number)-1])
any mistake in this?
what
Well, they don't get money from trees.
@slate swan's pfp is an nsfw, why not banned-
teamtrees be like:
You pay 0 cents and get free service, meanwhile they still get money.
I am working hard to make a Whitelist bot
basically , it is replaced by the query you provide ```py
"INSERT INTO table ( attribute1 , attribute2) Values (?,?)" , ( the_first_questionmark_is_replaced_by_the_value_here , and2nd_one_here)```
like, securing a product
how fast do you earn 3000points in avg?
If anyone knows about it Can you help me complete it?
oooooo nice ok ok, understandable, thanks
what is this for-
Product whitelisting
You get 0.17/s.
securing a product
Anyhow, if you want to ask a question about that, just ask it in their support server and not here.
me?
No.
ok
me?
It was for cyber
Anyone knows about Roblox????
ooh so u dk it?
And in that MSI?
u wanna make a roblox game?
no
with python?
Product securing bot
The hardware manufacturer?
Not roblox game
no
you play roblox?
roblox curse word censor?
No
no man
You can't.
child game
lol so what
Roblox uses Lua.
Ik
I am talking about a product securing bot.
Like podtech and Msi bot.
what is the connection
it secures Products
wait, so what app do they use to render in 3D? and multiplayer support
What is the connection between Roblox and the bot you're making
man using roblox saving so much products
They provide a game engine with custom Lua. It can access their services
what's LUA about
It's a programming language
oh
google says it kinda like a C a bit
Nah
It has do and end keywords for loops and statements in general
Other than that it's similar to Python
Of course there are differences
for loops aren't trivial
conn.execute("UPDATE users data set coin = ? where NAME = ?",(amount),(name)) @slate swan is this right?
can give example how LUA looks like?
Put amount and name in the same iterable
conn.execute("UPDATE users data set coin = ? where NAME = ?",(amount,name)) uhhm?
# Python 3
print("Hello World!")
-- Lua
print("Hello World!")
another?
sussy
sup
lol just different from the color
ello
What is users data
I believe it will raise an exception
a table's name
Lua has multi line comments
Like, you are a dev and you sell stuff But you fear about If the product leaks so, I am trying to develop a product securing and whitelist system.
With --[[ and --]] or ]]-- I forgot
Shouldn't it be one word
oh ok
Oh and one thing that makes Lua unique is that index starts at 1
then why roblox
But I believe 0 is understood and interpreted the same
while python starts from 0?
Nearly every language does
It's a convention based of pointer math (first element is pointed to by ptr, so to access it you will just dereference which 0 has no effect on)
But 1 will move to the next element
conn.execute("UPDATE users_data set coin = ? where NAME = ?",(coin+amount,name)) can it be like this? (coin is from the coin = ?)
binnary be like
Yes but validate the name of the table matches what you have
eh...? what?
Do you have a table named exactly users_data
yes
oh, so it will work like:
update coin amount in users_data by coin+amount
this?
hmm @west shuttle is this new guy?
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'
wat
my first time see u lol
Oh lol
😄 nice, we struggle with some problem
i'm also sturggle with sqlite lol
Im using aiosqlite which using file extension .db and not .sqlite
It's more like
UPDATE TABLE users_data:
SET coin TO coin + amount
WHERE NAME = name
Do you know about MSI?
in Roblox
Bruh
Probably not
So, yea
Like, you are a dev and you sell stuff But you fear about If the product leaks so, I am trying to develop a product securing and whitelist system.
I need help making a bot like this.
ummmm what?
You need to use a fetching method on thanks as queries return a cursor object
breh sqlite also use .db extension
To understand more better I can show you some videos.'
Pseudo translation
Security is managed by the company
So i need to do
await self.db.fetchone . . .
heres my code
for i in range(len(users[str(ctx.author.id)]["inventory"])):
if things in users[str(ctx.author.id)]["inventory"][i]["name"]:
users[str(ctx.author.id)]["inventory"][i]["count"] += 1
break
and heres the error it shows:
i think i understand why it says this, but how else can i rephrase it so the error doesnt show
await thanks.fetchone()
After you set it to the query's cursor, obviously
ehhhh
this is from code:
def add_coin(name, amount):
conn.execute("UPDATE users data set coin = ? where NAME = ?", (coin+amount, name))
Oh so you want to increment that field by amount?
yes
wdym
where is @upbeat otter he's often active at this time
In the query, use SET coin = coin + ?, and only put amount (without coin+) in the first query variable
def add_coin(name, amount):
conn.execute("UPDATE users data set coin = coin + ? where NAME = ?", (amount, name))
Yes
ok, thanjs :3
help
@brazen raft
da hell is this
idek whut i wrote too 😭
things is a dictionary of values?
You need to fetch the data from the resulting query you have for thanks there
kind of
You should probably write an API for your program, simply, a set of functions for working with your data safely and easily
Ummmmmm can u send API or smth?
did you just assume my gender ,-, I have a maths exam tomorrow, cant help it
how do i do that-
whats the issue?
so u r a girl?
What's the right operand in the if statement? A value? Maybe you need to switch them
maybe
xd
Write functions
hehe am happy someone atleast remembers me
why not write functions in another file and use them
anyways, You dont need an API if you are smart enough
C:
Read the documentations for the library you are using
what's the exam about
maths
breh ik, but WHAT? algebra? multiplication? or what E
aww, I hope it goes well for you :D
Factorisation and data handling
breh, u in phone? when autoturn to emoji in PC can be disabled
lol go to #databases maybe they can help xd
this will not work ,-,
then what do i do?? 😭
Anyone using py-cord here
you need to write a different logic
Laptop
no thanks
oof
why though?
how
wait how then it doesn't turn into 😄 ?
to check if the things are there
also need help this
Settings >
code?
what the- IT'S EXIST??
mhm
You can't just type hint command parameters as you like, you need to provide an interface to convert the values to the type you need yourself
Want to suggest and discuss something , || Read about me in my profile||
that's advertising ngl
With an entire class and everything
@bot.command()
async def start(ctx):
name = ctx.author
database.add(name)
await ctx.send(f"added {ctx.author} C:")
^ start (for register)
def add(name):
conn.execute("INSERT INTO users_data (NAME,COIN,EXP,MAX_EXP)
VALUES (?, 25, 0, 125 )", (name))
^database, add name
!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?
That's why I'm not sending anything though 😶
.......?
good
send an ss if you can
Hmm
Are you doing something like
def cool_command(ctx, param: MyOwnCoolClass):
...
ss of what?
You can actually contribute to their repo
but there is no param there.....??
code
code of what ;-;
the part where you are getting the error obv
Ya, but not interested
huh
no hint....
yee, but idk where is the error happen :l
everything from line 1 to line 20
send an ss of that
database
main.py part 1
part 2
sup @quick gust
where strikethrough lol
You need (name,), not (name)
what..?
in your name function...
Tuple literals with one item must have a comma
the last word
.... i have a comma there??
I asked 1 to 2 contributers in that repo
But, they said it will become easy to all coders, and some will use it blindly not knowing how it works
bot where
huhhhh
lol
You are missing a comma in your tuple literal
At the end of your add function
screenshot my problem :l
are you just blindly copying some code?
...,(name)) ?
Yes
sqlite docs ;-;
You need another comma inside the parentheses of name in order to make it a valid tuple, otherwise it's just the string expression it is
and the fixed one?
what? what?
lmao
Just Google about one item long tuple literals
?
Ya
See? You need another comma in the parentheses
discord.py
poor little danny got angry and left
ooh ok ok, thanks @quick gust and u
Maybe because py-cord is best for buttons and menus
not really
It's just not worth it of the development
Oh
who can tell me what's the full story? maybe i can join him
cant argue
sup
nothing
I guess they are going to remove some bot features? or smth i dont for sure
why not
ah frig NOOOOOOOOOOO how's my bot gonna life now ;-;
this is the reason
big F
will other libs have to write the whole dpy again :/
every other repo is based on dpy 2.0 so uhh
Icy writing an essay?
hmmm, ig i started to understand what happen
danny make discord.py, but discord creator (or smth) wanna update the discord's api with replaced all of the API that kinda oppositing discord.py's system, then Danny ragequit and never work on it again
is that true?
