#discord-bots
1 messages · Page 62 of 1
Yo ✌️
Doesn't discord handle where those things have to appear based on screen size, idk tbh
no
add \n in the param input
Get on phone and type
hey 9047064c7ec960627a11743bfa49b0af3e8dd702ef771cec3e908b5cd28b477e how are you?
For some reason it works
Hello 952f77a6916584933cb0787ff92f09233de22a480b2eff1cb4bcddc591db4711 I am fine
Good
why on phone i can do enter but on computer i cant :c
I'm writing a Discord file extension autoreloader (it reload extension file if changes were made)
Discord grass
discord's skill issue
!d discord.Guild.created_at
property created_at```
Returns the guild’s creation time in UTC.
Dude... cloudflare is being weird
Not the first time
What the fuck
Uh
Lmao
,
Saw that
Same
Mods*
Lmaoo
Damn autocorrect
nice
?
Hunter is so smart and kind
Um, actually, the code on your PFP doesn't work unless the function sad() returns different types, in condition you are comparing it to a bool, consequently the return type of the function sad() must be bool as well, but in the next line you call stop() method on presumed bool which will cause AttributeError. Also, according to PEP 8 you should compare to bools with is 🤓
I nerded
PoV: It's a class instance with a __call__ and __bool__ dunder implemented
And.... yea, that doesn't make any sense
i need help w/ select menus. ive tried a million different codes, i searched and nothing has worked
Have you checked examples on official repo
IS THIS RIGHT CODE
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = "command_prefix", intents=discord.Intents.all())
@client.event
async def on_ready():
print("BOT IS READY")
@client.event
async def on_message(mssg):
if message.author == client.user:
return
if message.content.startswith("HELLO"):
await message.channel.send("HELLO")
client.run("TOKEN")
Kinda but formatting is cringe
what's that- sorry, i code in my free time im not very good at it 💀
i know basic commands and permissions etc
!d discord.Guild.created_at
property created_at```
Returns the guild’s creation time in UTC.
How can I make it so the status is determined by an argument when making the bot variable?
bot = commands.Bot(command_prefix="?", status=discord.Status.sys.argv[1])
oh that
For my knowledge you can't get specifically discord.py enum object by its numeric value so you can use a dict where some strings/numbers are keys and enum objects are values
yes, i did but i dont understand it
How can I do that?
For example
d = {"idle": discord.Status.idle, "dnd": discord.Status.dnd}
try:
status = d[sys.argv[1].lower()]
except KeyError:
print("Such status doesn't exist")
sys.exit(1)```
Does anyobody know a command handler for interactions so that i can make a commands folder for every single command
And the status will be enum object you can use
Alright thanks
What
what?
I didn't understand what you mean
what did you not understand?
Entire thing
How can you store commands in a folder
The command is code, code must be in file, not in folder
And the commands are organised into cogs
how do i add a selectmenu to this?
async def _help(ctx: SlashContext):
embed = discord.Embed(title="Help Menu", description="To find the help you're looking for, look below in the dropdown menu and select the help you need!", colour=0xFF4C4C)
await ctx.send(content="The help menu is shown below!", embeds=[embed])```
👍
epik
How do I mention 2 different users? I'm stumped. Tried different stuff but I couldn't figure it out. Here's the code:
@commands.command(name="pat")
async def Pat(self, ctx, *, Target: disnake.Member):
Pat_Url= "https://purrbot.site/api/img/sfw/pat/gif", "https://purrbot.site/api/img/sfw/pat/gif"
async with request("GET", random.choice(Pat_Url), headers={}) as response:
if response.status == 200:
data = await response.json()
Pat_Url= data["link"]
embed = disnake.Embed(title="Awwww",
description=f"**{Target.mention} is patting {Target.mention}!**",
colour = disnake.Colour.random())
embed.set_image(url=Pat_Url)
await ctx.send(embed=embed)
— I'm still starting out so go easy on me 
ok
why
no
ok
They stopped with that
what
oh
Can you show me the help command definition?
It looks like it’s not registering as a command
help is an inbuilt python function..
Name the function _help and set the name kwarg in the decorator to help
i already deleted the nextcord help command
No he means in regular python
@rugged tulip
No i mean in nextcord
he not you
oh
!d help
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
Name the function _help and change the name kwarg to register it seperately, then do @_help.command
nvm it works
I think this is a lib
i did something very dumb
Oh
!e help()
@cold sonnet :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'help' is not defined
Guys?
who do you want the second user to be? author?
Yup
So, this?
yea
Ah, alr. Gotchu. Thanks!
hello
i have a file named math.py
and one named main.py
i did
from math import *
can anyone help
math is a stdlib module
oh
So you can’t import the file
i have to rename?
or just from .math import * 
I don’t think that will work
ye you cant
it will get this error
ImportError: attempted relative import with no known parent package
Since its not a package
btw if i want to import does it have to be in the same file
to make relative imports, you need to run the whole directory
No
i mean like fully
gone
but luckily i saved my files in replit
anyways
it still doesnt work
@quaint epoch
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = "command_prefix", intents=discord.Intents.all())
@client.event
async def on_ready():
print("BOT IS READY")
@client.event
async def on_message(mssg):
if message.author == client.user:
return
if message.content.startswith("HELLO"):
await message.channel.send("HELLO")
client.run("TOKEN")
is any thing wrong with this
is there an error?
the parameter is called mssg
yes'
you are using message.stuff
can you tell us it
its visible bro
i have this thing
can you make a bot that makes accounts for you
probably with proxies
can you make a bot that makes accounts for you
howwwwwwwwwwwwww
alr
and can you make a discord bot do anything
alr because im new so i might be asking alot of things
where does it say anything about welcome
np
You cant view .sqlite files from pycharm
how
you can only view .sql files as text
so what do i do?
You can try DB browser for SQLite
i already have that
Its free
so should i remove the sqlite file from there
why dont you use it then
it was working before
just download an extension 
no you can leave it there
it loads it automatically
but you cant read it, or you can try the extension ?
ok
but what are you trying to do exactly ?
oh idk much about discord bots
From pycharm professional you can
Try explicitly saving the file or restarting pycharm
yeah but it costs
I have infinite free licenses
I'm making a discord bot but it only works for one server right now, how do I make it so if it is paused on one server it doesn't pause for the other. Sorry if this sounds dumb
maybe its from the web.py ?
I mean I can get
free
oh lol
Yk jetbrains have partners
By doing some stuff with partners you can get free licenses
For example doing certain courses on stepik
how long do each license last ?
Around 3 months
And how many do you have
Currently 2
ok so you dont have inifinite
Id rather do those tbh.
But I can get infinite
I just do courses for some langs and if I am not in a mood I just speedrun "python for beginners" lmao
And are the courses free ?
Yes
damn you got smth going on there
What are those
Youre welcome!
Open source software
They give licenses too?
Yea
Ok cool ima check them out
They have licenses for students, oss, etc
Ah so they require verification?
You just apply and tell them about a open source project you want to apply for and it takes two days for them to process and bam done
Nice
Idk about students. But for oss they just ask for a link of the GitHub repo
no i fixed it now
please please please someone help
class WelCog(commands.Cog, name='Welcome') :
def __init__(self,bot):
self.bot = bot
@commands.Cog.listener()
async def on_member_join(self,member):
wel = discord.Embed(color=0x0ff7d, description=str(result1[0]).format(members=members, mention=mention, user=user, guild=guild))
wel.set_thumbnail(url=f"{member.avatar_url}")
wel.set_author(name=f"{member.name}", icon_url=f"{member.avatar_url}")
wel.set_author(name=f"{member.guild}", icon_url=f"{member.guild.icon_url}")
channel = self.bot.get_channel(id=int(result[0]))
await channel.send(embed=embed)
@commands.group(invoke_without_command=True)
async def welcome(self, ctx):
await ctx.send('Available setup commands: \nWelcome Channel <#channel>\nwelcome text <message>')
@welcome.command()
async def channel(self, ctx, channel:discord.TextChannel):
if ctx.message.author.guild_permissions.manage_messages:
db = sqlite3.connect('main.sqlite')
cursor = db.cursor()
cursor.execute(f'SELECT channel_id FROM main WHERE guild_id = {ctx.guild.id}')
result = cursor.fetchone()
if result is None:
sql = ("INSERT INTO main(guild_id, channel_id) VALUES(?, ?)")
val = (ctx.guild.id, channel.id)
await ctx.send(f"Channel has been set to {channel.mention}")
elif result != None:
sql = ("UPDATE main SET channel_id = ? WHERE guild_id = ?")
val = (channel.id, ctx.guild.id)
await ctx.send(f"Channel has been updated to {channel.mention}")
cursor.execute(sql, val)
db.commit()
cursor.close()
db.close()
def setup(bot):
bot.add_cog(WelcomeCog(bot))
print('Welcome has been loaded')```
Error?
ctrl+shift+F10
thats the code
when i do .welcome i get this error
discord.ext.commands.errors.CommandNotFound: Command "welcome" is not found
its alr i fixed it but ty
Btw setup function must be async if you are on dpy 2.0
[2022-08-27 16:40:36] [ERROR ] discord.ext.commands.bot: Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "spotify" is not found
oh
how do i make it into a command`
You can find an example on my gist
Your code is probably getting blocked somewhere which you mean by 'paused'. Read here https://discordpy.readthedocs.io/en/stable/faq.html#what-does-blocking-mean
the last 3 lines?
@bot.event
async def on_ready():
' print("The bot is ready!")
@bot.command(pass_context = True)
async def randomnumber(ctx):
embed = discord.Embed(title = "Random Number", description = (random.randint(1, 101)), color = (0xF85252))
await ctx.send(embed = embed)
@bot.command(pass_context=True)
async def gen(ctx, *, message, requests=None):
if message == "spotify" or message == "SPOTIFY" or message == "Spotify":
accs = []
file = read(f"database/1.txt").split()
for line in file:
accs.append(line)
accs.pop(0)
file = open("database/1.txt", "w")
for item in accs:
file.write(item + "\n")
l = requests.post("https://hastebin.com/documents", data=acc)
link = "https://hastebin.com/" + l.json(['key'])
alias = randint(1, 9999999999999)
r = requests.get(f"https://shrinkme.io/api?api=6dc4f985e980f70eaafdd155fe747a35bdee1fed&url=(link)&alias={alias}")
await ctx.send(f"Spotify account generated - (r.json()['shortenedUrl'])")
'
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I'm currently on phone so can't send the link to it
why?
Yes
!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.
this wont work when i do' !spotify' and more.
i dont have all bc of the token in it
bit it sayd '[2022-08-27 16:40:36] [ERROR ] discord.ext.commands.bot: Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "spotify" is not found
'
i got these two errors btw
!code plsplspls
ok
You don't have any command named spotify
you define the variables before its assignment meaning its not defined
they are defined here
sql = ("INSERT INTO main(guild_id, channel_id) VALUES(?, ?)")
val = (ctx.guild.id, channel.id)
await ctx.send(f"Channel has been set to {channel.mention}")
elif result != None:
sql = ("UPDATE main SET channel_id = ? WHERE guild_id = ?")
val = (channel.id, ctx.guild.id)
await ctx.send(f"Channel has been updated to {channel.mention}")
cursor.execute(sql, val)
db.commit()
cursor.close()
db.close()```
it is
PEP 8
whats that lol
ik that would be the response
!e
def a() -> None:
print(b)
b = 1
a()
@primal token :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | File "<string>", line 2, in a
004 | UnboundLocalError: cannot access local variable 'b' where it is not associated with a value
If the if construction is not executed the variable sql will be undefined
oh ok
You gotta define it anyway
it still says welcome isnt a command
i meant command
async def welcome(self, ctx):
await ctx.send('Available setup commands: \nWelcome Channel <#channel>\nwelcome text <message>')```
bot.add_cog(WelcomeCog(bot))
print('Welcome has been loaded')
it is in the main file
await bot.add_cog!!!
whats it supposed to be
!d discord.ext.commands.Bot.add_cog
await add_cog(cog, /, *, override=False, guild=..., guilds=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a “cog” to the bot.
A cog is a class that has its own event listeners and commands.
If the cog is a [`app_commands.Group`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.Group "discord.app_commands.Group") then it is added to the bot’s [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") as well.
Note
Exceptions raised inside a [`Cog`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Cog "discord.ext.commands.Cog")’s [`cog_load()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Cog.cog_load "discord.ext.commands.Cog.cog_load") method will be propagated to the caller...
Yea, u gotta await it
Weird that u didn't get a warning on startup tho
Or u ignored it 👀
What
i didnt
The hell
i never ignore em
v2.0
You have to await it?
then that means that cog file isn't even being accessed
why it needs to be async
Yea, v2.0 is cursed
God
how
import random
import discord
import asyncio
from discord.ext import commands
prefix = "!"
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
token = ''
@bot.event
async def on_ready():
print("The bot is ready!")
@bot.command(pass_context = True)
async def randomnumber(ctx):
embed = discord.Embed(title = "Random Number", description = (random.randint(1, 101)), color = (0xF85252))
await ctx.send(embed = embed)
@bot.command(pass_context=True)
async def gen(ctx, *, message, requests=None):
if message == "spotify" or message == "SPOTIFY" or message == "Spotify":
accs = []
file = read(f"database/1.txt").split()
for line in file:
accs.append(line)
accs.pop(0)
file = open("database/1.txt", "w")
for item in accs:
file.write(item + "\n")
l = requests.post("https://hastebin.com/documents", data=acc)
link = "https://hastebin.com/" + l.json(['key'])
alias = randint(1, 9999999999999)
r = requests.get(f"https://shrinkme.io/api?api=6dc4f985e980f70eaafdd155fe747a35bdee1fed&url=(link)&alias={alias}")
await ctx.send(f"Spotify account generated - (r.json()['shortenedUrl'])")
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
migrating.html
why wont the command work?
so true
For that, DM @leaden peak
Fuck I thought he wasn't in this server
Sorry Danny
!code I beg
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.
The creator of dpy?
Creator of day iirc
Cache issues
No
it didnt show the name so i asked
Read the emved
!code
i still need help with that thing, its so annoying
kek
how to integrate crypto payment in discord bot ?
you use monkey pictures
Professionally known as NFTs 
so player can buy in game currency with my crypto-token
?
can anyone help me?
hold on guys !!!!!!! ,answer me ?
PyDis's Super Duper Secret Bot Craig 
I told u
so player can buy in game currency with my crypto-token
?
Send your code normally, then I'll try
he does internal recordings lol
well i need to make the command working
Sounds fishy
Thanks slash commands
it sas
Sounds 🐟y
[2022-08-27 16:57:01] [ERROR ] discord.ext.commands.bot: Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "hel" is not found
hel was not found
hell
yah just
do u have ANy idea ?
man wait then im gonna run the real command
Show code
i cant the token
i told you it works see
import random
import discord
import asyncio
from discord.ext import commands
prefix = "!"
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
token = ''
@bot.event
async def on_ready():
print("Successfully logged in as zhs$capx#9502")
@bot.command(pass_context = True)
async def randomnumber(ctx):
embed = discord.Embed(title = "Random Number", description = (random.randint(1, 101)), color = (0xF85252))
await ctx.send(embed = embed)
@bot.command(pass_context=True)
async def gen(ctx, *, message, requests=None):
if message == "spotify" or message == "SPOTIFY" or message == "Spotify":
accs = []
file = read(f"database/1.txt").split()
for line in file:
accs.append(line)
accs.pop(0)
file = open("database/1.txt", "w")
for item in accs:
file.write(item + "\n")
monkey picture person spawned
You could use an API if there is one for that, or make one yourself websockets
LMAO
use codeblocks
!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 are you doing
@royal bone u should just supply yr crypto wallet address and hope that people send u the payment
Its on cooldown
stuff
!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.
NameError: name 'stuff' is not defined
thats crazy!!
import discord
import asyncio
from discord.ext import commands
prefix = "!"
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
token = ''
@bot.event
async def on_ready():
print("Successfully logged in as zhs$capx#9502")
@bot.command(pass_context = True)
async def randomnumber(ctx):
embed = discord.Embed(title = "Random Number", description = (random.randint(1, 101)), color = (0xF85252))
await ctx.send(embed = embed)
@bot.command(pass_context=True)
async def gen(ctx, *, message, requests=None):
if message == "spotify" or message == "SPOTIFY" or message == "Spotify":
accs = []
file = read(f"database/1.txt").split()
for line in file:
accs.append(line)
accs.pop(0)
file = open("database/1.txt", "w")
for item in accs:
file.write(item + "\n")
l = requests.post("https://hastebin.com/documents", data=acc)
link = "https://hastebin.com/" + l.json(['key'])
alias = randint(1, 9999999999999)
r = requests.get(f"https://shrinkme.io/api?api=6dc4f985e980f70eaafdd155fe747a35bdee1fed&url=(link)&alias={alias}")
await ctx.send(f"Spotify account generated - (r.json()['shortenedUrl'])")
bot.run("")```
like this?
turn on the code highlighting too pls
Not py still but ok
pass_context
@slate swan you might wanna help on this one
put a py after ```
import discord
import asyncio
from discord.ext import commands
prefix = "!"
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
token = ''
@bot.event
async def on_ready():
print("Successfully logged in as zhs$capx#9502")
@bot.command(pass_context = True)
async def randomnumber(ctx):
embed = discord.Embed(title = "Random Number", description = (random.randint(1, 101)), color = (0xF85252))
await ctx.send(embed = embed)
@bot.command(pass_context=True)
async def gen(ctx, *, message, requests=None):
if message == "spotify" or message == "SPOTIFY" or message == "Spotify":
accs = []
file = read(f"database/1.txt").split()
for line in file:
accs.append(line)
accs.pop(0)
file = open("database/1.txt", "w")
for item in accs:
file.write(item + "\n")
l = requests.post("https://hastebin.com/documents", data=acc)
link = "https://hastebin.com/" + l.json(['key'])
alias = randint(1, 9999999999999)
r = requests.get(f"https://shrinkme.io/api?api=6dc4f985e980f70eaafdd155fe747a35bdee1fed&url=(link)&alias={alias}")
await ctx.send(f"Spotify account generated - (r.json()['shortenedUrl'])")
bot.run("")```
uh
Enter
without space
oh alr
Enter, new line
dont put it on newline
Use aiohttp, not requests
9999999999999
no one is gonna talk about the nested command?
you tried bro
I saw that
nah wth

wha
import random
import discord
import asyncio
from discord.ext import commands
prefix = "!"
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
token = ''
@bot.event
async def on_ready():
print("Successfully logged in as zhs$capx#9502")
@bot.command(pass_context = True)
async def randomnumber(ctx):
embed = discord.Embed(title = "Random Number", description = (random.randint(1, 101)), color = (0xF85252))
await ctx.send(embed = embed)
@bot.command(pass_context=True)
async def gen(ctx, *, message, requests=None):
if message == "spotify" or message == "SPOTIFY" or message == "Spotify":
accs = []
file = read(f"database/1.txt").split()
for line in file:
accs.append(line)
accs.pop(0)
file = open("database/1.txt", "w")
for item in accs:
file.write(item + "\n")
l = requests.post("https://hastebin.com/documents", data=acc)
link = "https://hastebin.com/" + l.json(['key'])
alias = randint(1, 9999999999999)
r = requests.get(f"https://shrinkme.io/api?api=6dc4f985e980f70eaafdd155fe747a35bdee1fed&url=(link)&alias={alias}")
await ctx.send(f"Spotify account generated - (r.json()['shortenedUrl'])")
bot.run("")
better

yeah so theres no command named hel
Mobile Client Moment
master is slow like windows level slow
is it possible to make messages when booting the server?
you need to make a command named hel
nah i know but i just took some random before, it wont work with spotify either
Me is on phone
ok
how do i make the command then? kind of new to discord bot
Learn python ig
@bot.command()
async def hel(ctx, ...):
...
I think im going to leave this madness, maybe @grim oar which he is highly qualified can help you
😳
Stereo Madness btw
fix what
is it possible to make messages when booting the server?
show full error
How do I make arguments with labels?
Your connection is already done you don't need await connection()
blame this dude @elfin island
We. Need. An. Answer.
this wont work
anad
where u put "hel" is where i change the command?
Ah no I'm not gonna help with that on phone
I need it because I have a bunch of optional arguments
Poor Anand don't blame 😭
no he sucks!! i should be helper in place of him!!
No 😡
😔
vouch
No use
There is a civil fight going on rn
okimii would've been the best helper
Well, he left
true
nova you shouldnt be a helper you should be an admin
So we don't talk about it
Yes so unfortunate that okimii left...
i should be an owner and ban a certain admin
Nova that admin is going to perma ban u
You always talk about this admin????💀
Nova the command wont wok,can u help me so when i say !spotify it answers and no errors
yes
show what you did
hell
huh?
should i change hel to "spotify"
aah i am not sure what you asking
i wanna make the spotify command work
U don't have it
where even is spotify command
nova you literally recommended him to make a command named hel
he came up with this so i assumed he wanted to make a command named "hel"

Mornin
import discord
import asyncio
from discord.ext import commands
prefix = "!"
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
token = ''
@bot.event
async def on_ready():
print("Successfully logged in as zhs$capx#9502")
@bot.command(pass_context = True)
@bot.command()
async def hel(ctx, ...):
async def randomnumber(ctx):
embed = discord.Embed(title = "Random Number", description = (random.randint(1, 101)), color = (0xF85252))
await ctx.send(embed = embed)
@bot.command(pass_context=True)
async def gen(ctx, *, message, requests=None):
if message == "spotify" or message == "SPOTIFY" or message == "Spotify":
accs = []
file = read(f"database/1.txt").split()```
brah
What’s the problem?
what should i change? havent touched the think u sent to me Nova
everything there is a problem
Don’t use a text file for a database lol
double registering and nested commands🙈
- actually attempt to code the Spotify command, done expect spoon feeding
Oh what the hell
you should consider learning python bruh
^
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
wont take long!
Everything was going South because you weren't here
hm alright then
Good morning hunter
Morning
the worst lie ive seen from you today
people dont learn cause they think shit takes too long, lying like that makes them actually learn faster
it makes them think they process information slowly when the topic is huge especially for advanced topics that may take time so saying that is just a big lie
Basic Python with enough knowledge to make a simple Spotify command shouldn’t take that long tbf
placebo
who accepts the fact that they are seriously slow lol, negative motivation always works
if they actually want to learn how to make a discord bot then the process would take time
😼 thats my opinion tbh, no need to fight over it
123456 thousand years
literally everyone? dont you think people are like "dang i learn very slowly" when the topic is huge, people just want to be like others in a few months when it took 1 or more years for experienced people to be at that level
you wouldn't understand either way
slow is not an absolute term dude, we can create an environment where even learning within a week is slow as fuck ;) but in reality it isnt.
that word is always used relatively if you have ever noticed
someone being slow is something subjective per person so being slow or not really depends on the person's view
person's view depends on the environment in which they are in
It is mostly used comparing to ur own view of what is fast and what is slow
im just saying giving a person false hope that its going to take no time is nice until the person gets a headache and thinks hes stupid
😎 its not false at all.
^
he should think of himself as stupid, thats what drives them into learning even more and faster!!!
I already gave my point, if you dont care cool we can change thentopic if you would like
I’ve been making discord bots for like 2 years
3 for me
1 lol
😳
For real moment?
your stand on things is questionable, i wont change it becsuse its your opinion either way
I basically learned my Python from making discord bots, sadly
The same...
I started off watching discord bot tutorials
so is yours lmao
I dont see how its questionable but its your opinion
At least the ones I watched weren’t using .format
Look, I'm always down for a productive debate. But I think this one has run it's course and is a back and forth, we aren't getting anywhere
What debate?
I started with a text tutorial on habr, dad sent me it, then after some time I also got to yt tutorials
Yup we are the same
Also a lot of googling
It's a draw, by threefold repetition rule
Stackoverflow 😻
Yeysyeysysysya
Is it possible to not use it?
Yeah
Okimii and sarth
Okimii is no longer here 😢
Also lots of bad code tbh
Where is okimii??
He left discord and all socials
I used to be a good friend of him and we haven't talked in quite some time now
He was a really good friend
😭😭😭
hehe
Just like dpy
?????
im pretty sure Nova is okimiis alt
😼
What are you laughing about
kek
I used to work in shifts with him LOL, I helped until I went to sleep and when I did I tagged him and he pretty much helped till I was awake
This is not funny
Its getting a bit off topic though
He helped a lot
What makes you think this
its a joke, nova isnt charming
Don’t joke about that 😔
Guys you're gonna have to move this conversation somewhere else, mods won't be happy
either way i know its not him because hes never coming back and i guarantee you that
Who cares, it's okimii(((
¯_(ツ)_/¯
...
What makes you think that
because i know it lol
How
Dude how about you guys move this convo somewhere else, people are requiring help. Move to dms or general or sum
ive said this many times, i knew him personally ans trhst me hes not coming back
I agree
Like irl? Is he good though?
(Not the channel:)
your init has a bot argument that you typehint instead of passing it
lets change the topic 
This is important please tell me he’s okay
bot = commands.Bot
I thought typehints were Just like annotations l
U will het a new error that ur channel is missing
Nah, if you try to ban someone with typehint discord.Member and you don't pass a good argument, it's gonna throw an error
Makes sense
I don't even know if he's trying to use his bot variable or use commands.Bot argument
Channel has to go first I think
Yep
Listen to Bertie though he knows more
I don't like classes that much tbh
Me too
I don't think they meant there
Its usefull within multiple files but its a no go for me in 1 file
Okimii was teaching me oop 😢
classes are the best
pythons OOP is lovely
i think you want to do bot: commands.Bot instead of =
Yeah…
I keep forgetting what OOP stands for LOL
kek
object oriented programming
File "/home/container/main.py", line 331, in joinmsg
await interaction.response.send_modal(Modal2())
TypeError: Modal2.__init__() missing 2 required positional arguments: 'bot' and 'channel'
Issue is that you're missing some args in your Modal2() init. You have to provide them for it to actually do something (or at least give you an object)
Mornin Ryuga
Wait what? Was I wrong? Lol
i guess
I need to shut my mouth in classes, I don't have enough experience
hi
How are ya
im good 😄
Me too
Just had breakfast 😂
Nice
why do you have channel there?
what are you trying to achieve?
then pass in the channel object in the setup of the cog
You put it there and you need to pass it so it does something.
Again, Modal2() is missing a channel argument, you need to provide it (same way you do with functions)
def setup(bot):
MyCog(<enter your channel object>, bot)
but you are not using the channel so i don't know what you are trying to do with that
oh wait, yea, then just pass in the channel while making the modal
its the same thing
where you are making an instance of the modal...
corey schafer is better imo
that was my first google search result 🤷♂️
kek
that will help you more than me.
at this point I think it's better you go there
async setup
read
yea, i haven't made a bot in ages, m rusty
review on what's in there
oof 💀
it should give you a better understanding of how classes work and so it will help you pass an arg to a constructor (among other things)
you're forced ig
F
doesnt seem very long
2 months is long enough
if you were using github version of dpy then setup was already async
every other fork uses sync setup ( i hope ) 🤷♂️
at this point u are not asking for help u are asking to be spoonfeed
The great spoon
spork is better
hmm
I like forknife
u mean a serrated knife?
same, but mine got auto corrected to fortnite, now i hate it
A fork with sharp edge
Is that mr beast on background
What has happened
so guys
whats the library used for discord bots in python these days
i was there when discord.py was alive
Mostly discord.py but it depends
i heard it died someitme later
yeah but it got resumed kek
oh i didnt hear about that
yeah its actually in pypi
when did it get resumed
!pypi discord.py
wow
i few months ago maybe 3 or 4
5 months around
yep
i started like september of 2020 and then moved to pygame by i think feb 2021
lots of changes be sure to read the migration list
oh im not into python much these days and even if i am its not discord bots so dont worry
either way if youre experienced i wouldnt really use dpy
i would probably just use disnake if you dont want to learn another lib but its still better to use hikari or make your own wrapper🙈
btw you'd need to add one more indent to that
and by required I assume you're still referring to the channel arg
await client.change_presence(status=discord.Status.dnd, activity=discord.Activity(type = discord.activityType.watching, name = ("The Community")))
AttributeError: module 'discord' has no attribute 'activityType'```, any ideas?
the self.add_ part
reason is self doesn't exist at that level so it has to be inside the function for it to get a self (i.e. the instance)
you'd need to put inside your Modal2() thing
Do you have any errors?
does anyone know how to fix my error
discord.ActivityType
works, btw status=discord.Status.dnd this doesnt work
like the status
yeh you could
seems to be the same thing as the inputtext in self.add_item (just without the required=True part)
status=discord.Status.dnd``` doesnt work
it does seem to update the status on my end so not sure here
k
Code?
that's why I told you to indent the self.add_item line
again, self doesn't exist at that level since it's part of the __init__ method
yeah that looks better
Is it possible to see if a user logged in with the generated link and give them extra commands afterwards?
seems that super() line has a space, they have to be at the same level
What for is required kwarg in class
Where will the link be given from
yeh not there
What do you mean with that?
The link is in the Help command and it will lead them to the hosting website where I'm hosting the bot
Alright
For that just implement oauth2 on your site
Check discord dev portal docs, oauth2 section
same error as earlier, you did not provide the channel parameter in your Modal2() call
either that or you can just provide the channel parameter when calling Modal2()
did you go over the article someone sent earlier?
same thing as calling a function
errors?
aight, can you send the callback method inside the modal?
or actually, can you add a print statement just to check whether it's actually being called?
your callback is not a method of the class because its inside __init__
u can call a function on a submit
Dead chat?
ok
ok
uhm by sending it?
it's part of your class, and as others mentioned, it should be indented a level lower (since it's currently part of __init__)
hmm help me
Traceback (most recent call last):
File "/home/runner/mmcbgg/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 190, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 22, in money
cursor.execute(f"SELECT wallet, bank, bank1 FROM mainfdb WHERE user_name = {user.name}")
sqlite3.OperationalError: near "🆆o𝓻𝓵𝓭": syntax error
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/mmcbgg/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 1347, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/mmcbgg/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 986, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/home/runner/mmcbgg/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 199, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: near "🆆o𝓻𝓵𝓭": syntax error
that's not the entire callback method but I can at least tell that bot isn't a variable inside of it so yeah
I have an advice
your method should be part of Modal2 but it's actually part of the __init__ method as others mentioned, what you have to do here is to unindent the entire callback method one level for it to be part of Modal2
use IDs instead of names
names are changeable
IDs will never change
and you won't encounter this error
you'd go back
#databases message this too
oh cool
thanks
i'll try
now this one
no such table mainfdb
it save nothing in it
you still have a bit to go
I don't know shit about replit
uhh wdym with table
yes, 1 indent back
and I like that about me
You don't know what is table?
yope
just started using db
Learn sql
the callback method, not that
ok but what's wrong
There is no table named mainfdb
That is a db itself
Not a table
how to create table
Learn sql
remove the space before the super() thing, again, indentation should be at the same level as other indentation in that area (unless you are starting a new indent block)
Btw that's googleable
gonna mention this as a recommendation but tbh it might help if you go over some of the basics, it will help you understand a lot better what we are doing and it will help in knowing why things happen and how to solve things (like a lot of this) on your own
can we create table on repl?
queck
where am i
Learn sql
ok
why not show me
where are my messages
You won't learn sql
i mean in that picture
where are my messages
only show your messages
What picture
this one
only show the reply
now show my messages
Your messages can be seen as he replied to them showing a little preview of them
uhh idk about that
we can literally see your tag?!?
How do I modify my bot output volume?
it's loud af when it's playing songs
and new ppl who haven't lowered it, get ear damage
disnake
what do i do here? im new to discord.py
uhh how
we're not in the dpy server mate
intents is a required kwarg, the error says it all
intents=discord.Intents.all()
how do i use it?
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
no, don't, he most likely just needs default
faster but it'll get more ram
yeah, you should always keep it as minimalistic as possible
still giving me the error
read them
intents.all will be 15 - 20 mb
my file from 26 mb to 43 mb
what error
we never give you wrong codes
take picture about the error or copy the error if you want to ask
you either choose a bot or a client, not both
hahaha
if you use bot = commands.Bot so don't use client = discord.Client anymore
since you most likely want commands and not only events, you should prefer the bot
client = commands.Bot
fix bot = commands.Bot to client = commands.Bot
then delete the client = discord.Client
OH IT WORKED
just bump your previous message instead of asking it again
NICE
as i said our codes never wrong
only your codes wrong or something not installed
how do i make slash commands, is it hard?
not at all
but you have to manage 2 kind of cmds
1 is normal cmds
2 is /
i don't know a lot because i don't use /
Nah mate
but i wanna use just / tho
some people say to not use commands because they are outdated or smth like that
not really, most wrappers will make it pretty easy on you (for example, hikari and lightbulb or what discord.py has)
the examples for each should give you a decent idea on how
lots of bots still use them
but idk / cmds
maybe you can ask someone else
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
I'd say slash commands are much more user-friendly, since you get to SEE in the textfield what the next argument is
or if the command even exists at all
as a beginner, should i learn it, or stick with commands?
Learn them
do what you want
so called "slash commands" are also commands...
they're called "app commands" in dpy
worth learning
slash
ok so, where do i look for examples? or even get started with it?
Do you know python?
yeah
generally each github repo will have an examples directory you can look for
Do you know dpy in general?
no
Second pin in this channel
uhhhh.....
k ill go take a look, thanks!
but learning python is the first step in your case
also, im getting this, idk how to solve it
..
uhh where's codes
good rule of thumb is to read the errors or warnings you're thrown
i know basic general stuff of python, but not discord.py
Show code
this one is pretty clear if you know what intents are
you should also read text, not only the codeblock
#discord-bots message
yeah lol
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.
I don't use modals, can't say
but to get people to read your help message again, just do this
bump
turn on intents on discord dev
prob someone mentioned it, but as the warning says, you're missing the Message Content intent required to read off message content. You can specify it same say you did with intents.members
as it's a warning, it's safe to ignore but if you're expecting to read message content you'll have to enable it
You don't even need message content intent
how to get the username that used the command?
enable if you need
just a warning only
again, safe to ignore but if you really need it, you also need to specify it inside your code (again, same way you do with intents.members, but with intents.message_content instead)
that's not glitch or error
how exactly would i do that mate?
intents = Intents.default()
intents.members = True
intents.message_content = True
embed = disnake.Embed(title="PROPOZYCJA", description=f"Propozycja użytkownika {user using command}", colour=0xb700fa)
how to do it?
would this part of the code matter?
it'll match all of intents you have so you absolutely need it
i want to put the username there that used the command
something among the lines of ctx.author (if message) or interaction.user (if slash)
oh thanks 😄
i forget
i tried doing that, and it stopped giving me a waring.. it gives an error now
show me error
Read the error
Show
@silk fulcrum
Did u save?
maybe nooo
uhh
guys how could I add slash commands on my discord.py bot
Second pin on this channel
?
Thanks
nothing
just surprise because you like to get pinging
i have so many questions
same bro
same bro
hello
hello
@bot.listen()
async def on_member_join(member):
wel = discord.Embed(color=discord.Color.magenta(), title=f"Welcome {member.name}!", description=f"Welcome {member.mention} If you don't know the commands type in '.help', this will tell you all the commands. I am a math bot so if you ever need help with math, I am the one to use. I can do other things aswell, test me out in. Enjoy your stay!")
wel.set_thumbnail(url={member.avatar.url})
wel.set_author(name={member.name}, icon_url={member.avatar.url})
wel.set_author(name={member.guild}, icon_url={member.guild.icon.url})
await member.send(embed=wel)```
File "C:\Users\Ayman\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Ayman\PycharmProjects\help\main.py", line 211, in on_member_join
wel.set_thumbnail(url={member.avatar.url})
AttributeError: 'NoneType' object has no attribute 'url'```
but it works for
Use display_avatar.url
@bot.command(aliases=['getprofilepic','getprofilepicture','pfp','profilepic','profilepicture','avatar'])
async def getpfp(ctx):
await ctx.send(ctx.author.avatar.url)```
ok thanks
display_avatar is not defined
do i have to do it instead of member
No?
oh
so what do i do
this is my updated code
@bot.listen()
async def on_member_join(member):
wel = discord.Embed(color=discord.Color.magenta(), title=f"Welcome {member.name}!", description=f"Welcome {member.mention} If you don't know the commands type in '.help', this will tell you all the commands. I am a math bot so if you ever need help with math, I am the one to use. I can do other things aswell, test me out in. Enjoy your stay!")
wel.set_thumbnail(url=f"{display_avatar.url}")
wel.set_author(name=f"{member.name}", icon_url=f"{display_avatar.url}")
wel.set_author(name=f"{member.guild}", icon_url=f"{member.guild.icon}")
await member.send(embed=wel)```
Bruh
what?
so... sorry to ask again, is there a way to give a description to this.. the arguments part.
!d discord.ext.commands.parameter
discord.ext.commands.parameter(\*, converter=..., default=..., displayed_default=...)```
A way to assign custom metadata for a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")'s parameter.
New in version 2.0.
Examples
A custom default can be used to have late binding behaviour.
```py
@bot.command()
async def wave(ctx, to: discord.User = commands.parameter(default=lambda ctx: ctx.author)):
await ctx.send(f'Hello {to.mention} :wave:')
I think you've already been answered with that
am i stupid
no, fr
No idea
i dont see how thats describing something
@silk fulcrum whats wrong
Nothing, all gud
oh
It was
so whats wrong
what did i do wrong
PLEAAAAAAAAAASEEEEE
TELL MEEEEEE
Think about what you did?
can i get some help?
You have no command named test
can't
how do i make one?
Slash or usual?
usual
@opaque fiber
can you give me an example?
BRO PLEASEEEEE, TELL MEEEEEE
Message*