#discord-bots
1 messages · Page 849 of 1
any example codes?
open the link
read the docs of the library to understand
thats the percentage of how much are the 2 strings matching
how can i fix it?
pfp = Image.open(avatar_data)
ty
@client.event
async def on_message(message):
if fuzz.token_sort_ratio("who asked") in str(message.content).lower():
await message.reply("I asked.")
Tell me this works!
Wait... it wont
Answer me!
Decide on a threshold
@client.command()
async def accept(ctx, self):
accept_req = await self.cso.post(
url=f"https://friends.roblox.com/v1/users/{self.id}/accept-friend-request"
)
return accept_req.status == 200```
is self a string in this case?
this server is filled to the brim with bots
just posts a codeblock with no explanation
Bro I need help
@client.event
async def on_message(message):
if fuzz.token_sort_ratio("who asked", f"{in str(message.content).lower())}":
await message.reply("I asked.")
please help!
!pip fuzzywuzzy
Decide on a threshold and try out the different methods fuzzywuzzy provides and find which one fits yours best
Same way as it’s in the pypi page
U do know that difflib exists, right?
Difflib is another alternative yea
And it's also a stdlib
why tf does it spam?
@sick birch
async def on_message(message):
if fuzz.token_sort_ratio("who asked", message.content):
await message.reply("Your Mom?")
I did this
The bot is probably just listening to itself
Add a check to see if the author of the message isn't the actual bot
where??? bro...
I always do
if not message.author.bot:
# code```
Yea same thing
at the top of the function
yea just 2 lines less
omg your mom spam
the reason I don't do this is cz I have to add another indent to all the code to make sure it is inside that if statement
Your mom?
You need to make a threshold
HOW DO I FIX THIS
@stiff anvil
?
How do I make a threshold
Check if the number that the method returns is in a certain range
Don’t. Just use … in range (int threshold)
wtf is this?
Ur checking if the number returned is in a certain range
Help pls(20 syntax error)py @bot.command() async def casino(ctx, arg): cash = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"] if arg is numbers: if cash >= arg: money = arg if random.randint(0, 100) > 50: bal = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"] + money embed = discord.Embed(title="", description=f"""Ты получил {money} bebr Твой баланс {bal}""", colour=0x843DA4) await ctx.send(embed = embed) collection.update_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id},{"$inc": {"money": money}}) else: bal = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"] - money emb = discord.Embed(title="", description=f"""Ты потерял {money} bebr Твой баланс {bal}""", colour=0x843DA4) await ctx.send(embed = emb) collection.update_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id},{"$inc": {"money": money}}) else: await ctx.send(f"Бот, у тебя нету денег") else: await ctx.send(f"Бот, впиши число")
This is casino
@client.event
async def on_message(message):
if message.author.bot:
return
if fuzz.ratio("who asked", message.content):
if fuzz.ratio in range (int 100):
print(fuzz.rato())
???
sorry guys
No if fuzz.ratio(“who asked”, message.content) in range(a integer): put an int in the brackets of range
idk the ro.py docs doesnt explain what im supposed to do
Did you copy paste this part of the code from somewhere?
Also properly indent your code
Please read my older messages
when someone says who asked
@client.event
async def on_message(message):
if message.author.bot:
return
if fuzz.ratio("who asked", message.content) in range(100):
await message.reply("Your Mom?")
Current code
await bot.process_commands(msg) right at the end of your event
Ohhh sorry
so that your bot actually goes through commands and doesn't just do nothing
range(int low, 100) you need a lowest number as the first arguement
@client.event
async def on_message(message):
if message.author.bot:
return
if fuzz.ratio("who asked", message.content) in range(0, 100):
await message.reply("Your Mom?")
await bot.process_commands(message)
So like this?
Not 0
*not necessarily, the first argument is assumed as stop if no second arg is provided. start is assumed to be 0
nvm
If it’s 0 any message will trigger it
well probably not inside your if
50 then
That's not a very good reply
I will change it to I asked
I JUST NEED IT TO WORK FIRST
Try that
No, they made me a data base with a code for work and balance, and with the help I tried to make a "casino"
where?
First properly indent your code
you have indentation problems
right at the very end of your event, so that's it's the last line
I tried to correct the tabulation or something like that, but it didn't work.
try a higher value
what are you trying to do?
Can u show ur range numbers?
50,100
Hmm
dude, your processing commands if the command contains who asked
lower it one tab
Commands dont work
exactly
😂
import disnake
from disnake.ext import commands
from disnake.utils import get
class Test(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_guild_join(self, ctx):
print('test')
msg = "This is a test message."
try:
channel = get(ctx.guild.channels, name="general")
await channel.send(msg)
except:
try:
await ctx.guild.system_channel.send(msg)
except:
return
def setup(client):
client.add_cog(Test(client))
@client.event
async def on_message(message):
if message.author.bot:
return
if fuzz.ratio("who asked", message.content) in range(0, 100):
await message.reply("Your Mom?")
await bot.process_commands(message)```
is that right??
on_guild_join returns a guild object
commands are back to working
not a context object
And we have this...
@client.event
async def on_message(message):
if message.author.bot:
return
if fuzz.ratio("who asked", message.content) in range(50, 100):
await message.reply("Your Mom?")
await client.process_commands(message)
Current code
@bot.command()
async def casino(ctx, arg):
cash = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"]
if arg is numbers:
if cash >= arg:
money = arg
if random.randint(0, 100) > 50:
bal = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"] + money
embed = discord.Embed(title="", description=f"""Ты получил {money} bebrТвой баланс {bal}""", colour=0x843DA4)
await ctx.send(embed = embed)
collection.update_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id},{"$inc": {"money": money}})
else:
bal = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"] - money
emb = discord.Embed(title="", description=f"""Ты потерял {money} bebrТвой баланс {bal}""", colour=0x843DA4)
await ctx.send(embed = emb)
collection.update_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id},{"$inc": {"money": money}})
else:
await ctx.send(f"Бот, у тебя нету денег")
else:
await ctx.send(f"Бот, впиши число")
Try this and show me the ouput error
import disnake
from disnake.ext import commands
from disnake.utils import get
class Test(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_guild_join(self, guild):
print('test')
msg = "This is a test message."
try:
channel = get(guild.channels, name="general")
await channel.send(msg)
except:
try:
await guild.system_channel.send(msg)
except:
return
def setup(client):
client.add_cog(Test(client))```
@swift imp
Maybe try printing the ratio when you do “who asked?“
what's disnake?!
how?! I asked you before
the best fork
Discord library
It's a fork of Discord.py, imo one of the better ones
okk thanks
Does it have any advantages over pycord?
I am using pycord atm
print(fuzz.ratio(args))
@client.event
async def on_message(message):
print(fuzz.ratio(args))
But the arguments in the brackets of fuzz.ratio
@client.event
async def on_message(message):
print(fuzz.ratio(message.content))
So this?
@client.event
async def on_message(message):
print(fuzz.ratio("who asked", message.content))
No this
Yep
wait your using discord.Client() not Bot?
i smell lucas
Lol yeah
hey all
who you?
better methods,better codebase, faster in development, doesnt do weird stuff like changing paths of classes
i am mina
how are you all today
I have to change the 100 to 101 I guess
goooooood
(this isn't the minaberry i know)
why wdym?
new pfp
@torn sail :)
I find it confusing when ppl do that
ah yes changed it recently. just wanted to pop in and say hi
Yeah I thought that might be it
They generally maintain a better codebase, they arguably have better design choices (like their impl of slash commands and interactions in general -- which iirc Pycord doesn't bother with), and overall just a nicer experience.
If it works for them it works I guess
Nice :)
pycord as slash commands, i use them in my bot
disnake good because pycord steals dpy folder
I'm selling the code (no one helped me here) for $100
is that a serious offer?
!rule 9
if I say yes, I will get muted, So no
idk if this is related i post it when ever i see the $ symbol
alright, then don't make the offer as a joke either, or you'll still be muted lol
I don't really have a problem with pycord atm, but will try disnake if i need to
Thank You
I only know about rule 5, sorry
yeh they seem to
how do you implement option descriptions in pycord?
I really want to help, but I can;t still for the life of me figure out what you are trying to do (Read old messaged didn't help understanding)
I already fixed my issue tho...
@client.event
async def on_message(message):
print(fuzz.ratio("who asked", message.content))
if message.author.bot:
return
if fuzz.ratio("who asked", message.content) in range(50, 101):
await message.reply("I asked.")
@bot.slash_command(guild_ids= guild_ids , name="search" , description="Your Personal Dictionary")
And this is what it does
@bot.command(description="Your personal dictionary")
guess that works too
Annotate the parameter with an instance of discord.commands.Option which has a description kwarg
i meant "options" mate
uhhh
that's for the bot
something like ```py
async def command(inter, arg: discord.commands.Option()):
...
lol same
Yeah, Option has some parameters which you'll have to pass
admin role is pingable here
I think type, description, name etc, not all of them required
why only here
Here -> this server
It does. And this is ot
probably something on my side
i see, disnake does it in the decorator itself py @bot.slash_command(options=[disnake.Option(name="a")]) async def command(inter, a ): ... or you can just do it inside the function py @bot.slash_command() async def command(inter, a:str): ...
Inside the function?
sorry i worded it wrong, it has to be as the function paramaters, some other library allowed that
Ah I see
i wass fix cod to 3 errorpy @bot.command() async def casino(ctx, arg): cash = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"] if arg is numbers: if cash >= arg: money = arg if random.randint(0, 100) > 50: bal = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"] + money embed = discord.Embed(title="", description=f"""Ты получил {money} bebr Твой баланс {bal}""", colour=0x843DA4) await ctx.send(embed = embed) collection.update_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id},{"$inc": {"money": money}}) else: bal = collection.find_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id})["money"] - money emb = discord.Embed(title="", description=f"""Ты потерял {money} bebr Твой баланс {bal}""", colour=0x843DA4) await ctx.send(embed = emb) collection.update_one({"member_id": ctx.author.id, "guild_id": ctx.guild.id},{"$inc": {"money": money}}) else: await ctx.send(f"Бот, у тебя нету денег") else: await ctx.send(f"Бот, впиши число")
@mental bison
indents are a joke
bad indentation attacks
indents overrated
Use motor
i dont know
Pymongo is blocking
Why does this not work? await Member.remove_roles([role.id for role in entry.user.roles])
File "C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 995, in remove_roles
await req(guild_id, user_id, role.id, reason=reason)
AttributeError: 'list' object has no attribute 'id'```
it is?
Damn 😂
i want to remove ALL existing roles of a person
for member.roles in member:
try:
member.delete.role```
member.roles*
!d discord.Member.roles returns a list of roles, run it through a loop and then
property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.
These roles are sorted by their position in the role hierarchy.
!d discord.Member.remove_roles()
await remove_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Removes [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s from this member.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
or actually, no need for the loop
Ye exactly
I guess so
yep
you can remove all at once
does anyone know a discord api for getting server id
just use this
They do the same tho :D
And you might get an error tho
If the bot can't remove a certain role
You will need a loop to handle that.
you mean the default role and integrated roles?
ah right
:)
it's an abstract class, almost all discord models meets this abstract class
!d disnake.abc.Snowflake
class disnake.abc.Snowflake```
An ABC that details the common operations on a Discord model.
Almost all [Discord models](https://docs.disnake.dev/en/latest/api.html#discord-api-models) meet this abstract base class.
If you want to create a snowflake on your own, consider using [`Object`](https://docs.disnake.dev/en/latest/api.html#disnake.Object "disnake.Object").
you haven't decided on a threshold
Oh
can anybody help me
I'm already done, Ty
Indeed. It is just an abstract class which does
class Snowflake:
def __init__(self, id):
self.id = id
help pls
correct me if I am wrong
errors?
ohh
i think that it has some method, i'll search it on github
Since every object has an id property, it has that common property
@maiden fableif you talk me
nope
Your indentation is messed up, why are there three elses back to back?
btw can discord bots timeout an admin
Uhm
does anyone know a discord api for getting server id
If it has the correct perms, yes
even if the admin has a lower role position than the bot
class Snowflake(typing.Protocol):
id: int
oh okay thanks
Yea u can
not if bot isnt above role heriachy
Yea mb
all package based on d.py can access the guild id
Server id based on what?
bro discord api are public .-.
No, which server's id do you want to get?
ik how to get it manually is there a discord api for it that i could request
when I try to fix the tab stop, more errors occur
bro wtf are you tryin to say?
Yes, but you need to tell me which server's id you want to get
what do you mean for "a discord api for it"
I just don't know how else to fix it,_,
🧠
this one for example
you okay now?
nvr
ohsh, take care
And are you using a discord api wrapper like discord.py?
@honest vessel@maiden fable i got missing perms when i try to timeout someone py discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
U cannot timeout with discord.py
!d disnake.Permissions.moderate_members is what u need
im not using discord.py
Returns True if a user can perform limited moderation actions (timeout).
New in version 2.3.
use pycord uwu
That is their wish
It's not discord.py
im using pycord
You would need to be in the guild, and loop over the guilds if you want to get their ID from something.
the "someone"'s role hierarchy is more than bot's
?
I just saw the error and it said discord.errors, so thought they are using dpy
or pycord
Never used that
the lovely forks use the discord namespace
Oh well
they dont even rename the package
they didn't even change the namespace
It wouldn't have raised MissingPermissions. It wouldve raised AttributeError or such
Then I will keep mum
hierarchy means that it is higher than the bot's role?
oh yea, my bad
im trying to timeout my alt whose highest role is admin
And what perms does it have?
oh, and how about the bot's permissions?
The alt
it has admin permissions
Ha
You cannot timeout someone with admin perms czzzzz they are admin perms
Administrator permission bypasses everything iirc
That's not necessarily a bad thing.
And yr alt?
help
admin too but with lower role position than the bot
I know it's for helping people who are transitioning from dpy to that library, but imo they could have just changed it.
U cannot timeout someone with admin perm
Why? It's perfectly normal for a fork to use the same namespace
but the role menu shows only 1 user has the admin role
Take Pillow, fork of PIL for example
since it's well a fork, it's not the same dpy lib
Where
PIL is not maintained , and pillow is the only fork
then how to? I mean perms
unlike discord.py having 10+ forks
U gotta remove the administrator perm
Discord.py is not maintained, and why would someone use multiple forks at once?
oh why though ;-;
I also never really painted it as a bad thing, I was just mentioning it. If anything else was implied, welp, oops
cz admin perm bypasses everything, including timeout
true
someone who works on multiple collaborative projects ( ik venvs is a thing)
oh lmao, I took it the other way around, sorry ;-;
Its fine, happens
Like you said, if someone isn't using venvs for projects then it's their own fault lol
not if bot owns server 😉
themks cutie
?
owner > all
Cool, ig?
Indeed
Is that even possible tho?
!d discord.Client.create_guild
await create_guild(*, name, region=<VoiceRegion.us_west: 'us-west'>, icon=..., code=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
Bot accounts in more than 10 guilds are not allowed to create guilds.
!d discord.Client.create_guild
Tho only bots in less than 10 guilds can do
Jeez lol
private bot and 1 server so
Ahh that’s pretty cool tho
region=<VoiceRegion.us_west: 'us-west'> why is this still there, isnt that feature removed?
cause discord.py is outdated
Yea
mhm, the bot is synced with master branch tho
maybe it was affected after shutdown
shaking my head my head
!d discord.VoiceChannel.rtc_region
The region for the voice channel’s voice communication. A value of None indicates automatic voice region detection.
New in version 1.7.
Yea that
!d discord.VoiceRegion
class discord.VoiceRegion```
Specifies the region a voice server belongs to.
!d discord.Guild.region
The region the guild belongs on. There is a chance that the region will be a str if the value is not recognised by the enumerator.
but last time i tried it i still think it changed? :S
or maybe i changed to command changing server region (useful sometimes when ur area is lagging)
is that right
» microsoft-build-tools
» tools
» off-topic-names
alright
!Rules
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
and technically no one can
ig
!yt-dl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
this isnt discord.js server?
bro ur not the only one i asked it from damn
if u cant help, and if its not allowed then tell me
i did
then shut up now?
How can I handle character spams for example if someone says oooooooooooooooo they should get a warning
maybe remove spaces and go throu letters, if next letter is repeated and count how many repeating if more than X (your choice) send a warningn delete msg
or go word by word and letter by letter in each word
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
?
we dont spoonfeed
is there a way to get CategoryChannel without using other chanels?
there doesnt have to be a rule; we just dont do it
wth, earlier someone was being rude to me about this shit. nobody told them this
Because they didn't continue...
if you dont want to make a discord bot by yourself without being pushed the entire way, dont make one.
anyone know the docs for the button thingies
wdym
do you know what the button thingies are called
not really, buttons are same for all forks
@stiff anvil ```py
string = "this is aaaaaaaaaaa message"
def test_words(message):
for word in string.split(" "):
temp_l=""
i=0
max_i = 5
for l in word:
if i >= max_i:
return "Too many chars!"
if l == temp_l:
i += 1
temp_l = l
print(i)
print(test_words(string))
Nope, some packages imported them differently
!d discord.ui.Button , you would have to include it in a discord.ui.View
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
like?
Let me try it ❤️
dunno, never used them but i know that they exists D_D
oh what's a good one
well its personal preferences, im not a fork fan but i prefer disnake
there is a long list
disnake
!forks
» string-formatting
» for-else
disnake | hikari [personal preference]
pincer
rin
edpy
discord.py
pycord
nextcord```
top to bottom
is it not?
whelp
what does it not have
hikari isn’t a fork
i listed libraries
thats why discord.py users find it weird cause it dont fit to their syntax
my bad then
meh threads are irrelevant
Rin is the best, no doubt
true, there's a pr tho
have you even used it?
Yes, of course
🏃♂️ the model rewrite is still missing a message object , hope andy completes it soon
He is too busy drinking coffee
msg = await client.wait_for('message', check=check) AttributeError: module 'discord.client' has no attribute 'wait_for' eh
what did i do now ;-;
You imported client from discord
yes
Ummm
It replies 10 times
wait_for is a method of discord.Client
async def on_message(message):
for word in message.content.split(" "):
temp_l=""
i=0
max_i = 5
for l in word:
if i >= max_i:
print("1")
if l == temp_l:
i += 1
temp_l = l
await message.reply("Stop spamming characters...")
@honest vessel
how do i fix it ._.
client = discord.Client
just return or break the loop
where ?
discord.client is a module, discord.Client is a class. Create an instance of discord.Client and use the method
Uh
I want it so, If they spam characters, They should get a reply
Perhaps where you warn the user? Idk, it's your app, use some logic and conduct it how you want to
cause u doing it wrong, u should return that await
Can you fix it for me please?
just add return infront of await
How can't you figure this out?
im dumb
no your just newbie
do as i say, add return infront of await
@client.event
async def on_message(message):
for word in message.content.split(" "):
temp_l=""
i=0
max_i = 5
for l in word:
if i >= max_i:
print("1")
if l == temp_l:
i += 1
temp_l = l
return await message.reply("Stop spamming characters...")
yes
I did this tho
but u doing it wrong again
bruh
return await message.reply("Stop spamming characters...") is at wrong place
Yes, And you should've told me earlier 😢
you changed the code
print("1") replace with return await message.reply("Stop spamming characters...")
np
❤️
i think personally discord will make a system for all moderation due to the amount of nitro scams and shit like that - so personally, no
imo yes
where to get a list of all commands related to making a discord bot in python ?
pls tell
- there are hundreds of moderation bots, make something unique
you cant sia what discord-devs gonna do or not, so why not make it it wont take that much effort either way
you basically just want to insert a bunch of precoded commands into your bot…? nice
warnings are just -> insert into db row
no i want all commands of discord module for python
I dont think discord will ever implament warning system for all
How so?
well you get ratelimited shitless cycling through audit logs + you would have to store/cache a lot of data
maybe you are overthinking a warning-system
any answers ?
ratelimits:
or, maybe he just wants a good warning system :O
Audit logs are not a good resource, especially if your goal is to create a public bot
whats not good with insert a row in db?
So inserting a simple document into the database is not efficient?
Ah then you will probably be fine, although I don't know what the ratelimits are like
well theres a bit more to it than just “insert a row blah blah”
What would be the error code command for when the author is not the owner?
like?
!d discord.ext.commands.OwnerOnly
No documentation found for the requested symbol.
ugh now i gotta find it
!d discord.ext.commands.is_owner
@discord.ext.commands.is_owner()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the person invoking this command is the owner of the bot.
This is powered by [`Bot.is_owner()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.is_owner "discord.ext.commands.Bot.is_owner").
This check raises a special exception, [`NotOwner`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NotOwner "discord.ext.commands.NotOwner") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
@is_owner() and add owner_id= to ur bot-construction?
!d discord.ext.commands.NotOwner
exception discord.ext.commands.NotOwner(message=None, *args)```
Exception raised when the message author is not the owner of the bot.
This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
I have discord.ui installed but it won't work.
thats not the question
not required anyways, it will automatically grab the info from application_info
you dont install anything
you install discord.py 2.0
Do you have the master branch installed?
idk whatever tf you installed
ah ok maybe i missunderstood him, but u didnt answer me asking u
Already have it.
Yeah, I think.
ok
@honest vessel this is why ^
can you run python3 -m discord -v
its discord.py
np even tho Caeden said i gave u wrong answers 🙂
not discord
I have discord.py installed
why it ain't showing info on disnake
!pypi disnake
oh alr
my god just run this in a terminal
apparently its both with pip show
!pypi discord
A mirror package for discord.py. Please install that instead.
- Python v3.9.1-final
- discord.py v1.6.0-final
- aiohttp v3.7.3
- system info: Linux 4.9.0-14-amd64 #1 SMP Debian 4.9.246-2 (2020-12-17)
``` caeden wrong again
discord is a mirror package
but if you do pip install discord you install some whack module
discord.py isn't
!pypi discord
A mirror package for discord.py. Please install that instead.
!pypi discord.py
oh?
why are there two
yeah
they changed discord
i dont use it 😄
discord is mirror package, I just said
oh okay
discord was originally some random module
neo@hck:~$ python3 -m discord.py -v
/usr/local/bin/python3: No module named discord.py
py -m pip install discord is what i did
Yeah so install the master branch. Do python3 -m pip install git+https://github.com/Rapptz/discord.py@master
it's the same, discord's ver is also 1.7.3, and discord.py's ver is also 1.7.3 on pypi
Hold up. I got to get lunch.
I don't care, you don't need to tell me that.
lmao
!source docs
Look up documentation for Python symbols.
nah
tho you can find the most at discord.gg/dpy
this server's got far more moderation
indeed
unlucky
true
agreed
I'm toxic? My bad lol, I don't care.
imagine being toxic
there's always some argument
oh wow lol didnt evedn know about this server - but useless now for me anyway
Next time you're unsure of something, just say so.
timtoy on smoke rn
is it possible to make a giveaway bot with those buttons
Guys let’s tone it down a bit
its been like 7 minutes...you're a bit late
everythings possible
Oops
the sky's the limit
has anyone made it yet if they have can you send it
does it bug anyone else when one part of your code displays data as a list, and another part displays the same data as a tuple?
Sure, add the user to the list of participants on click
I bet this is the first time I am not part of a heated argument
what
edited
Remember to ping @ Moderator when things get... heated up
might be to make it tidy / organised even for mobile?
i mean i just want a button with a letter in it so should be small
ask discord
was thinking of making a wordle game but i guess i will use emojis
does this server has the new games that are oout?
ayo dudes
you mean things like Chess? I don't think so, but not sure
Yeah the new pokernights etc
im having some problems with my discord bot
@little fulcrumu dont need to tell us that, just post code ask for help and with errors if any
wait thats a banging idea
i just stole it
but wordle is 6x6
import discord
TOKEN = "nope you're not getting my token"
client = discord.Client()
@client.event
async def on_ready():
print("{0.user} is now online!".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!hello'):
await message.channel.send('Hello there!')
client.run(TOKEN)
why use buttons
when i do !hello it doesnt say "hello there!"
@manic wingi dont mind share my ideas its notlike u stealing my money bro
and yes i did give it permission to send messages
if u want i can dm u my shitty code so far
use wait_for "message"
https://stackoverflow.com/questions/71224906/interaction-failed-discord-py Can someone help me
like this? async def wait_for(message):
your channel id is a string
That just works fine
channel = bot.get_channel(numbers)
where do i put that
instead of channel
They are, yes
id should not be a string
5 rows, 5 columns
But it has to be sent in an specific channel
ik
put ur channel id inside the parenthesis
with or withour "
without
ok
can anyone help?
error?
this
also, dont use discord.Client, commands.Bot is preferred for making commands
hes not using discord.ext
no is there any error message
im using discord.py
what
no it just doesnt send a message back
ext is a folder inside the discord package, its not another library
i get this PException: 400 Bad Request (error code: 50035): Invalid Form Body
In channel_id: Value "hallway" is not snowflake.
ok...
like when i type !hello it doesnt say "hello there!"
!d discord.ext.commands.Bot use this instead of discord.Client
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
i did
and, use functions to create the commands.
@bot.command()
async def image(ctx):
async with aiofiles.open('/path/to/file', mode='r') as f:
contents = await f.read()
embed = discord.Embed(color=0x2f3136)
embed.set_image(url=random.choice(gracieimgs.txt))
await ctx.send(embed=embed)
this
what did i do wrong?
it just doesnt send messages
even though it has permission
and yes it is in my server
yeah...
like killing the terminal and re running it?
yes
still not sending
yes
no caps
i did !hello not "hello" or ?hello
yes
3.10.0
im using VSC
idk i just did "pip install discord" in the terminal
Well, it must be 1.7.3 if you did installed it from PyPi
on_message , not wait_for
Client
yeah i just got into it yesterday
Not helpful but alright
I can't fix this. I have it.
watched a 5 minute indian video
pip install git+https://github.com/Rapptz/discord.py
download dpy from github, ^
I have that.
You don't
make commands using Client uwu
help
Welp, what happened?
you said uwu
Are we allowed to curse?
Smh
Making own command parser is fun 👀
Oh shit it worked.
?
Sure if we dont talk about the consequences
Lol
you can curse but don't be hostile, that's toxicity then
Thanks.
Who even has that much time just for a discord bot anyways
bored people
I'm gonna have a one-week vacation next week and I'm gonna do everything that is possible in a discord bot
BTW @pliant gulch rate my shitty command parser:
signature_of_cmd = signature(command_function)
msg_without_cmd = split(msg)
del msg_without_cmd[0]
params.append(Context(self, message))
num_of_args = (
len(signature_of_cmd.parameters) - 2
) # 3 because 2 for required args and for the last kwarg
args_in_the_message = msg_without_cmd[:num_of_args]
kwargs_in_the_message = [join(msg_without_cmd[num_of_args:])]
params = params + args_in_the_message + kwargs_in_the_message
kwargs_to_be_passed = {
parameter.name: argument
for parameter, argument in zip(signature_of_cmd.parameters.values(), params)
}
await command_function(
**kwargs_to_be_passed
)
And yea, don't ask me what I have done in this since I myself don't understand it now
🗿 that's what all people say
I'm not like all people
Please tell me how can I make a bot with support for different languages using Internationalization ?
I'm meh dpy coder
ye meh
happy procrastination noises
What the hell
I'm gonna change it to pro and change it back as soon as I say something stupid
🤣 don't ask
me gonna have a nickname for 2 hours and then it's gone
Me still waiting for tomorrow to do those dropdowns, passed already few days
Me still waiting to get motivation to work on HunAI again
Just wait another day
you can do it
Meh no one uses the bot anyways ig?
you after 20 years just wait for another day
I will if you fix it
fix your bot, bot
It works perfectly fine tho
no
Girls are gonna call you cool, go do it
i kinda want to make an opensource custom moderation bot 
Meh
so is there any way i could make it return the message you sent to the bot? like doing something like "!say hello world"
Not a reason to start its deving again
i tried using .split to remove the command but it gave me an error
oh so that's how you get girls
hope intensifies
I'd be an old hag after 20 years-
You dont "get" bruh, anyways ot
You both gonna take this to an ot channel yourself or....
you don't?
ash teaching how to get girls?
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
hope decreases
👁️ 👁️
back homie
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
ash never gonna be cool
man leave me alone😔
Weren't u the only one who started it? Ashley
yup
There's a single "y"
bro

nah, in ur 20s you have the most fun
!ot @hoary cargo @slate swan
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
xD
.topic
you would have to use commands
w o w
ew I stepped in shit meme
👁️ 👁️
i hate this new pycharm update
You can hate it all you want in #editors-ides
thanks
just go apply for helper/mod if you are so dedicated to this
pycharm forever the best
There is no application lol
There is none
go make one
Either way very let’s keep it on topic
!ot anyways
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
@eager sorrel
Ok
Im good
robin da bank
Can we stop being ot now?
Please
Invalid Form Body
In channel_id: Value "MYCHANNELSAME" is not snowflake.
help me ik get this error
Can we see the code?
ye
i was ironic the channel stays most of the time on topic, just because sometimes there are some side chitchat i find it quite normal for those who are regulars here and mainly help people, so imo it's useless drama caused for few ot words lol
DM me the invite
seems funny
😂
sentt
I get this error when I try to remove my react to remove to my role. (Code is attached)
dm me invite
U have an answer?
Me.
sent
can u print payload.user_id?
Are the gets even coros?
the remove_role is
remove_roles is a coro
nope
@sick birch
so is your issue interaction failed or the "is not snowflake" error?
Oh nvm
Also I suggest use the buttons that discord.py provides for you instead of a 3rd party library
Wanna test the who asked filter? :D
I'm okay, thanks :p
the second one
okay :D
But the code is just in there
And so, which line is the error in?
it doesnt say that
Can you provide the full traceback?
wdym?
discord.Object(id) to make your own snowflake
Anyone used allowed mentions to none()?
I tried it right now but it on mobile, for the users, it just shows invalid-user
wdym?
!d discord.Object
class discord.Object(id)```
Represents a generic Discord object.
The purpose of this class is to allow you to create ‘miniature’ versions of data classes if you want to pass in just an ID. Most functions that take in a specific data class with an ID can also take in this class as a substitute instead. Note that even though this is the case, not all objects (if any) actually inherit from this class.
There are also some cases where some websocket events are received in [strange order](https://github.com/Rapptz/discord.py/issues/21) and when such events happened you would receive this class rather than the actual data class. These cases are extremely rare.
x == y Checks if two objects are equal.
x != y Checks if two objects are not equal.
hash(x) Returns the object’s hash.
so i do channel = discord.Object(ID)
what is your code right now?
Please tell me how can I make a bot with support for different languages using Internationalization ? Cogs | Disnake | Discord
you're copying code?
No
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
i mean I saw that you have purge(limit=a high number) put several times so I think it's a fair reason to believe what you're doing isn't appropriate
I can explain
👀
especially under a setup command...weird
didnt consider that
!d discord.TextChannel.delete
await delete(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the channel.
You must have [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
raven you forgot to remove the ()
I will make that but only if you help me
sure
yeah i realised lol
But i swear on everything this isnt a nuke
anyways, @slate swan any idea?
what are you doing exactly?
But can someone please tell the answer to my error?
getting role.members, and sending that as send(var, allowed_mentions=disnake.AllowedMentions.none())
and whats the problem?
the method returns all fields to False
probably your client
expected behaviour?
It seems yes
That is a known issue in mobiles
nope
Happens with me too
yeah sometimes mobile clients have that issue which they never display like they never cached it
i made it send in a message with allowed_mentions.none() because if i put embed, msot users won't show
but that is not an embed, a normal member ping
yeah its not your fault
^^^
when a member isnt cached it will show as an invalid-user
ah thought you were referring specifically to embeds
Nope
oh i thought if I ping them it combats that
well, no alternatives then
going back to embeds
yes it should cache them but mobile acts like they didnt cached it
Everyone ignores meeeee
hi
your code looks too sus that's why
.
I can show my server and explain
this is what youre doing
bot.get_channel(None)
ye
an int?, whats that sorry kinda dum
huh
called a snowflake since all ids are unique as a snowflake
integer
ok
a solid number
but an example?
is he trolling rn?
bot.get_channel(267624335836053506)
do embeds have a a char limit? bc regular messages is like 1-2k or smth
thats what i have
yes
darn
why are you using the client to find a channel
ow
seems like its wrong
because you use the client
!d discord.ext.commands.Bot.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
what's the normal message limit, if embed descriptions are 4096, what are normal messages?
What should i do then?
2k normal 4k nitro
yw
because bot.get_channel doesnt work
so i dont know
how about discord.Guild.get_channel
testing
its the same thing
ow
it doesnt work because youre entering NoneType
not testing anymore lol
wdym
^
if the id is wrong the method returns None