#discord-bots
1 messages ยท Page 1011 of 1
https://github.com/python-discord/snekbox
@unkempt canyon uses this
oh
yeah
lmao
@slate swan โ Your eval job has completed with return code 0.
SCAM
!e print("Never gonna give you up")
@regal pulsar :white_check_mark: Your eval job has completed with return code 0.
Never gonna give you up
you just need to install this library, py bot.load_extension('jishaku') and .jsk py is your eval command
It's my 2nd day using Discord, so no.
.
oO ic
yeah, given that it will be a owner only command though
you can perform discord.py related operations with that command itself _ctx will be in the scope
!e
print("hello world")
@silk rock :white_check_mark: Your eval job has completed with return code 0.
hello world
can you show an example code?
@supple thorn :white_check_mark: Your eval job has completed with return code 0.
21
You can go into #bot-commands if you test random stuff that doesn't help answer someone's question.

sry ๐ฅฒ
yes, suppose bot is your commands.Bot instance, so you can simply py bot.load_extension('jishaku') anywhere, thats all you need to do
it will add some developer only commands which includes an eval command https://jishaku.readthedocs.io/en/latest/cog.html#commands
how to use that eval, simply .jsk py <code>
feel free to use these variables in your code argument https://imgur.com/DRqUFz2.png
What Bot permissions should I check or leave it as it is?
leave as is
you dont need any to access the members list
@bot.commands()
async def test(ctx, message):
await ctx.send(.jsk py message)
man i have no idea
no the command got added already
you just do .jsk py <code> on discord
. being your prefix here*
oooh
back
Okay, so I am done with creating bot, what should I do next?
ok now i get it
what if i want to change jsk to something else
copy the token
go to the code
where it says bot.run("token")
change "token" to your token
then go to the developer page
well jsk here means "jishaku" which is the name of the library you are using, so i guess you cant change that
bot > url generator > copy the link
thank you
OAuth2 > URL Generator, right?
which scopes should I check?
none
It's showing 'Please select at least one OAuth2 scope' in the Generated URL text box
goto bot menu
then choose one
doesnt really matter
Okay, I am choosing "bot".
oh yeah
i forgot
choose bot then dont choose anything after

oops ;/
oops
Done, what next?
object oriented programming sus
very cheap nitro
copy the link
then click on it
and invite the bot to your server
and run your code
this is giving me raid bot vibes
my pleasure madame
btw how to run code
ok
SIKE DISCORD RUNS ON BACKGROUND.lower()
๐ฉ
My server?
what
show what u see when u click bot menu
my server?
whatever server you need the members list of
Anyone know, like if user uses a commmand and delete the command usage then the message of bot also get deleted is it possible?

yeah
How
What happened
@regal pulsar
one sec
K

