#discord-bots
1 messages · Page 735 of 1
haven't figured out how topublish it and also want a bit of feedback as to how i should run it and commands
github lol
hey guys, I have a on_member_join event, how can I make it so it triggers for a specific guild? or carries on the command with a specified guild id or something
@client.event
async def on_member_join(member):
print(member)
thanks
tried adding a guild parameter w/ no lucl
use member.guild to get the guild the member joined
perfect ty
so if member.guild.id == your_guild_id
I have b een working on a discord bot (ELO SYSTEM)
I want to change the nick of the player where there wins are update
for eg:
this is the users first game
his nick say be Night
after adding the win +addwin @sturdy prairie
it must become [wins] nightcentaur
and I was able to solve this but when i want to update the win next time
the nick becomes [2][1]NightCentaur (which is not the expected output)
rather it must be
[2] nightcentaur
can anyone help me also if the person has a server nick i dont want to change that rather keep it the same with updating the wins
Probably not the best solution but you could split on the space, remove the first index in the list and then use " ".join to turn it back in to a string
@sturdy prairie
Also, just realized I was going to have my bots nicknames messed up if people used a prefix larger than 1 character
Thanks to you I caught that and deployed a patch
Wc
I'm not sure if you're like an expert on this, but I'm doing something similar to the code written above and I'm wondering what you mean by "randomly". As in spam? Is it OK to dm them if they're muted, etc?
u can just ask here
mb
I don't see why it wouldn't be okay to dm even if they're muted
Yes as gazes said, you can dm but it honestly depends on whom u are dming and if THEY are fine with it
Thanks for the input
i mean yeah thats a good point ig
How would I check what messaged someone replied to?
dont have much context so i wouldnt know
!d discord.Message.reference i guess
The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.
New in version 1.5.
Thanks
Does the bot respond slower if multiple people are running different commands simultaneously?
Depends on the processing power of the cpu on the host machine
If you have a really under powered machine, you probably will get latency spikes
1 cpu core
and 1 GB of ram i think
Should be good
okk
I have a bot in over 100 servers and it hardly uses up 250 MB of RAM (I have both members and messages intent)
oo nice
Oh. I thought it would take way more
1gb is overkill ngl
Damn I bought a 4 GB raspberry pi and thought that it was too little
Hahaha BTW my bot hardly uses up 0.1% of CPU Core
4 cores (but arm architecture)
do you guys run your bot locally?
It just needs CPU for startup, since asyncio and discord.py, mainly, is ram intensive
No
I'm guessing you're using a VPS?
Yea
Server processors are a lot more powerful than arm cpus
I can run discord with about 60% usage on the pi
Well my bot takes like 0.1% of CPU Core or smth
I'll probably be fine
does channel.permissions_for not return view channel?
@final iron
It should
weird..I'm not seeing it let me check again
Do you know which cpu the server uses?
If it's epyc you got real lucky
!d discord.Permissions.view_channel
An alias for read_messages.
New in version 1.3.
I knew, but I forgot (I ain't using epic host)
is epic host bad?
Idk
Yea it's an AMD for mine
?
Epyc is AMD's server lineup of processors. They're incredibly powerful
Ah that. Idk bout that. Thought u were talking about Epic Host lol
Yeah, nah
is there any way i can make my discord bot set people on timeout?
Railway?
Nah epyc processors are expensive
You don't get that for free
No
The ram usage isn't much at that range
If you bot hits over a 1000 servers then you will see a significant difference
Any help?
does it work now
It doesn't take member object
@slate swan
and you creating an argument member that takes a member object
ik
I just forgot to delete it
I copied it from my first code you see
wait @untold token did i get it correct
and because the errorhandler deco doesn't pass that value, you get than error
Yes it works
Yeah its correct
It only takes commands.Context object and Exception
Good luck
u2
anyhelp
#giveaway system
@client.command
async def gstart(ctx, mins : int, , reason:str):
embed = discord.Embed(title="Giveaway!", description=f"{reason}", colour=discord.colour.gold())
end = datetime.datetime.utcow() + datetime.timedelta(seconds = mins60)
embed.add_field(name="Ends at:", value = f"{end} UTC")
embed.set_footer(text=f"Ends in {mins} miniutes!")
my_msg = await ctx.send(embed=embed)
await my_msg.add_reaction("🎉")
await my_msg
await asyncio.sleep(mins)
new_msg = await ctx.channel.fetch_message(my_msg.id)
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(users)
await ctx.send(f'Congratulations {winner.mention} won {reason}!')
bot doesnt respond
await my_msg doesn't have ()
that'd be my guess
And it's discord.Colour
but what are you even awaiting in that line
And you can remove that actually
Is text-to-speech possible?
Hey, what is the new system how discord bots using animated emojis
oo
!pypi gTTS
So little information on it
lemme give it a rty
To send, for example, this emote:
. You need to send !T_anidance
nvm it
Simply add a \ before sending the emote here in chat, then copy paste it.
I wrote it wrong
it's stupid that normally you need nitro to get the id except you are cheating
You don't need to.
You can use inspect element or copy the emoji ID from the link.
@slate swan
ok ill message from this it doesnt work
my code
#giveaway system
@client.command
async def gstart(ctx, mins : int, , reason:str):
embed = discord.Embed(title="Giveaway!", description=f"{reason}", colour=discord.Colour.gold())
end = datetime.datetime.utcow() + datetime.timedelta(seconds = mins60)
embed.add_field(name="Ends at:", value = f"{end} UTC")
embed.set_footer(text=f"Ends in {mins} miniutes!")
my_msg = await ctx.send(embed=embed)
await my_msg.add_reaction("🎉")
await asyncio.sleep(mins)
new_msg = await ctx.channel.fetch_message(my_msg.id)
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(users)
await ctx.send(f'Congratulations {winner.mention} won {reason}!')
@slate swan what did i do wrong
!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.
async def gstart(ctx, mins : int, , reason:str):
embed = discord.Embed(title="Giveaway!", description=f"{reason}", colour=discord.Colour.gold())
end = datetime.datetime.utcow() + datetime.timedelta(seconds = mins60)
embed.add_field(name="Ends at:", value = f"{end} UTC")
embed.set_footer(text=f"Ends in {mins} miniutes!")
my_msg = await ctx.send(embed=embed)
await my_msg.add_reaction("🎉")
await asyncio.sleep(mins)
new_msg = await ctx.channel.fetch_message(my_msg.id)
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(users)
await ctx.send(f'Congratulations {winner.mention} won {reason}!')```
Why are there 2 , after the mins arg
if I wanted to make a rule command where you'd do ?rule [rule number], what's the most efficient way to define each rule number with the given rule?
nice pfp
command groups
The error you get?
@bot.group()
async def rule(ctx):
pass
@rule.command(name="1")
async def rule_1(ctx):
....
What about making a list and indexing it for the rule
sure , you would have to manage index errors exceptions in that case
Isn't it index error
yea my bad
Well i guess doing command groups for this would be bad because there are many rules
Hi guys
When i code in replit
And make 2 files on top of each other only one file works, the other one doesnt respond. When i try them single they work fine, why doesnt this happen to other people also? I see some repls with 100 files
If I have commands. group smth like this py @commands.group() async def foo(self, ctx) ... @foo.command() async def bar(self, ctx) ... can I make a subcommand for bar even it is alrd a subcommand?
So it would be like !foo bar <another command>
sure py @bar.command() async def yet_another_subcommand(...
what kind of files ? replit can run only 1 file at a time
So foo command would look like this? ```py
@foo.command()
@commands.group()
async def foo(...
you want it to be same as the main command name?
Oh no, I mean bar
I mean do I need the @commands.group() to make a new subcommand for bar?
lol
We don't help with music bots
RZ
I never asked for help in music bots- are u blind or sum
RAID ZONE
I'm not blind afaik
import discord
import os
import math
import random
from discord import user
from discord import client
from discord.ext import commands
prefix = '.'
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if client.user.mentioned_in(message):
embedVar = discord.Embed(title="**Settings for this server**", description="", color=0x004AEB)
embedVar.add_field(name="Info:", value='The prefix is set to: ' + '``' + prefix + '`` \n \n Type ``.commands`` for the list of commands', inline=False)
#embedVar.add_field(name="Field2", value="hi2", inline=False)
await message.channel.send(embed=embedVar)
if message.content.startswith(prefix + 'commands'):
await message.channel.send('__Comming Soon!__') #commands```
is it dumb that i use client
If you want to make commands you might not want to use client
Hello
hi
use commands.Bot instead of client, and maybe rename client to bot
Me new to python coding
Cool
okay thankss
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
thanks
And this might help
Just wanted to know why my ban command is not working
Hi, I have seen some people create websites where once a user authorizes a discord app connection to their account, the user can click a button to join the server without any extra effort. How exactly can I do this with discordpy?
Share the code, and possible traceback
Yes
It is done via OAuth2 section in developer portal
where do i put commands.Bot?
In the place you had discord.Client
oooo i see im dumb thanks
Oh gotcha, I'll check it out thanks!
import discord
from discord.ext import commands
client = commands.Bot(command_prefix="T!")
@client.event
async def on_ready():
print("Bot is ready")
@client.command(aliases=['k'])
async def kick(ctx,member : discord.Member,*,reason= "no reason provided"):
await member.send("You have been kicked from the server , because:"+reason)
await member.kick(reason=reason)
This is the command and the traceback tells that I don't have the permission even when I and my bot both have admin perms
import discord
import os
import math
import random
from discord import user
from discord import client
from discord.ext import commands
prefix = '.'
Bot = commands.Bot()
@Bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@Bot.event
async def on_member_join(member):
print(member)
@Bot.event
async def on_message(message):
if message.author == client.user:
return
if client.user.mentioned_in(message):
embedVar = discord.Embed(title="**Settings for this server**", description="", color=0x004AEB)
embedVar.add_field(name="Info:", value='The prefix is set to: ' + '``' + prefix + '`` \n \n Type ``.commands`` for the list of commands', inline=False)
#embedVar.add_field(name="Field2", value="hi2", inline=False)
await message.channel.send(embed=embedVar)
if message.content.startswith(prefix + 'commands'):
await message.channel.send('__Comming Soon!__') #commands```
so like this?
client.user is invalid now
appricate the help!
Hi guys. anybody help me? my problem: (I try to create " Wait for responses" command, but not work)
!paste the traceback in here
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.
Ok
Was it a command
Or u wanted me to paste it here
?
whom are you trying to kick,? is bot's role is above their role?
Paste it to the website in embed
Ok
use this kick
@commands.has_permissions(kick_members=True)
@client.command()
async def kick(self,ctx, user: discord.Member, *, reason="No reason provided"):
await user.kick(reason=reason)
kick = discord.Embed(title=f"💥 Kicked {user.name}!", description=f"Reason: {reason}\nBy: {ctx.author.mention}")
await ctx.channel.send(embed=kick)
await user.send(embed=kick)
O i forgot about the role
Thanks
👍drag bot's role above
Thank you
import discord
import os
import math
import random
from discord import user
from discord import client
from discord.ext import commands
Bot = commands.Bot(command_prefix=".")
@Bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(Bot))
@Bot.event
async def on_member_join(member):
print(member)
@Bot.event
async def on_message(message):
if message.author == Bot.user:
return
if Bot.user.mentioned_in(message):
embedVar = discord.Embed(title="**Settings for this server**", description="", color=0x004AEB)
embedVar.add_field(name="Info:", value='The prefix is set to: ' + '``' + prefix + '`` \n \n Type ``.commands`` for the list of commands', inline=False)
#embedVar.add_field(name="Field2", value="hi2", inline=False)
await message.channel.send(embed=embedVar)
if message.content.startswith(prefix + 'commands'):
await message.channel.send('__Comming Soon!__') #commands```

how do i make the prefix work now?
The are no commands yet
How can I put the code from the right hand side as a command in the code on the left hand side? (though like make it so that the right hand side code just runs the program on the left when the command >save is sent
oh
btw pls use .env 😄
Guys using replit is better or should I use download the software
True
yea soz ima switch to that as soon as im done with it xD
id say vscode
I don't find anything better than vs code + github
anybody?
Basically how can I make a command file which runs the code on the right when I send the command >save
nice pfp
Ok
thanks
show your code
Where are u doing this
vsc
Ok
btw
user arg needs to be defined
As I am new so i can ask silly questions so pls don't mind😅
👍
aand how?
Ig it's a chat bot ( maybe )
You know him the dank memer stick? a hack like that commands make, only totally some other way
all in bot 😄
@Bot.command(aliases=[])
Oo
secondary name for command
owh
client.command(aliases=["hello"])
async def hi(ctx):
dm me
till now 2300 next ones
It will do what u want the bot to do
It's lick a nick name ( a secondary name for your command )
not work
what does the error say
Seems like you are in a cog. You shouldn't use client.wait_for but self.client.wait_for()
check it out
thanks for the kick cmd it worked but i made some changes according to me
I?
raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: No overwrite provided. ```py
@bot.command()
async def v(ctx):
overwrite={
ctx.guild.default_role:discord.PermissionOverwrite(read_messages=False),
ctx.me:discord.PermissionOverwrite(read_messages=True),
ctx.author:discord.PermissionOverwrite(read_messages=True),
}
await ctx.channel.set_permissions(ctx.author)
await ctx.message.guild.create_text_channel(f"Verify {ctx.author}", overwrites=overwrite)```
?
Does anybody know any free hosting service beside replit?
I know replit isn’t exactly hosting service but is works like this a little
Epikhost I guess
Ok
I need to move my bot from replit because it keeps crashing
.send takes a file/files kwarg
!d discord.File
class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.
Note
File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
@Bot.event
async def on_message(message):
if message.author == Bot.user:
return
if Bot.user.mentioned_in(message):
embedVar = discord.Embed(title="**Settings for this server**", description="", color=0x004AEB)
embedVar.add_field(name="Info:", value='The prefix is set to: ' + '``' + Bot.command_prefix + '`` \n \n Type ``.commands`` for the list of commands', inline=False)
#embedVar.add_field(name="Field2", value="hi2", inline=False)
await message.channel.send(embed=embedVar)
@Bot.command(aliases=["commands"])
async def help_command(ctx):
await ctx.channel.send("__Coming Soon!__")```
Why cant i have these **both** at the same time? they work but only if i remove the other
same here idk why it happens
?
thankss
works good now!
if str(payload.emoji) == "✅":
msg = await channel.fetch_message(payload.message_id)
msg_user = discord.Embed.to_dict(msg.embeds[0])
pre_user_id = msg_user["fields"][0]["value"]
user = await bot.fetch_user(pre_user_id)
guild = bot.get_guild(payload.guild_id)
role = discord.utils.get(guild.roles, name="Verified")
await user.add_roles(role)
print("[INFO]: Verified" )
```
I get this error ``AttributeError: 'User' object has no attribute 'add_roles'`` Anyone got any idea why
i mean the error says why
yeah but an idea on how to fix it
member object
okay I changed it, but I this error now: AttributeError: 'NoneType' object has no attribute 'get_member'
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
if payload.member.bot:
return
channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
if str(payload.emoji) == "✅":
msg = await channel.fetch_message(payload.message_id)
msg_user = discord.Embed.to_dict(msg.embeds[0])
pre_user_id = msg_user["fields"][0]["value"]
guild = discord.utils.get(bot.guilds, name='Cosmic Overground')
user = await guild.get_member(pre_user_id)
guild = bot.get_guild(payload.guild_id)
role = discord.utils.get(guild.roles, name="Verified")
await user.add_roles(role)
print("[INFO]: Verified" )
```
Instead of using a url in a embed thumbnail, is it possible to specify an image file?
I think, here:
guild = discord.utils.get(bot.guilds, name='Cosmic Overground')
user = await guild.get_member(pre_user_id)
-->guild = bot.get_guild(payload.guild_id)<--
role = discord.utils.get(guild.roles, name="Verified")```
it should have been
```py
user = await self.guild.get_member(pre_user_id)
AttributeError: 'SomeCommands' object has no attribute 'guild'
😭
SomeCommands is the class btw
just a min
sure
how would that work
self.guild = guild?
wait nvm I have no idea how I would do that
lets ignore
I guess that will work
i cba cause then I need to change like all of the code
can you interchange 4th line from last with 5th line from last?
user = await guild.get_member(pre_user_id)```
swap them?
yes
this wouldn't work cause then guild is undefined in the user statement
ah
I found the problem
guild = discord.utils.get(self.bot.guilds, name='Cosmic Overground')
user = await guild.get_member(pre_user_id)```
bro
this was actually so simple, thank god I know now - one of my variables was assigned poorly so it was none "guild = discord.utils.get(self.bot.guilds, name='Cosmic Overground')" like the name was wrong
hence the none type error
gotta remember that
cool then, I'm not so good at discord.py module, did not used it in past 9 months so forgot all... need to revise everything...
haha Im just learning
@kindred drum @exotic patrol don't await get_xxx calls

@bot.command()
@commands.is_owner()
async def start(ctx):
y = ctx.guild.members()
v = ctx.guild.fetch_role(123)
await ctx.send("Yes!")
while True:
for a in y:
try:
if a.Game("VALORANT"):
a.add_roles(v)
else:
try:
a.remove_roles(v)
except:
pass
except:
pass```
I made this command and it says that list object is not callable, what is it?
y = ctx.guild.members()```
why does this happen?
cz members is a property, not a method
yes yes I got it, but how do I get all members in a list?
it's already a list
can I get all 5000 people in a list?
user = guild.get_member(pre_user_id)
print(user)``` user doesn't get assigned, not sure why. pre_user_id is the string if a certain user. It gets assigned for sure
!d discord.File
class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.
Note
File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
and , read the the link in above embed's description
how can I make it so that the code on the right will execute the code on the left if I do >restore?
I like your implementation very much BUT
have you seen commands before? you'll love them
i mean im tryna make something rlly basic.. not actually using commands xD
well, somehow you are, via the >verify
which basically makes > your prefix and verify your command
yea.. true
apart from that, you can perfectly run functions from another file by importing them
Isn’t message.author already a str?
So I just do like py import main?
Or am I dreaming
if your main file is the one with the API calls in, yes...
also, you seem to be using API requests instead of just using the discord py library for all that? it's basically a wrapper for all that you're trying to do xd
true..
so like? ```py
import main
if user_message.lower(py main.py) == ">restore":
embedVar = discord.Embed(title="Restoring in progress.", color=0x00ff00)
await message.channel.send(embed=embedVar)
return
Hi guys, anybody help me? they would take a liking to it to nominate people_nation
no, to use a function from that file
you can just do
main.shit_function()
i am trying to make a dropdown menu command but I am getting this error
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Object of type Embed is not JSON serializable
codes:
options = [
disnake.SelectOption(
label=" Parody Commands", description="All Parody Doujinshi Commands", value=embed
),
disnake.SelectOption(
label=" Commands", description="All Video Commands", value='hmmm'
)
]
super().__init__(
placeholder="Help",
min_values=1,
max_values=1,
options=options,
)
async def callback(self, interaction: disnake.MessageInteraction):
await interaction.response.send_message(f"{self.values[0]}")
class DropdownView(disnake.ui.View):
def __init__(self):
super().__init__()
# Adds the dropdown to our view object.
self.add_item(Dropdown())```
how do you invoke the command?
pingeles
you need to add a member ofc, smart you
pingeles @tacit token
just like that
but like i just want it to run the whole main.py if >restore is ran
I would like it so, that if somebody writes it in, that pingeles and writes a name there, marks it then
I'd guess that you can't put an embed as value
@tacit token what are you trying to do?
show me the function that has to be ran when you run main... (you'll have to put it in a function, not just loose outside of a function)
well, you didn't write a names, ofc it errors then...
example: >pingeles @devout coral (and random user pinged)
works perfectly
do that and it'll work...
just basically add this one line
await ctx.send(user.mention)
you have to use the context if you want to get the users name that was pinged
its just u run the whole file...
ig it's "add_to_guild"?
and how?
please just use discord py for this, it's made for specifically that purpose, so you won't have to write api calls yourself
also, you're using a sync requests library, which is blocking
await ctx.send(user.mention)
Just as side note, I would rename your bot to something else than "Wumpus". Especially if it gets popular, it won't get verified by Discord.
as we told you many times before
.
so i can use the command .help moderation
eh i dont want it to get verified anyways
you want to make a custom help command, right?
its a test bot
yeah
Oh okay then it's good, just informing ^^
you have to make a way to handle if someone does a help for a cog
or command, etc
huh
the best way is the HelpCommand subclass
just check out the link, you'll be busy for a while
@Bot.command()
async def help(ctx):
em=discord.Embed(title="Help", description = '**' + Bot.command_prefix + 'help <command>**',color=0x004AEB)
em.add_field(name="moderation", value=":white_check_mark:", inline=True)
em.add_field(name="reactionroles", value=":white_check_mark:", inline=True)
em.add_field(name="currency", value=":white_check_mark:", inline=True)
em.add_field(name="levels", value=":white_check_mark:", inline=True)
em.add_field(name="music", value=":white_check_mark:", inline=True)
em.add_field(name="other", value=":white_check_mark:", inline=True)
em.set_footer(text='Use these commands to get further information about them' + '\nInformation requested by:')
await ctx.send(embed=em)
@Bot.command()
async def help_moderation(ctx):
em=discord.Embed(title="**Coming soon...**", description ="",color=0xFF0000) #Coming soon
#em=discord.Embed(title="**Moderation**", description ="**Info about moderation:**",color=0xFF0000)
#em.add_field(name='.', value='.', inline=True)
await ctx.channel.send(embed=em)```
totally wrong
i just want another one thats .help moderation
this is so inefficient
stop whatever you're doing and start reading that link
bro why does everyone tell diffrent shi, ive been restarting withmy code for 5 times already cuz ppl tell me to
ugh
- use subclassing it's better
- if ure doing it that way atleast use command group
you have to listen to the right people I guess
idk who the right ppl are..
if someone helps me and it works i think theyre
thnx tho guys
what you have to do is:
If you REALLY want confirmation, go to the dpy server and ask active helpers, they basically helped writing the library and know what's best.
we just learn based on what they tell us
create the base help command
find a way to handle if someone does .help cog or .help command
display it
ah okay
dont use dpy
but i dont want the built in feature tho
im creating my own help
idk, whatever fork you like I guess
I have this if i do .help
terrible
i just want to be able to do .help moderation
by subclassing, u can edit how the default help looks
start reading the link, you'll have to start over again
oof
@solar anchor
im sick of this lol
nah, you'll thank yourself in the end
yeah i have it infront of me thnx
i made a whole help command with views, dropdowns, etc with HelpCommand
ive been thinking this is the end for 5 times xD
and it handles everything
okay thanks ill just read it and start over
thanks guys!
what lib're you using? since dpy v2+ can handle that tho?
i need to create a class right?
the link tells you..
nextcord
i dont use dpy. its dead
I'm currently still using it, my bot is private anyways, I only use it for these purposes:
.
my bot is public and hosted
can i use my embed tho?
but i archived it and stopped development for a bit since my old disc with it got hacked
just read through first, then ask questions
ofc you will
okayy
better passwords
No, Afaik token logging bypasses 2fa
so that's 100% normal if u got token logged
ah
an extra ) at the end mate
you need await message.channel.send(file=...)
that's how it'll work out for you
you haven't tried it, try it first
if it still doesn't show me the code
true, don't ever use that shity
<@&831776746206265384>
f = discord.File("some_file_path", filename="image.png")
e = discord.Embed()
e.set_image(url="attachment://image.png")
await messagable.send(file=f, embed=e)
Note that the filename in the File constructor and the filename in the URL must match, and must be alphanumeric.
try this and come back and tell me it worked ofc
!ban 927658763278745610 joined to spam a crypto ad
:incoming_envelope: :ok_hand: applied ban to @tawny kelp permanently.
is nice
probably nowhere
how can i fix this?
there's no issue
fixed
if people express interest of their own volition, we're not stopping you, but please don't advertise such that it disrupts the community
it cannot import ui
well, you've installed discord py 1.7.3 and ui is only there since v2+
oooh
open a modmail thread by DMing @novel apex
where can i install the good version?
bing bong
pip install -U git+https://github.com/Rapptz/discord.py
i dont think so
then do it
How do I make a two player game using discord. py
or pip won't work
i think that
what interactions?
i had problems with this before
How is urs 24/7 mine goes offline like every 1hr or so
discord.py is a discord API wrapper not a game creation library'
yeah, add python to PATH
I host 24/7 with a VPS
idk how?
you can make games on bot using discord.py
oh
checkbox whilst installing python that says: "add to PATH"
no I meant buttons?
do i install it again then?
there was something about environments and stuff but I dealt with that a year ago so idk
Like without buttons
whatt
Like when two players input the same command, they become player 1 and 2
can I eat my lunch?
I mean that's unnecessary but ok
No one's stopping you to
questions keep sticking to my head
it's stopping me from eating
so I go back to answer them
It's a you problem, sir
ig it is
Now have a good lunch
Install discord.py
U dont have the library
pip install discord.py
In the cmd
Try this https://youtu.be/dj5oOPaeIqI
Install python from scratch:- https://youtu.be/oa9BYgEzb_I
Hi Guys, In this video, we will see, solution of python/pip/pip3 is not recognized as an internal or external command. You might get python is not recognized as an internal or external command operable program or batch file error. So here is the solution to this pip is not recognized as...
Watch the whole video
can i use json and python ?
Yes
how i can import that file
Same but it still goes offline
import json and then you gotta open file like py with open ("filename.json", "r") as f: l = json.load(f) so if u want to get
ok
"name": "Fessor",
"age": 10
}```
i made this json file
now how i print name in pyhton
prolly gotta specify guild ids in the @slash.slash()
install in cmd, no powershell needed
wheres cmd?
bruh, that's command prompt on windows
i error
then what's the URL ? another image?
python -m pip install ...
which isn't the same as the one you stored locally?
bruh, just do discord.Embed()
embed.set_image(url=...)
you don't need to do all that local stuff I sent you earlier
pip install the previous shit I sent you ofc wow
you forgot python...
do i have to use a seperate web socket for voice connections?
A Python wrapper for the Discord API forked from discord.py
!pypi disnake
or use hikari
Voice connection uses datagram right
do u have git installed?
!pypi pincer
probabaly not
What
gr8
aight
but ill still recommend using a fork instead of the master branch , since you'll need to update to slash commands and new discord features anyways
simple fix: reinstall python
for create_thread, what's a public thread?
ill just reinstal again
type git in the command prompt
is it necessary to encrypt for sending voice data
got error
it means u dont have git installed
eh?
Datagram connection have TLS support iirc (yeah DTLS)
so why not do that
if i run this people just get kick for always and can't even join back
anyway to break it?
"lol banned" lmao
Cooldowns in discord.py
Cooldowns can be used in discord.py to rate-limit. In this example, we're using it in an on_message.
from discord.ext import commands
message_cooldown = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user)
@bot.event
async def on_message(message):
bucket = message_cooldown.get_bucket(message)
retry_after = bucket.update_rate_limit()
if retry_after:
await message.channel.send(f"Slow down! Try again in {retry_after} seconds.")
else:
await message.channel.send("Not ratelimited!")
from_cooldown takes the amount of update_rate_limit()s needed to trigger the cooldown, the time in which the cooldown is triggered, and a BucketType.
this may be helpful
i just press install now right
@slate swan u can use something like that , and kick/ban or any action instead of sending a message
ok letme try
!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.
please use codeblocks
bad indentation
at discord.Embed
@solar anchor u need to install git first ...
my bad
sure
Hi, I have this task which cycles through a few different status msgs however it broke a while ago and I'm not sure why as It's not giving me any errors as far as I can see. (by broke I mean it's not been showing a status msg on the bot for some time)```py
class Events(commands.Cog):
def init(self, bot):
self.bot = bot
self.statuses = []
self.status.start()
@tasks.loop(minutes = 5) # seconds = 10
async def status(self):
await self.bot.change_presence(activity = discord.Game(next(self.statuses)))
@status.before_loop
async def before_status(self):
await self.bot.wait_until_ready()
data = await self.bot.get_data(448405740797952010)
users = sum(await self.bot.comm.handler("user_count", self.bot.cluster_count))
self.statuses = cycle([f'/help | {self.bot.config.default_prefix}help', f'{self.bot.config.activity}', f'{data[13]} is the current count', f'RaidMode is {"Enabled" if data[14] is True else "Disabled"}', f'{data[15]} is the required age for new accounts when raidmode is enabled.', f'Latency: {round(self.bot.latency * 1000, 2)}ms.', f'CPU Usage: {psutil.cpu_percent(interval=None)}%', f'RAM Usage: {psutil.virtual_memory().percent}%', f'I can see {str(users)} users', f'Python Version: {platform.python_version()}', f'Discord.py Version: {discord.__version__}', 'I support slash commands', ])```
hello
I have a query will embed.description = 'text' will work if i want to set the description of the embed
where can i get an example of this
Looks fine to me
yeh
doesn't discord.Embed need to be indented to be part of the async block?
Yes
That's still wrong 😩
I don't think you need embed.set_image, think it's just set_image
can anyone help
First create the instance then use set_image with it
but do you need to do that if your inside of the embed object? thought you only had to do that if you'd escaped the object, which i don't think they have
!d discord.Embed
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
See There's no parameter for setting image
You are not allowed to use that command here. Please use the #bot-commands channel instead.
set_image is an instance method so do this ^
I don't understand what you asking
this is so weird in on_message_delete msg = await channel.send(embed=em) AttributeError: 'NoneType' object has no attribute 'send'
@commands.Cog.listener("on_message_delete")
async def on_message_delete(self, message):
guild = self.bot.get_guild(self.log_guild_id)
channel = self.bot.get_channel(self.log_guild_id)
that just means you're not using disnake in your file, nothing to worry about.
🕴️
Nova are you normal now?
It wasn't found in the cache most likely, can you try fetching it?
aaah
No I'm a physco, just caused a drama
you're using the same ID for get_guild and get_channel?
Oh…I’d better leave soon 😳
@visual islandno checked that
👍
What's the type of log_guild_id
Is it supposed to be indented like that?
They’re using the same ID 
yeah indentation is fine, now i get this with try fetching
disnake.errors.NotFound: 404 Not Found (error code: 10003): Unknown Channel
Ohh I didn't see that smh
You seem to be using the same ID
channel = self.bot.get_channel(self.log_guild_id) or await self.bot.fetch_channel(self.log_guild_id)
Yeah lol
its not same id
Bro
No no my bad they are right
Is it getting the guild obj or no
U there 😦
Host says No module named 'disnake'
and gets crashed

Maybe you didnt pip install it 😦
ahh wait
was just updating to disnake forgot to set a requirement for it
sorry my bad
ok
yeah it gets guild obj but seems to say channel not exists, even bot is in that channel kek
oh i found error
yall missed it
That's because you are using same Id as ice and dek said
Which channel is it? Try getting the channel ID and c- what
O
That's what I'm saying
💀
eeeh still same what the F
raise NotFound(response, data)
disnake.errors.NotFound: 404 Not Found (error code: 10003): Unknown Channel
Get the channel variable and compare it with the channel ID you’re tryna get
Finally
guild.fetch_channel(self.log_guild_id) kek
🤨 exactly

only if you didn't ignore this person ^
yeah i checked ID it self but my eyes didnt catch the variable was same
Same lmao
Smh
channel = guild.get_channel(self.log_channel_id) or await guild.fetch_channel(self.log_channel_id) here we go thanks tho
i am lil dissy today maybe covid on its way :/
or i havnt woken up fully yet
Quick question: What's the function to change a user's Game Activity again?
!d discord.Client.change_presence
await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the client’s presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
``` Changed in version 2.0: Removed the `afk` keyword-only parameter.
Cool, thanks
Hmm...
How can I use slash command without discord.py 2.0?
I am useing discord.py 1.7.3 :(
But I'd like to use slash command
If you know any librarys, Please DM me.
I want to keep useing discord.py 1.7.3
guys is there a website or why dont this discord have a channel like where you can post functions or commands that are completed for others to use / get inspiration ?
and maybe peoples can react to it, if too many negative reaction it removes the codepost
so community itself can keep relevant code and remove shitty functions
(can u make a public github where other users can post in without accept them?)
you cant, you can use this extension made by a helper in the discord.py server tho https://gist.github.com/XuaTheGrate/5690a3d9dadb280d3d15f28f940e02d1
and iirc you can use this even on 1.7.3
Kk thanks
hello
i need a smol help
if message.content.startswith('~wikipedia'):
x = wikipedia.search(message.content[11:len(message.content)])
await message.channel.send(wikipedia.page(x[0]).url)
so i tried running ~wikipedia india
to search for india and for it to send the url
but
it does not reply, and instead, i get this error on the terminal on which the bot is running:
/usr/lib/python3.10/site-packages/wikipedia/wikipedia.py:389: GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 389 of the file /usr/lib/python3.10/site-packages/wikipedia/wikipedia.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.
lis = BeautifulSoup(html).find_all('li')
Ignoring exception in on_message
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/home/govind/Desktop/bot.py", line 20, in on_message
await message.channel.send(wikipedia.page(x[0]).url)
File "/usr/lib/python3.10/site-packages/wikipedia/wikipedia.py", line 276, in page
return WikipediaPage(title, redirect=redirect, preload=preload)
File "/usr/lib/python3.10/site-packages/wikipedia/wikipedia.py", line 299, in init
self.__load(redirect=redirect, preload=preload)
File "/usr/lib/python3.10/site-packages/wikipedia/wikipedia.py", line 393, in __load
raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)
wikipedia.exceptions.DisambiguationError: "indian" may refer to:
is this complete code?
no this is the part dealing with the wikipedia search
send the code of complete command
i have imported the wikipedia module
you mean the whole bot?
no of wikipedia command
yes that is the complete code for the wikipedia command
did u import wikipedia
yes
i checked it is installed on my system as well
em looks like a different one
@slate swanit tells u to add features="lxml", so lis = BeautifulSoap(html, features="lxml").find_all('li')
on the first notice
so do i put it in the code?
lis = BeautifulSoap(html, features="lxml").find_all('li')
this command
can anyone explain this error please. disnake.ext.commands.errors.BadArgument: Converting to "float" failed for parameter "time". I just switched to disnake rn. This is the command py @bot.command() async def timeout(member: disnake.Member, time: float = None, *, reason=None) -> None: await member.timeout(duration=time, reason=reason)
we can be lil quick
oh duration (Optional[Union[float, datetime.timedelta]]
int too gives out the same thing
so i guess time: Optional[Union[float]]
nvr used this typehint before so let me know how it works
what is Optional and Union
this is what it sais in documents duration (Optional[Union[float, datetime.timedelta]]
yes optional duration
i cant help explain it cause i dont know myself (waiting for someone to do )

i want to display multi images in an embed how?
only 1 image can be
however we can also add in author, footer, and thumbnail too
thing is i am doing a msg delete event that is going to log and i want to display images from attachments from that deleted message
i guess i will display only first attachment and rest just being urls
well such logging is against TOS
and I have experienced that only the first one is logged
Note that uploaded images to Discord will be removed from the CDN once the message is deleted. So even if you log images, after a few hours you won't even be able to see it anymore in your logging channel.
is the library keep_alive made for python bots?
what backs up your claims ?
logging images are totally fine.
I have never seen someone use 3rd party lib called "keep_alive"
its for replit users i assume
I saw someone using it on stackoverflow because I wanted to search a question and I wanted to see it
so its not a library
correct
alright
check the library ig ?
ye, this exists but might not be the one you are looking for
to make a command answer differently for each different person can I use the username if it is a valid thing
if username == "VDP":
await ctx.reply("Hi VDP")
like this
and use the else if it isnt a valid username
hey
Not sure if this is what you need, maybe you want to put the name of the person to reply?
@kind wind i would reccommend use discordID cause usernames can always be changed
Like you can't code if statement for every person
In this case it would be
await ctx.reply(f'Hi {username}')```
you can make a list of discord IDs
greeting_list = [1234567, 988587817]
if ctx.author.id in greeting_list:
await ctx.send(f"Hi! {ctx.author.mention}")
and u prob want to do display_name instead of username?
and if u want custom lines then do like a dict.
dict_msg = {"1234567": "Hi mate! {} how are you", "8756781625": "Oh not you again! {}"}
ctx.send(dict_msg[str(ctx.author.id)].format(ctx.author.display_name))
something like this improvised
idk anymore how to use it... but i want to make these
main_command command arguments
like this
settings prefix
settings volume
😪
List_convo = ['good', 'Good']
@bot.event
async def on_message(msg):
if msg.content.lower() == 'hi':
await ctx.send('hi')
await bot.wait_for('how are you')
await ctx.send('good how are you')
await bot.wait_for(List_convo)
await ctx.send('Bye, I gotta go. Until the chat dies!')
@bot.event
async def on_message(msg):
if msg.content.lower() == 'Hi':
await ctx.send('Hi!')
await bot.wait_for('How are you?')
await ctx.send('Good how are you?')
await bot.wait_for(List_convo)
await ctx.send('Bye, I gotta go.')
```No errors but the bot don't work.
How to make buttons
@slate swandosnt python have eval()?
you don't, use the one jishaku has
This is not a Modmail thread.
you know why, right?
Can nyone tell me how to add buttons in bot
check the documents first ?
Like a button which can take me to the voting site
?
you can also tell chat what library u using
No.
whats the thing? why two events ? its same
One for lowercase and uppercase./
ok tips, do like message = msg.content.lower() and now u can ignore uppercase
I do have discord imported.
you're shadowing functions
@bot.event
async def on_message(msg):
if msg.content.lower() == 'hi':
List_convo = ['good', 'Good']
@bot.event
async def on_message(msg):
message = msg.content.lower()
if message == 'hi':
await ctx.send('hi')
await bot.wait_for('how are you')
await ctx.send('good how are you')
await bot.wait_for(List_convo)
await ctx.send('Bye, I gotta go. Until the chat dies!')
your wait_for is wrong
check out some examples in the documentation
you have to wait_for an event
wait_for(event, *, check=None, timeout=None)
@client.event
async def on_message(message):
if message.content.startswith('$greet'):
channel = message.channel
await channel.send('Say hello!')
def check(m):
return m.content == 'hello' and m.channel == channel
msg = await client.wait_for('message', check=check)
await channel.send(f'Hello {msg.author}!')``` example
def check(m):
return m.content.lower() == "good"
``` kinda like this
deleted images
lol thats kinda dumb, if u logg all images, then what does deleted image do ?
maybe u log an image that is later on deleted
error ?
but yes one is int one is string and u have +
read TypeRrror msg
basic python
hint ||convert your round() into a string||
i meant deleted images 🤷♂️
Still no working.
@peak loomread the other messages its ur wait_for that is wrong
I deleted that.
read this post @peak loom
Like I said I delted the wair_for
Can we see your new code?
@bot.event
async def on_message(msg):
message = msg.content.lower()
if message == 'hi':
await ctx.send('hi')
@bot.event
async def on_message(msg):
await bot.wait_for()
message = msg.content.lower()
if message == 'how are you':
await ctx.send('good how are you')
@bot.event
async def on_message(msg):
message = msg.content.lower()
if message == 'good':
await ctx.send(' Thats good! I gotta go now! Until the chat dies!')
@bot.event
async def on_message(msg):
message = msg.content.lower()
if message == 'bad':
await ctx.send('I hope your day gets better!')
time.sleep(1)
await ctx.send('I gotta go now!')
spoon feed
@bot.event
async def on_message(msg):
message = msg.content.lower()
def check(m):
return m.content.lower() == "good"
if message == 'hi':
await msg.channel.send('hi')
await bot.wait_for('message', check=check)
await msg.channel.send('good to hear!')
@reef shell, can you help me with it :')
Why do you have 4 different events?
ctx.wait_for?
sry
It's a convosationn bot for lonley people.
Also ctx is undefined
It looked like
@somthing.command()
async def example(ctx):
@example.command()
async def add(ctx):
@example.command()
async def remove(ctx):
``` @reef shell
oh lord thats soo stupid. just have a function that returns the message instead of having 4 listeners
Why not just use 1 event with 4 if statements?
Or use a dict
!d discord.ext.commands.group
@discord.ext.commands.group(name=..., cls=..., **attrs)```
A decorator that transforms a function into a [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group").
This is similar to the [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator but the `cls` parameter is set to [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group") by default.
Changed in version 1.1: The `cls` parameter can now be passed.
Don't know how, I'm way out of my python programming confort zone.
@final ironedited it good eyes
how do you now know how to use if statements ?!
I do.
I tried makig it a if statement it no work either.
iv given him plenty of exmaples now and with dict list etc
TYSM!
I'm gonna go make a game with c#. Bye.
is that a way of try sound smarter using c# but cant do basic python?
No, I'm making a VR game.
i hope u get more help in future when u get given information u say bye screw this....
!e
class message:
...
#dummy class just to able to use message.author
message.author = "lucid"
def send(): print("sent that message")
def listener(message : str) -> str:
dct = {"hi":f"hey {message.author}","feeling bad":"whats wrong"}
send()
return dct[message]
listener("hi")```
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 10, in <module>
003 | File "<string>", line 7, in listener
004 | AttributeError: 'str' object has no attribute 'author'
mb
but u get the idea
!e
class message:
...
#dummy class just to able to use message.author
message.author = "lucid"
def send(s): print(f"sent {s} that message")
def listener(message1 : str) -> str:
dct = {"hi":f"hey {message.author}","feeling bad":"whats wrong"}
send(dct[message1])
return dct[message1]
listener("hi")```
@slate swan :white_check_mark: Your eval job has completed with return code 0.
sent hey lucid that message
all that effort of using discord as a text editor gone 😔
how do we add command permissions in disnake?
How can I add Embed to the database?
What does self.bot.cogs.myCog.__doc__ do?
Hmm?
from discord.ext.commands import has_permissions
@commands.has_permissions(permission = True)
!d disnake.ext.commands.has_permissions
@disnake.ext.commands.has_permissions(**perms)```
A [`check()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.check "disnake.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 [`disnake.Permissions`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions "disnake.Permissions").
This check raises a special exception, [`MissingPermissions`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.MissingPermissions "disnake.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.CheckFailure "disnake.ext.commands.CheckFailure").
its dpy
ohk ty
Disnake is a fork
yes
The syntax is the same
They're incredibly similar
nearly
The question remains open
What do you mean?
I want to configure Embed and add its parameters to the database
for later use
Can you help me?
try:
from disnake.ext.commands import has_permissions
?
Show the code
Does anyone know anything about this?
What are the ratelimits for sending messages?
U dont have that role
I’ve known. I just didn’t know that’s what you were talking I about
No, i was just bored.
Gives the docstring of that class
Anyone mind suggesting some unique moderation commands?
give role, remove role, lock, unlock, cooldown, createrole, deleterole
category lockdown
disnake has application commands, right?
or all channel lockdown and hide all the channels but one for announcements or a lecture
yeah
Could you tell me how I could write/edit this docstring for a class?
are you familiar with that?
slash commands?
the disnake's context menu commands
do you know how they work?
yeah
can i have something like when I right click a user and press apps, and I select one of them it changes the user's name to [something] only
you can do anything with them its just slash commands lol
good way to start
It is called application commands
Nice pfp 😆
same as you
Similar but not exactly the same
isnt application commands more than slash commands
like a group of stuff im not sure but slash commands does fall in it
Application commands is for getting member's details , ban them etc
and what do you do that with?
I have this
@bot.user_command()
async def avatar(inter, user):
user_discriminator = user.discriminator
await user.edit(nick=f"User {user_discriminator}")
when i use it, it changes the user's name but also shows in ephemeral that the interaction failed. how do i prevent that message? If possible
Basically control the members
how to use datetime.timedelta as a duration parameter in timeout command for disnake
no like with what you do it
Maybe try to send a confirmation message
where?
arent slash commands msgs always ephemeral?
In the channel ofc lol
well, i guess that'd work too.
Not necessary
can anyone say
it was a question?
Nah a reply
I was trying to make a command that restarts the bot and the command is working but I wanted only me to be allowed to use it. So I put in my id but still it is saying I don't have permission. What is wrong?
@bot.command(name = 'restart')
async def restart(ctx):
if ctx.author.id == '543955269315723279':
await ctx.send("**`Reiniciando o bot...`**")
restart_bot()
else:
await ctx.send("Você não tem permissão para usar este comando!")```
like on interaction arent those msgs always ephemeral
No
your comparing a int to a str
ah ic
wait
isnt that like buttons?
you have to respond to that interaction or it will say it failed but continues it
is anything wrong with this?
@bot.user_command()
async def nickname(inter, user):
user_discriminator = user.discriminator
await user.edit(nick=f"User {user_discriminator}")
embed=disnake.Embed(description=f"{bot.success_emoji} Changed {user.mention}'s nickname")
await inter.response.send_message(embed=embed)
like buttons since theyre both interactions i think maybe thats the issue
thanks, I got it
you can just do
await inter.send(embed=embed)
yw
also how do i make that ephemeral?
Seems fine
with the ephemeral kwarg
await inter.send(embed=embed, ephemeral=True)
oh so that means I jsut mispelled it, no surprise