..
This is what I see
No, it's used to copy paste tokens
@bot.command()
async def test(ctx: commands.Context):
bot_msg = await ctx.channel.send("Test")
def check(message):
return message.author == ctx.author and message.content == f"{bot.command_prefix}test"
msg = await bot.wait_for("message_delete", check=check)
if msg:
bot_msg.delete()
@lyric apex
ok
try this
ok
lmfao
All I want to do is scrape members of LazyLions discord server.
You need manage server perms to invite a bot
@bot.command()
async def test(ctx: commands.Context):
bot_msg = await ctx.channel.send("Test")
def check(message):
return message.author == ctx.author and any(message.content == f"{bot.command_prefix}{cmd}" for cmd in bot.commands)
msg = await bot.wait_for("message_delete", check=check)
if msg:
bot_msg.delete()
i guess ppl are vasleep in #databases
And how to get that permission?
might just wait till tomorrow then
isnt really much to do with styling embeds but you can use inline=False
no thats fine
*args and **kwargs
These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names args and kwargs are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (*). If both are used in a function signature, *args must appear before **kwargs.
Single asterisk
*args will ingest an arbitrary amount of positional arguments, and store it in a tuple. If there are parameters after *args in the parameter list with no default value, they will become required keyword arguments by default.
Double asterisk
**kwargs will ingest an arbitrary amount of keyword arguments, and store it in a dictionary. There can be no additional parameters after **kwargs in the parameter list.
Use cases
โข Decorators (see !tags decorators)
โข Inheritance (overriding methods)
โข Future proofing (in the case of the first two bullet points, if the parameters change, your code won't break)
โข Flexibility (writing functions that behave like dict() or print())
See !tags positional-keyword for information about positional and keyword arguments
No you need to seperate it from the string like you did with value=''
You need to separate those.
value='', inline=False
!d discord.Embed.add_field
add_field(*, name, value, inline=True)```
Adds a field to the embed object.
This function returns the class instance to allow for fluent-style
chaining. Can only be up to 25 fields.
does thread.owner returns the one who created it or ?
Comment somewhere at the start.
Yes it's an optional member tough
!d discord.Thread.owner
property owner```
The member this thread belongs to.
Ah well yea
owner_id should always be consistent.
Yea, since u can not depend on the cache always
Or member has left the server.
the problem is
Yea
it returns the one who created the thread but
wanna do a cmmand like where a user uses a?setup logchn #general and then the bot stores it in a file
after that any command used in that particular server should have a logging in the channel set for that particular server
So a database.
Do you got some code we can look at?
Did you restart the bot?
nvm
Don't think you have since this code doesn't align with what you've got.
Yes
User has DM disabled.
Can we scrape members of a Discord Server using Selenium?
We don't help with such activities.
Why brother, is something wrong with it?
No thanks.
It breaks ToS.
Discord doesn't allow it.
Okay, but it's something I am asked to do by my boss and I really need get it done by tomorrow. I am very confused right now. Nothing's working.๐ซ
If your boss asks to scrape member from a server in Discord it's probably best to find a new job.
You are right, but this is literally my first job got after struggling for months and the pay is also good, so I can't right now.
That's challenging, regardless we won't help you break ToS.
With selenium yeah.
No problem brother!
Why even scrape, just use the official API
..?
What do you mean?
How?
Why would you give him that advice..?
Because why scrape for members when the API exists
Scraping would only be useful for self bots
for scraping the users if a unknown server the bot must be in the server
I know it exists, but why help him break ToS..?
is get_user the same object type as ctx.author please ?
No.
!d discord.User
class discord.User```
Represents a Discord user...
!d discord.Member
When the channel is a DMChannel, yes
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User")...
get_user is not an object 
It is.
it returns an user object
Right and no know will let an unknown bot into there server.
but get_user is a method 
Methods are objects.
exactly

umm
@client.event
async def on_message(message):
if "lol" in message.content.lower():
await message.delete()
@client.event
async def on_message(message):
if "haha" in message.content.lower():
await message.delete()
How to run both, because it's only using "haha", it covers "lol".
I wanna run both, but idk how ) If you know how, please help me!
!e ```py
print(dir(str))
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
uh
Lucas?
did u watch tuto for unban cmd
just do await ctx.guild.unban(discord.Object(id_here))
!e
print(str.split)
@placid skiff :white_check_mark: Your eval job has completed with return code 0.
<method 'split' of 'str' objects>
member id.....
So, basically it's impossible to scrape members of a discord server?
@client.event
async def on_message(message):
if "lol" in message.content.lower():
await message.delete()
@client.event
async def on_message(message):
if "haha" in message.content.lower():
await message.delete()
How to run both, because it's only using "haha", it covers "lol".
I wanna run both, but idk how ) If you know how, please help me!
without a bot yes
You cannot have more than one event of the same type in the same file. Also you could just use if and elif.
why do u have to delete haha.....
So I can do two files with my bot, and run them both ???
cogs yes
It's very bad word there
ok...
I don't wanna send this word here
you can't have the same event everywhere, not only in the same file
no, literally just combine your code into one event
it will be resolved only one event
How ?
Using if and elif or you may use a list as well
elif
ok
There are literally no unofficial libraries for the same?
Or just use a list?
yes
that too
if any(word in list for word in message.content):
can't you do that with cogs tho
That would be much work why not ```py
if any(word in message.content for word in ["lol", "haha"])
no
in cogs you don't use events
you use listeners
which are essentially the same thing but multiple listeners can be resolved at the same time
Yea that's what I meant haha
Oh, Idk where, I tried any options, and with other, not working...
Oh!
Huh? How is using the API breaking TOS
Since he would log in with the user token.
Never said they werenโt using a bot account
Plus pretty sure you need permissions to that endpoint
Come on man, seriously?
They said originally they wanted to use a library which they 100% had to selfbot. for the API this isnโt the case, I would assume they would switch to the proper bot account when using the API
ok iflippedit
Plus you still need proper authentication for that endpoint iirc
You do?
Never made a self bot so idk tbh.
It requires intents, which are only available for bot accounts
You canโt selfbot with intents otherwise it breaks
So you cannot selfbot this endpoint ๐
I subclassed the discord.ui.View and im trying to see if the user who clicked the button is the one who sent the message
Any idea?
Ye u need to read/open the file
and something like
do stuff```
as read?
ye but there is an event for that
which event?
@bot.event
async def on_guild_join(guild):```
k ty
Can a bot find message from guild with disnake.utils
with open("filename.txt", "r") as file:
h = file.readlines```
Ye i think so
@slate swan any idea?
umm
Add a parameter to the view and pass a message object in an instance of it
sry no
An example ๐
Its ok
What's the best way to get a message object, if I have 5 channels where it might be
ig he mean pass the ctx ?
Prolly
You got the id?
ill give example
Yeah

everyone look:
@client.event
async def on_message(message):
if any(word in message.content for word in ["haha", "lol"]):
await message.delete()
where can I write message.content.lower()
I need it
class MyView(View):
def __init__(self, message):
super().__init__()
self.message = message
view = MyView(message)
should learn about classes before using d.py
Do you know who send it?
at message.content..
class but(discord.ui.View):
def __init__(self,c):
self.c = c
@bot.command()
async def s(ctx):
but(ctx)
Yep

wait
!d discord.User.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
oh lol thanks )
class MyView(discord.ui.View):
def __init__(self, ctx: commands.Context, *args, **kwargs):
super().__init__(*args, **kwargs)
self.ctx = ctx
...
async def interaction_check(...):
# use ctx here
@bot.command()
async def my_command(ctx: commands.Context):
view = MyView(ctx)
...
It's going to fetch the message from Dm's.. no?
Still works.
Since it's a User object.
i've already replied to them?
Tried member.fetch_message earlier and it gave me error: User has DM's disabled
i was writing when u send ๐ฅฒ
It's still a case
___ ๐ฟ
im
What does this error mean
i suggest copy paste error in chat
Ok
The slash command name can't have spaces
They can you just need to make a group.
Not exactly the name but he could use that.
You get my point @boreal ravine
yeah
u didnt send the view
actly i hav ethis bot I've made and i've made a command to show to user's profile (stats, lvl, etc) and idk why the ctx commads are correct but not responding
ya
@paper sluice come #ot2-never-nesterโs-nightmare
where u want the selectview....
this is the command:
pfp = pfp.resize(size, Image.ANTIALIAS).convert("RGBA")
bigsize = (pfp.size[0] * 3, pfp.size[1] * 3)
mask = Image.new('L', bigsize, 0)
draw = ImageDraw.Draw(mask)
draw.ellipse((0, 0) + bigsize, fill=255)
mask = mask.resize(pfp.size, Image.ANTIALIAS)
mask = ImageChops.darker(mask, pfp.split()[-1])
pfp.putalpha(mask)
return pfp
@bot.command(name="profile")#!profile command
async def profile(ctx, self, member:discord.Member=None):
if not member:
member = ctx.author()
name, nick, Id, status = str(member), member.display_name, str(member.id), str(member.status).upper()
created_at = member.created_at_strftime("%a %b \%B %Y")
joined_at = member.joined_at.strftime("%a %b \%B %Y")
#money, leave = " ", " "
base = Image.open("base.png").convert("RGBA")
bg = Image.open("drippydefault_background.png").convert("RGBA")
pfp = member.avatar_ulr_as(size = 256)
data = BytesIO(await pfp.read())
pfp = Image.open(data).convert("RGBA")
name = f"{name[:16]}" if len(name)>16 else name
nickname = f"AKA {nick[:17]}" if len(nick)>17 else f"AKA - {nick}"
draw = ImageDraw.draw(base)
pfp = circle(pfp, size=(215, 215))
font = ImageFont.truetype("Nunito-VariableFont_wght.ttf", 38)
akafont = ("Nunito-VariableFont_wght.ttf", 30)
subfont = ("Nunito-VariableFont_wght.ttf", 25)
draw.text((280, 240), name, font = font)
draw.text((270, 315), nickname, font = akafont)
draw.text((65, 490), Id, font = subfont)
draw.text((405, 490), status, font = subfont)
#draw.text((65, 635), money, font = subfont)
#draw.text((405, 635), level, font = subfont)
draw.text((65, 770), created_at, font = subfont)
draw.text((405, 770), joined_at, font = subfont)
base.paste(pfp, (56, 158), pfp)
bg.paste(base, (0,0), base)
with BytesIO() as a:
bg.save("a", "PNG")
a.seek(0)
await ctx.send(file = discord.File(a, "profile.png"))
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
I wanna do like
if ctx.guild.id in filename.txt: do stuff
Will this code work?
Hello guys, this slash why not work?
from discord import Client, Intents, Embed
from discord_slash import SlashCommand, SlashContext
from discord.ext import commands
bot = commands.Bot(command_prefix=("f"),intents=Intents.default())
slash = SlashCommand(bot)
@slash.slash(name="test")
async def test(ctx: SlashContext):
embed = Embed(title="Embed Test")
await ctx.send(embed=embed)
dpy | python v10
dpy, 1.7.3 or 2.0?
then send it with the help command ๐คทโโ๏ธ
just like this...
๐คฆ
like ctx.respond(embed=embed, view=SelectView())
i think this 1.7.3
and dont name it ctx, its not a command.Context a more appropriate name would be interaction
Any errors?
nothing
but i need slash (dc dm me for use slash to my bot because my bot verified)
I was making a slash command but I got an error. Please help me
Why discord_slash?
i search libary-s and this lib is the 6th what i try
Why not use discord.py
Does anyone know how to scroll down the members on the right side using Selenium?
Instead of some random 3rd party library
Is there a reason you're doing it with selenium?
because its not work to me
How so? Errors? What have you tried?
nothing error but nothing in this place
Someone is on the Events Team ๐
but i re-invite the bot and etc
Because you're using discord_slash most likely
slash commands don't have a "message", use datetime.datetime.utcnow/datetime.datetime.now instead
Glad you noticed haha
I like green more than yellow
Haha got tired of the Yellow?
you got it boss
Ah hahaha
Doesnโt that mean like what time is it rn
Yep
Learning Selenium. On normal websites scroll down works easily. But here there are 3 scrolls. Want to know how can scroll down be used in such cases.
And the current time is the same time someone used a slash command
Discord isn't the best website to be testing selenium on. They have an API and we should be respecting that
I want to know when the user created there discord account
i search for youtube videos but everybody use discord_slash
Right, because the youtube videos on this subject are really bad and pick bad design choices
interaction.user.created_at iirc
Okay, got it!
you already did that inside your code?
interaction.user.created_at
the error got raised because of ctx.message
And you can't go into dpy slash since it's way too complicated lol
So-so, documentation is lacking but with some dedication you can get it
Ctx.message is not in my code
Yeah ofc but the first question is, Client or Bot?
I am making a Dragon Ball themed bot and want to make a command that randomly gives you a Dragon Ball, and when you collect all 7, you can get a surprise (like a gif). Will I need to use random?
I meant that when the user uses the command (example .dragonradar) and gets, let's say, a One-star Dragon Ball, the bot saves that the user got a ball, and when the user uses another command (example .shenron) but has only one ball, the bot says "You don't have the right amount of Dragon Balls, find them with .dragonradar!", and when the user gets all 7, and uses the shenron command again, he gets a gif.
I am using discord.py
My question: What should I do (steps)?
Obviously client
is it a slash command?
random.choice() is what you're looking for to give the user a random dragon ball
Yes
await interaction.original_message()
Not in that lib
no.
Bruh
And for the shenron command I need to use if? Like if insufficient amount of Dragon Balls, send the message else send the gif?
Or could I do datetime.now?
Instead of utc
How can I scroll down only the right side of stocks list using selenium?
mhm
Do not have permission to send messages.
Read it
Where do I put it
?
Itโs not right Iโm still getting errors
What library are you using?
Slash
!pypi slash
hmm
https://docs.pycord.dev/en/master/api.html#option
tryina do options but i get this:
NameError: name 'Option' is not definedwhat do i define as?
Simple if statement
SlashContext has no attribute to datetime
bro
Anyone?
Ok, thanks
datetime.datetime.now() after importing datetime
Oh
Is there any way for a bot to execute discord commands ?
Oh
xd
anyone know pycord? ๐
Ok
And what about the dragon balls command (not .shenron), where you need to collect 7 of them? Also need to use if?
How do I import?
Is it from discord import datetime
!pypi tts
question is there anyway that client.event can see messages? like if someone says a cprofanity word it will delete it
sure, then do datetime.now()
undefined name message.
show code
So ctx
Ok
โโ@slash.slash(name="whois", description="to see information on that person")
async def whois(ctx, user: discord.Member = None):
if user == None:
user = ctx.author
rlist = []
for role in user.roles:
if role.name != "[censored because of auto mod in server]":
rlist.append(role.mention)
b = ", ".join(rlist)
embed = discord.Embed(colour=user.color, timestamp=message.datetime.now())
embed.set_author(name=f"User Info - {user}"),
embed.set_thumbnail(url=user.avatar_url),
embed.set_footer(text=f'Requested by - {ctx.author}',
icon_url=ctx.author.avatar_url)
embed.add_field(name='ID:', value=user.id, inline=False)
embed.add_field(name='Name:', value=user.display_name, inline=False)
embed.add_field(name='Created at:', value=user.created_at, inline=False)
embed.add_field(name='Joined at:', value=user.joined_at, inline=False)
embed.add_field(name='Bot?', value=user.bot, inline=False)
embed.add_field(name=f'Roles:({len(rlist)})',
value=''.join([b]),
inline=False)
embed.add_field(name='Top Role:',
value=user.top_role.mention,
inline=False)
await ctx.send(embed=embed)โโ
@maiden fable
on_message with message intents
thx
how does python read files? does it go lines by line or something else
I believe so, but not really a question to ask the dpy community
oh ok thx btw
No problem, Iโm here to help after all
Which line
Nvm I fixed it
Ah cool
I got McDonaldโs icecream
So I want it to log my bans however when I ban it doesn't put embed2 into my log channel. What's wrong? No errors
@bot.command()
async def ban(ctx, user: nextcord.Member, *, reason=None):
guild = ctx.guild
if reason == None:
reason == "Not Specified"
embed1 = nextcord.Embed(title="User Successfully Banned!", description = f"**{user}** has been banned!")
embed2 = nextcord.Embed(title=f"Ban Information on {user}!", color = nextcord.Color.red())
embed2.add_field(name="User", value = f"{user.mention}")
embed2.add_field(name="Admin/Moderator", value = f"{ctx.author.mention}")
embed2.add_field(name="Reason", value = f"**{reason}**")
embed2.set_footer(text=f"User ID: {user.id}")
embed3 = nextcord.Embed(title=f"Your Ban from {guild}", description = f"You were banned from {guild} because **{reason}**", color = nextcord.Color.red())
if user.guild_permissions.manage_messages:
error1 = nextcord.Embed(title='User is an Admin/Moderator!', color=nextcord.Color.red())
await ctx.send(embed=error1)
return
else:
if ctx.author.guild_permissions.ban_members:
await guild.ban(user=user)
await ctx.send(embed=embed1)
await user.send(embed=embed3)
log_channel = bot.get_channel(879095317771997246)
await log_channel.send(embed=embed2)
Itโs a key error
discord.Option
nessage typehinted as str 
I tried it without str too
so;option = discord.Option?
The request.json thing doesnโt return a json formatted thing, it instead sends I believe a status code and shit
json.loads(response.text) returns the dict correctly
Geo =Json.loads(r.text)?
Yes
Ok lemme try
whats doin all this? ๐
!d discord.Interaction
class discord.Interaction```
Represents a Discord interaction.
An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.
New in version 2.0.
im confused, cus its not even in the files im editing lol ๐ howd i like redownload pip installations or check theyre all good?
or is that not even the issue ๐
wdym ๐ srry for my stupidity but im pretty new ๐
Remove that โsโ
Also capital I
Idk if itโs case sensitive, Iโm going off of what the panda dude said
It's from discord import Interaction
Not from discord.interaction import Interaction
Bruh Iโm dumb af ๐
Traceback (most recent call last):
File "c:\Users\cohen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\bridge\bot.py", line 27, in <module>
from discord import Interaction
ImportError: cannot import name 'Interaction' from 'discord' (C:\Users\cohen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\__init__.py)
PS C:\Users\cohen\Desktop\Files\Night Wolf\Discord Bots> ```
idek lol
discord.py version?
1.7.3
ooh
Oh yeah it's pip install git+https://github.com/Rapptz/discord.py
And no need of PowerShell for that
Can do in simple cmd
its running, ty ๐
was using terminal ๐
I think thatโs the visual studio code terminal
yep
Nah
daang u been coding a lot
It's powershell
You just start PowerShell when you create a new 'terminal' view on VSC
installed!
PS C:\....
PS = PowerShell
uh oh, i messed up didnt i ๐
Honestly doesnโt matter in the situation
Never said the opposite
Then why are you arguing about it?
Because you keep on saying it's not, which is wrong
ยฏ_(ใ)_/ยฏ
I said it was the visual studio code terminal, if he opened windows power shell Normally that would be a bit weird but it made sense to use the terminal in his environment
What is even discord.ext.bridge
pip uninstall discord.py 1.7.3?
Doesn't exist in the the documentation either
!d discord.ext.bridge
No documentation found for the requested symbol.
๐คทโโ๏ธ
aah rip what am i doing ๐ its pycord to bridge slash and prefix comnds
idek what ive done anymore lmao
Yo
its a pycord thing
Then you got to remove that and migrate to 2.0
They have a documentation for the breaking changes, https://discordpy.readthedocs.io/en/master/migrating.html
So you might want to take a look at what's the alternative to what you've done with bridge
wdym? i have two docs, ones my main code, i did it terribly using discord.py and couple of addons and did comands with if message.content etc. so i created a new doc and used pycord bridged and started moving the code there... and ive messed up along the way and just getting loads of errors and idek what to do lol
You need to remove the bridge import, that's for sure
Then I'd uninstall pycord along with discord.py 1.7.3 as you probably have them installed
so how can i do prefix and slash without duplicate commands
hybrid commands
oh no, im clueless with that ๐ tried that and failed
property mention```
Returns a string that allows you to mention the given user.
no, at bot
#381965829857738772 message You can take a look up here, might help you understand them
@unkempt canyon
Itโs a canary link ๐ญ
Doesn't matter
It just says that you canโt go to it anyway

idek.. im rlly bad at all this lol
it's the discord.py server
Yeah
Last time I sent an invite I got bonked by AutoMod 
There are some whitelists
Yeah which we don't know
it's rustlang
Oh wait

@unkempt canyon ๐
Good to know /rust is allowed
Lmaoo
https://discord.com/invite/rust-lang-community
That name though
Who is it supposed to mention?
^^
U didn't define the member variable
You haven't defined member
what to do?
^
this is basic python..
bro
show the function there's gotta be member in the arguments somewhere
whose participant is mentioned in the message
So show the entire command code now
So that we have more context to help ^^
have u even passed the member arguement in the func
something like async def function_name(ctx, member: discord.Member) no
bot.command()
async def gay(ctx):
embed = discord.Embed(title=":rainbow_flag:Gay metr:rainbow_flag:", description=f"{member.mention} is **{random.randrange(101)}%** Gay", color = discord.Color.light_grey())```
Yeah something like that is needed
See the message above :D
yeah exactly you dont have members in the arguments
it also needs to have discord.Member object
You can
member: discord.Member
yes u can
ive been mentioned in embeds before
But you can mention
wait
You read more about the parameters here if you need something for later - https://discordpy.readthedocs.io/en/stable/ext/commands/commands.html#parameters
thats not mentioned i was mentioned in the text field outside the embed
you remind me of IPayForBinaryNinja since his username is kryt0n or something
Because that's me
how would i build a warning system?
๐คท
yoo what
simple database
oh
well i'm stumped rn
Use parameters for your command (target, reason), add the warning to the database and send a warning in private messages
fuck im stupid lmfao i looked at your website but then thought "wait it probably doesn't have .ninja as a domain"
hmm?
well obviously he'd use parameters in his command
what do you need help with specifically
i'm over thinking it thank you
your question is vague you asking for the whole code or
well you can't spoonfeed so no lol
mmm well they have answered already so
ik that now i'm building on it
how can i set permission to slash? (i create ban slash)
you can use the decorator iirc
where error?
# gay metr
bot.command()
async def gay(ctx, member: discord.Member):
embed = discord.Embed(title=":rainbow_flag: Gay metr :rainbow_flag:", description=f"{member.mention} is {random.randrange(101)}% Gay", color = discord.Color.light_grey())
await ctx.send(embed=embed)
ive never fucked with slash commands but im pretty sure the command.has_permission(manage_members=True) works for slashes
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of
the permissions necessary.
Note that this check operates on the current channel permissions, not the
guild wide permissions.
The permissions passed in must be exactly like the properties shown under
[`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions")...
oh its commands?
you did bot.command() without using the deco ๐
@bot.command() itโs a decorator
yeah...
oh
nope
i thought it was just command
oh, thx
its commands
ok ty
bruh ur name
Who?
Maybe ๐ค, I am making a game software in Java.
That is very time-consuming
Like an editor like unity or unreal engine?
IntelliJ
why does it only reply with a?
no error
Hmmm
Show the sent embed
Also show your variables
yes sorry
Can you show your whole event as well?
excercise1='a'
excercise2='b'
excercise3='c'
Use_for = [excercise1,excercise2,excercise3]
excercise=(random.choice(Use_for))
embed = discord.Embed(
title="**__Random Excercise:__**",
description=(random.choice(excercise)),
color=0x260af3)
embed.set_thumbnail(
url="https://cdn.discordapp.com/attachments/968378382595272714/968754973217263646/unknown.png")
if message.content.startswith('.excercise'):
await message.channel.send(embed=embed)
You haven't implemented the commands in a right way yet?
oi
๐ณ man
How are you sending an embed with no event or command?
Well itโs a random choice from the list and itโs selecting exercise 1
Oh
it always selects exercise 1
Oh
Because you get random value once and never override it
I already told you that like 2 days ago or smth
Basically your getting a random value from a random value
Which wonโt work, it will but only returns the one value
And this too
Random.choice(Use_for) should work
So I want it to log my bans however when I ban it doesn't put embed2 into my log channel. What's wrong? No errors
@bot.command()
async def ban(ctx, user: nextcord.Member, *, reason=None):
guild = ctx.guild
if reason == None:
reason == "Not Specified"
embed1 = nextcord.Embed(title="User Successfully Banned!", description = f"**{user}** has been banned!")
embed2 = nextcord.Embed(title=f"Ban Information on {user}!", color = nextcord.Color.red())
embed2.add_field(name="User", value = f"{user.mention}")
embed2.add_field(name="Admin/Moderator", value = f"{ctx.author.mention}")
embed2.add_field(name="Reason", value = f"**{reason}**")
embed2.set_footer(text=f"User ID: {user.id}")
embed3 = nextcord.Embed(title=f"Your Ban from {guild}", description = f"You were banned from {guild} because **{reason}**", color = nextcord.Color.red())
if user.guild_permissions.manage_messages:
error1 = nextcord.Embed(title='User is an Admin/Moderator!', color=nextcord.Color.red())
await ctx.send(embed=error1)
return
else:
if ctx.author.guild_permissions.ban_members:
await guild.ban(user=user)
await ctx.send(embed=embed1)
await user.send(embed=embed3)
log_channel = bot.get_channel(879095317771997246)
await log_channel.send(embed=embed2)```
Idk why but I have a mood of creating music generating AI
how to make it?
Mmmmmmm
embed.set_thumbnail
Thumbnail
thx
embed.set_thumbnail(url="https://...")
!d discord.Embed.set_thumbnail
set_thumbnail(*, url)```
Sets the thumbnail for the embed content.
This function returns the class instance to allow for fluent-style
chaining.
Changed in version 1.4: Passing `None` removes the thumbnail.
Yall said the same thing thrice just why
๐
still
now it only replies with c
and what does override mean
Show code again?
my english isnt very good
thats cool
Use_for = [excercise1,excercise2,excercise3]
excercise=(random.choice(Use_for))
excercise will just be randomly picked ONCE at runtime
I think you should remove the excercise veriable and use
description=(random.choice(Use_for)),
It's very tough
@crimson compass listen there's a simple concept - once you parse a value to the variable, it is stored there until you override the value or delete the variable
ik
^^
Aw java
this?
import java.util.Something; * 69
@slate swan pm me
5000 lines for a simple function
still.
But Java can get shit done.
Ikr
Gg
Java can also host itself
es
What do you guys think of a bot that generates music and plays it ๐ค
the same just replaced what you told me to and later instead of excercise i put descreption
but thats still the same thing
there was no need to replace it
!rule 6
ane discord.py allows slash commands fyi
thanks
thanks, but as I said, discord.py allows slash commands internally
yeah...its nothing
up to 4k lines of code for the bot im working on 
but if u want to verify ur bot dc want to use slash
elaborate?
what do you mean?
you dont have to switch slash commanfs permanently, you have to request for the intent
to read messages
do u have verified bot?
do you know
yap but nobody knows how its works
I had but it got taken down by discord because I had a copyright issue for its avatar
You mean how it works on low level?
ah would you mind pasting the code here once more?
ok bro
if you don't get an official message about the slash why are you smart?
probably, but how were you gonna help them for slash commands
excercise1='a'
excercise2='b'
excercise3='c'
Use_for = [excercise1,excercise2,excercise3]
description=(random.choice(Use_for)),
embed = discord.Embed(
title="**__Random Excercise:__**",
description=(random.choice(description)),
color=0x260af3)
embed.set_thumbnail(
url="https://cdn.discordapp.com/attachments/968378382595272714/968754973217263646/unknown.png")
if message.content.startswith('.excercise'):
await message.channel.send(embed=embed)```
huh.......?
I couldn't extract the sense from that sentence as well
lmao
You made an implementation of slash commands or something?
this community very good, nobody help for the man, who try make slash commands, but if 1 person try to help with the lib / code / inv u insult
Who's the man who tries to create slash commands and who is the person that helps with lib/code I am a bit confused
...............?
I mean,nobody is too extreme
plus why would anyone need an external library for something that can be done internally?
thats my question....
and nobody's insulting anyone
xD
always battles in here
anyone else
Hello
can i send dm for u?
Hi
DM @novel apex please
whats the issue you are facing?
the output is always the same
hm dont do random.choice() on an already randomized value
and are you defining those in the on_message event?
yes
sorry, I meant setting the description directly
excercise1='a'
excercise2='b'
excercise3='c'
Use_for = [excercise1,excercise2,excercise3]
embed = discord.Embed(
title="**__Random Excercise:__**",
description=random.choice(Use_for),
color=0x260af3)
embed.set_thumbnail(
url="https://cdn.discordapp.com/attachments/968378382595272714/968754973217263646/unknown.png")
if message.content.startswith('.excercise'):
await message.channel.send(embed=embed)
Please help me on this error I was making a slash command and this error popped up
I had the same question
thanks bratt
What can I use?
and it helps if bot makes sense ๐
bal[1] or cost is an str
np, sorry for the confusion
either bal[0] is a string or cost is a string
one of them
nvm
Uhhhh bal[0] will that work?
you don't have to change the value you're taking
Because thatโs for to check if user has enough money
if bal[1] is a number in quotation marks, remove the quotation marks
Itโs not in โ
is cost in quotation marks
No
well one of them is an str bro ๐ข
Wdym do I choose?
print(type(cost))
print(type(bal[1]))
```before the error occurs, can you do it
And what is that going to do?
print the types of the values...
print(type(cost))
print(type(bal[1]))
!e
cost = 90
bal = "100"
print(type(cost))
print(type(bal))
@heady sluice :white_check_mark: Your eval job has completed with return code 0.
001 | <class 'int'>
002 | <class 'str'>
<class โstrโ>
<class โintโ>
<class โstrโ>
<class โintโ>
Thatโs what it printed out
Ok
?
What's damn wrong. Every time I ban a user it doesn't send the embed2 to the log channel. No errors.
@bot.command()
async def ban(ctx, user: nextcord.Member, *, reason=None):
guild = ctx.guild
if reason == None:
reason == "Not Specified"
embed1 = nextcord.Embed(title="User Successfully Banned!", description = f"**{user}** has been banned!")
embed2 = nextcord.Embed(title=f"Ban Information on {user}!", color = nextcord.Color.red())
embed2.add_field(name="User", value = f"{user.mention}")
embed2.add_field(name="Admin/Moderator", value = f"{ctx.author.mention}")
embed2.add_field(name="Reason", value = f"**{reason}**")
embed2.set_footer(text=f"User ID: {user.id}")
embed3 = nextcord.Embed(title=f"Your Ban from {guild}", description = f"You were banned from {guild} because **{reason}**", color = nextcord.Color.red())
if user.guild_permissions.manage_messages:
error1 = nextcord.Embed(title='User is an Admin/Moderator!', color=nextcord.Color.red())
await ctx.send(embed=error1)
return
else:
if ctx.author.guild_permissions.ban_members:
await guild.ban(user=user)
await ctx.send(embed=embed1)
await user.send(embed=embed3)
log_channel = bot.get_channel(879095317771997246)
await log_channel.send(embed=embed2)
Should I create a bot that generates music and plays it in vc ๐ค
Generates???
if bal[0] < int(cost):
Yes ๐
Mad definitely should
AI music generation
can I invite
Sounds really cool
Like I already made AI antispam and it is good af (almost) and I wanna do something more advanced now
Still not working
damn I told you yesterday, switch await guild.ban(user=user) and the user.send() part

No error tho
once the guy is kicked from the server, the bot won't be able to send him a message
cuz no server that both the bot and the guy are in
I did now it DOES ban but now it doesn't log the ban
should not affect anything
Itโs not buying anything
do reason = "Not specified"
then how am I supposed to know ๐ฆ
what do you have in except
after the try
it's eating up the error innit
It works but itโs not letting me buy more than 1 thing
This Is the code and it wonโt let me use the amount option
it says optional?
Yes.
If you donโt choose amount it will just give you 1
But if you use amount and type how much then it wonโt do anything
And thereโs no error
did you read this message
or this
?
try:
index = 0
t = None
for thing in users[str(user.id)]["bag"]:
n = thing["item"]
if n == item_name:
old_amt = thing["amount"]
new_amt = old_amt + amount
users[str(user.id)]["bag"][index]["amount"] = new_amt
t = 1
break
index += 1
if t == None:
obj = {"item": item_name, "amount": amount}
users[str(user.id)]["bag"].append(obj)
except:
obj = {"item": item_name, "amount": amount}
users[str(user.id)]["bag"] = [obj]
with open("bank.json", "w") as f:
json.dump(users, f)
await update_bank(user, cost * -1, "wallet")
return [True, "Worked"]
async def open_account(user):
users = await get_bank_data()
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0
with open("bank.json", "w") as f:
json.dump(users, f)
return True
async def get_bank_data():
with open("bank.json", "r") as f:
users = json.load(f)
return users
async def update_bank(user, change=0, mode="wallet"):
users = await get_bank_data()
users[str(user.id)][mode] += change
with open("bank.json", "w") as f:
json.dump(users, f)
bal = [users[str(user.id)]["wallet"], users[str(user.id)]["bank"]]
return bal
except:
obj = {"item": item_name, "amount": amount}
users[str(user.id)]["bag"] = [obj]
```this is bad
cuz it will do this if there's an error
and you won't know what the error is
So what do I do?
except Exception as e:
raise e
```or removing the try-except completely
if you wanna comment it out to keep the code for later, then do that
but for now, you need information
Where do I put this?
This is the same as having no try except
instead of this
"or removing the try-except completely"
I got no error
I got no error
did it work tho
Nope
that's what I thought
So now what?
was t None at the end or something
Not at the end
so t was 1
Sorry
what did it return
the func
so did it return this
Yes
but it did not work
Correct
what even happened when you did the command
And the bot is running
bro it's not even supposed to respond you didn't do anything like await interaction.response.send_message() 
No
Here is what happens if I donโt put an amount
Wdym?
if I had to guess
I'd say in your command, you send this message if your function returned True
and it doesn't
No because if the user didnโt have enough money it will say you donโt have enough money
then it doesn't return anything, just stops somewhere
Ok but I have enough money
I'm happy for you
I can just give myself money
All I need to know is why wonโt it let me buy a certain amount of an item
does the same code run when you don't input an amount
Yes
But if I put an amount then no
I donโt understand why it wonโt do anything to put an amount
mmmmmmmmmmmmmmmm
I donโt think thatโs how you make a slash command
?
if they're using Pycord, im pretty sure thats how u do it
I so wanna see the whole command
Oh I donโt use pycord
Ok
ctx.message is NoneType
probably because ctx is a wrong named interaction which doesn't have a message
slash commands are not messages
nothing to do with each other
@median bridge.slash(name="buy", description="use it to buy stuff")
async def buy(ctx, item, amount=1):
await open_account(ctx.author)
res = await buy_this(ctx.author, item, amount)
if not res[0]:
if res[1] == 1:
await ctx.send(f"That Object isn't there!")
return
if res[1] == 2:
await ctx.send(
f"You don't have enough money in your wallet to buy {amount} {item}"
)
return
await ctx.send(f"You just bought {amount} {item}")
Hello everyone, where can I found the "Discord Event" documentation ? How to create event (for community guilds), manage, and delete etc. Thanks !
is this pycord
async def buy_this(user, item_name, amount):
item_name = item_name.lower()
name_ = None
for item in mainshop:
name = item["name"].lower()
if name == item_name:
name_ = name
price = item["price"]
break
if name_ == None:
return [False, 1]
cost = price * amount
users = await get_bank_data()
bal = await update_bank(user)
if bal[0] < int(cost):
return [False, 2]
try:
index = 0
t = None
for thing in users[str(user.id)]["bag"]:
n = thing["item"]
if n == item_name:
old_amt = thing["amount"]
new_amt = old_amt + amount
users[str(user.id)]["bag"][index]["amount"] = new_amt
t = 1
break
index += 1
if t == None:
obj = {"item": item_name, "amount": amount}
users[str(user.id)]["bag"].append(obj)
except Exception as e:
raise e
with open("bank.json", "w") as f:
json.dump(users, f)
await update_bank(user, cost * -1, "wallet")
return [True, "Worked"]
async def open_account(user):
users = await get_bank_data()
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0
with open("bank.json", "w") as f:
json.dump(users, f)
return True
async def get_bank_data():
with open("bank.json", "r") as f:
users = json.load(f)
return users
async def update_bank(user, change=0, mode="wallet"):
users = await get_bank_data()
users[str(user.id)][mode] += change
with open("bank.json", "w") as f:
json.dump(users, f)
bal = [users[str(user.id)]["wallet"], users[str(user.id)]["bank"]]
return bal
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
No itโs python
Oh no itโs discord.py
message.content exists to get the actual message, but how do i get an embed from an on_message? would it be message.embed?
I really don't get it either
!d discord.Message.embed
No documentation found for the requested symbol.
awkward
no, it's message.embeds[0]
yes, it's an embed object
you can get the title of the embed with msg.embeds[0].title
or description with msg.embeds[0].description
message.author
alright thanks
hello
discord bot assign roles on Redeemption of code and create code
can someone know these kind of bot building?
What does that even mean
Guys i have got the problem with the error message: **ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (/Users/...)**I have already tried to reinstall everything, but it doesn`t work? Does anybody know the problem?
huh
well reinstalling always fixes that
did u try:
pip uninstall discord.py
pip install discord.py
Yes
Yea they are difficult
Okay but you don`t know what this message means?
Nah, it was a private bot any way
means the module files got corrupted
Uh yea
But then I am going to sleep in like 5 min, sooooooo
Okay
pycord?
21.3.1
Yes
21.3.1 ๐ฎ thats not even released yet
wait what?
valid
you do buttons via from discord_components import DiscordComponents, Button, ButtonStyle ??
thats your pip version, not discord.py version
run pip list command in your cmd