#discord-bots
1 messages · Page 556 of 1
Could someone help?
yeah 2 secs
@slate swan calling me a "dick" because I don't help via dms. but why..?
You can also just do ctx.author.mention and it's without the ()
Report it to Modmail and let them handle it. No need for a witch hunt.
I need some help, im trying to make it so that my bot replies to a message if it contains a certain word, and since there's a lot of words i want it to reply to, I thought of making a list so I dont have to copy paste and slightly modify the same 2 lines of code over and over again, but it just gives me this error
TypeError: 'in <string>' requires string as left operand, not list
ehh no it was more likely a question to them t
i don't think that emoji will be accepted
Why a mistake?
Also they can't really do anything to DMs things so I just report them to discord itself
why its this emoji ✅
You cannot compare lists like that in an if
because discord doesn't use the unicode thingy for naming
but a full name
you can
so what shall i do
I was editing i noticed it, you can but not like he is doing in the if.
huh
The fact he used a list in the left hand operator.
i assume you have written that emoji name by hand in the json file no?
Ignoring exception in command withdraw:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 171, in wrapped
ret = await coro(*args, **kwargs)
File "", line 44, in withdraw
bal = await updatebank(ctx.author,0,"wallet")
File "", line 112, in updatebank
users[str(user.id)][mode] += users
TypeError: unsupported operand type(s) for +=: 'int' and 'dict'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/bot_base.py", line 547, in invoke
await ctx.command.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 901, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 180, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: unsupported operand type(s) for +=: 'int' and 'dict'
can anyone help?
and what does if have to do with all of this
or did you let the command do it?
no it auto writes it in the json
you did += on an integer and dict
Since this error is caused with an if.
lol i hate dark mode for replit
yeah but what should i do instead?
what? if has nothing to do with this
yeah
the command auto writes the json
!e ```py
if [1, 2, 3] in 'If error':
print("Yesn't")
@cloud dawn :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | TypeError: 'in <string>' requires string as left operand, not list
!e ```py
ret = [1, 2, 3] in 'If error'
@hasty iron :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | TypeError: 'in <string>' requires string as left operand, not list
Thats what i mean.
???
Guys, why a mistake?
help??
missing self
This happens when you give positional args when you should’ve given kwargs
No soul on earth does it like this.
It also happens when you miss self
ok so what?
the if has nothing to do with the error
anyone?
How to fix it?
So what? You are deliberately making something more confusing than needed.
Add self as the first argument
What was the problem?
how to fix ?
Ignoring exception in command withdraw:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 171, in wrapped
ret = await coro(*args, **kwargs)
File "", line 44, in withdraw
bal = await updatebank(ctx.author,0,"wallet")
File "", line 112, in updatebank
users[str(user.id)][mode] += users
TypeError: unsupported operand type(s) for +=: 'int' and 'dict'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/bot_base.py", line 547, in invoke
await ctx.command.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 901, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 180, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: unsupported operand type(s) for +=: 'int' and 'dict'
Waiting for some help
Discord doesn’t have anything called game
Can you show me the code
Maybe you’re looking for discord.Activity
how?
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
@slate swan i see a few things odd about your code. You're for instance storing both the role name and role id. Also you are doing bot.get_guild(id).get_member(id), but you can just do payload.member to get the member.
you also already have the role ID, so why not do member.guild.get_role(id)?
thanks you so much
Ill take a look one sec
alright
and when storing the emoji, you're just storing an emoji, but when retrieving it, you're doing emoji.name, which will be different
You are missing seconds the user id is ctx and user is the bannedday
You are looking for this..
!d discord.ext.commands.Bot.invoke
await invoke(ctx)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Invokes the command given under the invocation context and handles all the internal event dispatch mechanisms.
i use this as welcome bot, the script running fine with no error but i tried joined as new member but did't work
@bot.event
async def on_member_join(member):
channel = bot.get_channel(channel id)
embed=discord.Embed(title="Welcome!",description=f"{member.mention} Just Joined")
await channel.send(embed=embed)
You can’t have spaces in variable names (unless it’s pseudo code)
Also your indents seem to be messed up
That’s probably why it’s not working
And
Unless that’s just my mobile formatting
!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.
Your mobile
Turn it horizontally
?
I’ll take your word for it that’s in indented lmao
That is an 8!
Other than that I don’t see what’s wrong
huh
That is the amount of times i've seen people use this half working code.
it was from a tutorial
I know.
Doesn't mean it's good though.
Oh it’s one of those “discord bot economy tutorials”
Explains the client variable and the json
The tutorial is a joke
But anyways here is the issue users[str(user.id)][mode] += users
(Strongly recommend against json as a db)
users is a dict so you can't just append it to an int
what should i use then?
SQLite, Postgres, MySQL
I'd not even compare it to a proper db 😂
As your bot grows in features you'll probably want to store persistent data. When storing persistent data it's important to do so in the correct way - databases. Remember, JSON is NOT a database, and should NOT be used as one.
Someone Ping me?
Consider it done.
Using an actual database will save you headache down the line when your json database breaks and you lose all your data
The reply auto pings
I wrote something stupid, I wanted to ask did someone ping me? Because I got a ping in here
You misunderstood each other
lol i thought he said ping me
Someone interrupted me while I was formulating that question. I just pressed enter after writing that without checking 🤷♂️
on second thoughts I dont even need ctx do I?
indeed
So If I just remove ctx I can go one using what I am doing right?
people be copying swastik
wdym, that's my keyboard
how do I get a mention of all the roles of a certain participant ?
Participant ?
member*
!d discord.Member.roles
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.
Returns a list of roles object
i neednt in list
wallet_path = "./data/economy/wallet.json"
with open(wallet_path, "r") as f:
wallet = json.load(f)
wallet = wallet[str(ctx.author.id)][str(ctx.guild.id)]
``` ```json
{
"893759198297473034": {
"891338782534676520": "1000"
}
}
Error: Command raised an exception: AttributeError: 'str' object has no attribute 'id'
:')
Should use #❓|how-to-get-help as it's not related to bots yet
Oh ok had no response for a bit so came here
People will get to you
not too sure but that json doesnt look correct
wait
nevermind
:/
wait
shouldnt the 1000 be a int
not a string
you should remove the " around 1000
but im not sure if that will fix your issue
the error msg is still AttributeError: 'str' object has no attribute 'id' xD
bruh idk im just guessing at this point
You mean like a blacklist?
Yes
full traceback?
guys, How to make a bot ignore certain channels?
Depends on what you want to do and what your code looks like.
Could you please give us an insight?
In on_message check the channel id
Do it on on message
Check the channel, return
You have to have a predefined channelID and before the bot does anything he loops through the channelID's (or looks at only one (if there is only one)) and checks if they are the current channelID in an if statement. If they are or are not he operates on behalf of them.
hm
Doesn't need to be a on_message event
I think you’re over complicating
it depends on what tommy here wants to do
No thats very simple
They just don’t want commands to run in certain channels
You can accomplish this in 3 lines
Well I do not know what the user wants because he hasn't said anything.
From what they said I assume they don’t want commands to be run in certain channels
Well just have a Blacklist of channels.
Yeah and on message check if the channel id is in the black list
is it in one server or does the server owner set it
No, you don't need to on_message check.
That’s up to the user
How else?
Let's say
@hasty iron can you help me pwease 😇
what
Traceback (most recent call last):
File "/home/caeden/.local/lib/python3.9/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
TypeError: object NoneType can't be used in 'await' expression
```have you seen this before?
I swear I'm not doing anything wrong
coro(*args, **kwargs) returned None
The person wants to send a message in a channel. They will fetch the channelID that the command was put in (or the owner has already put it as an arg*). Then the bot will loop through a blacklist and see if the channelID is equal to any other channelID in the blacklist. If not, they will just send something. If it is, they wont.
oh
@sick birch
my code is flawless
send your code
You don't need a on_message event for that. It can be a simple command.
Hmm
No need for a loop btw
on_ready is sync
Depends.
You can just do something like if channel.id in blacklisted_channels
it needs to be an async function
oh ffs
line 15
you're right, ty
Yes of course you can do that too, I just pointed out what the code will do. "Loop through the list to check..."
Yeah both works but personally I think the on message would be easier
Heyyyy can someone help me with my giveaway bot
Lmao the guy who asked the question is gone
been asking for a long time now
It really just depends on the command
What exactly is the question?
What do you mean by help? I mean sure.
But please name your problem
so my giveaway bot
We’re not gonna make your bot for you but we can assist with errors or issues
it works but reroll doesnt
Okay define it doesn’t work
want me to send the code
Please send a Error and a Code @slate swan
Along with any errors
ok 2 secs
Ok.
@commands.has_role('👑CEO👑')
async def giveaway(ctx):
await ctx.send("Lets start with this giveaway! Answer these questions within 15 seconds! ")
questions = ["Which channel should it be hosted in? ",
"What should be the duration of the giveaway? (s|m|h|d)",
"What is the prize of the giveaway?"]
answers = []
def check(m):
return m.author == ctx.author and m.channel == ctx.channel
for i in questions:
await ctx.send(i)
try:
msg = await bot.wait_for('message', timeout = 15.0, check = check)
except asyncio.TimeoutError:
await ctx.send('You didn\'t answer in time, please be quicker next time!')
return
else:
answers.append(msg.content)
try:
c_id = int(answers[0][2:-1])
except:
await ctx.send(f"You didnt mention a channel properly. Do it like this {ctx.channel.mention} next time.")
channel = bot.get_channel(c_id)
time = convert(answers[1])
if time == -1:
await ctx.send(f"You didn't answer the time with a proper unit. Use (s|m|h|d) next time!")
return
elif time == -2:
await ctx.send(f"The time must be an integer. Please enter an integer next time.")
return
await ctx.send(f"The giveaway will be in {channel.mention} and will last {answers[1]} seconds!")
embed = discord.Embed(title = "Giveaway!", description = f"{prize}", color = 0xA5FF1C)
embed.add_field(name = "Hosted by: ", value = ctx.author.mention)
embed.set_footer(text = f"Ends {answers[1]} from now on!")
my_msg = await channel.send(embed=embed)
await my_msg.add_reaction("🎉")
await asyncio.sleep(time)
new_msg = await channel.fetch_message(my_msg.id)
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(bot.user))
winner = random.choice(users)
await channel.send(f"Congratulations! {winner.mention} won {prize}")
@bot.command()
@commands.has_role('👑CEO👑')
async def reroll(ctx, channel : discord.TextChannel, id_ : int):
try:
new_msg = await channel.fetch_message(id_)
except:
await ctx.send("The id was entered incorrectly.")
return
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(bot.user))
winner = random.choice(users)
await channel.send(f"Congratulations! {winner.mention} won {prize}!")```
says prize isnt defined when i reroll
Full traceback please
what
Well you have never defined "prize"
error
@slate swan
its defined in the top command but not the second how would i link them
Global the Variable.
so it says the same prize
Or simply use a Database.
global or pass it through
Database in this case would be safer.

Global it in the upper command, not the lower one. The one it's being defined it (just as info).
ive been told to use a database
im new to globaling variables
Indeed
how would i do it
bc i was storing the bank functions inside of a json file
global "variable_name"
!globals
When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.
Instead of writing
def update_score():
global score, roll
score = score + roll
update_score()
do this instead
def update_score(score, roll):
return score + roll
score = update_score(score, roll)
For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.
global prize
@hasty iron last question, ```py
Traceback (most recent call last):
File "/home/caeden/.local/lib/python3.9/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/home/caeden/Jarvis/main.py", line 77, in on_message
output = ProcessMessage(message)
File "/home/caeden/Jarvis/main.py", line 41, in init
self.message = message
AttributeError: can't set attribute
why cant it set this;
```py
def __init__(self, message):
self.message = message
self.message = self.clean(self.message)
self.tags = []
is the class slotted?
no, im not subclassing
fuck sake man you're so smart
you have to define a message.setter in order to do that
so would i do global prize = answers[2]
no
yeah, I forgot about this
i think it would be global prize
you already defined prize = answers[2]
thanks 😳
prize = answers[2]```
just global prize. Then the value "answers[2]" will be global.
so i global it below the prize = answers[2]
+sonhos
you place global prize
on the reroll or the giveaway
reroll
i did this @bot.command() @commands.has_role('👑CEO👑') async def reroll(ctx, channel : discord.TextChannel, id_ : int): global prize try: new_msg = await channel.fetch_message(id_) except: await ctx.send("The id was entered incorrectly.") return users = await new_msg.reactions[0].users().flatten() users.pop(users.index(bot.user)) winner = random.choice(users) await channel.send(f"Congratulations! {winner.mention} won {prize}!")
and it says prize isnt defined
wait no it says roll is not defined
Send the full traceback
wdym
the full error
i wrote reroll
not roll
i just tried to reroll again and it now says prize isnt defined
@commands.has_role('👑CEO👑')
async def reroll(ctx, channel : discord.TextChannel, id_ : int):
global prize
try:
new_msg = await channel.fetch_message(id_)
except:
await ctx.send("The id was entered incorrectly.")
return
users = await new_msg.reactions[0].users().flatten()
users.pop(users.index(bot.user))
winner = random.choice(users)
await channel.send(f"Congratulations! {winner.mention} won {prize}!")```
even tho it is
Did you define it somewhere else than global?
global variables is a very bad idea when making discord bots
they told me to do global
couldnt you just pass it through
into the function?
wait nevermind
!globals
When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.
Instead of writing
def update_score():
global score, roll
score = score + roll
update_score()
do this instead
def update_score(score, roll):
return score + roll
score = update_score(score, roll)
For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.
heres the full code
also let me see if i can find that attribute thing
what?
Use something immutable like a dictionary instead of globals
!botvar
Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"
@bot.command()
async def get(ctx: commands.Context):
"""A command to get the current value of `test`."""
# Send what the test attribute is currently set to
await ctx.send(ctx.bot.test)
@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
"""A command to set a new value of `test`."""
# Here we change the attribute to what was specified in new_text
bot.test = new_text
This all applies to cogs as well! You can set attributes to self as you wish.
Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!
read that
and use that instead of global
it's more readable, and works across cogs
thats just a variable?
Well a global variable is also just a variable lol
Or just use OOP
Objects everywhere
"I personally use discord.Member everywhere in my code because I don't know how to work with the docs"
Lmao what the
?
@bot.command()
async def ban(ctx, member):
await discord.Member.ban()
That would not work, does it 

Make it ban the author of message
Why bot.get_user() is not working ?
lmao
!d discord.ext.commands.Bot.get_user
get_user(id, /)```
Returns a user with the given ID.
hm
and add it as command that anyone can run
I am giving right user id but still it is returning None
Maybe the user isn't cached
await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits until the client’s internal cache is all ready.
why not get_member
How do you ban a user not in guild?
Someone in this server wanted to setup my discord bot from github and they told me that they don't code at all. They just copy paste everything and run it.
It is pain to try help them get it working
use Guild.ban and pass in an Object or User
If the member is None
member = member or ctx.author
Do you have member intents?
how do I make two commands with different name inside the same cog file
have 2 different functions decorated by commands.command?
No , its private so how to get it
sorry forgot, while not creating a different function
no, you need a function
really
aliases=["user_info", "member", "member_info", "u"])
what does this do in the command decorator
make aliases for the command?
aliases == nickname
so
google the definition of an "alias"
if i do
@command.commands(name="user", aliases=["user_info", "member", "member_info", "u"])
i can run that command with !user_info right?
Yes
ah I see
I also heard
you can make a help command, by defining something in these decorators using cogs
no, you cannot, you can add descriptions and stuff like that but you cant make a whole help command from them you'll need an actual implementation
ya its the description I mean
if plus:
for i in range(level):
try:
role = get(user.guild.roles, id=roles[str(i+1)])
await user.add_roles(role, reason="leveled up", atomic=False)
except KeyError:
print("no role")
try:
role = get(user.guild.roles, id=roles[str(i)])
await user.remove_roles(role, reason="leveled up", atomic=False)
except KeyError:
print(y + "roles")
print("no role to remove")``` why does it make a never ending loop?
like it's not spamming forever
but it never continues past this part of code
if i remove python try: role = get(user.guild.roles, id=roles[str(i)]) await user.remove_roles(role, reason="leveled up", atomic=False) except KeyError: print(y + "roles") print("no role to remove") it works
im trying to make it so if i level up to 10 for example
level 5 role is removed
because roles are different per server it just checks if there is a role for each level
{
"5": 901614930879455252,
"10": 901626195379109928
}```
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
How do I check the count for each reaction on a message? Like if I have a message with reactions from 1️⃣ - 9️⃣ , how do I check the amount of votes for each reaction
import discord
from discord.ext import commands
class Information(commands.Cog):
"""A cog with commands for generating embeds with server info, such as server stats and user info."""
def __init__(self, bot: Bot):
self.bot = bot
@commands.command(name="server", aliases=["server_info", "guild", "guild_info"]):
async def server_info(self, ctx: Context) -> None:
await ctx.send("test")
def setup(bot: Bot) -> None:
"""Load the Information cog."""
bot.add_cog(Information(bot))
How come my typehints for bot and ctx throws me an error
bot : commands.Bot
since you didnt imported Bot from discord.ext.commands
ah and how would I import it
def tempban(self, user: discord.Member,seconds):
text = (seconds)
in_seconds = {'h': 60 * 60, 'm': 60, 's': 1, ' ': 1}
seconds = sum(int(num) * in_seconds[weight if weight else 's'] for num, weight in
re.findall(r'(\d+)\s?(m|s|h)?', text))
current_time = datetime.utcnow()
final_time = current_time + timedelta(seconds=seconds)
tempbanned = {"user_id": user, "BannedUntil": final_time}
self.coll.insert_one(tempbanned)
I am defining tempban here
@commands.Cog.listener()
async def on_member_join(self, user: discord.Member):
now = datetime.utcnow()
age = now - user.created_at
days = age.days
banday = (14 - days)
bannedday = str(banday*24*60*60)
if days == 0:
await user.ban(reason="Alt")
channel = self.bot.get_channel(676931619294281729)
await channel.send(f"Auto Banned {user} `{user.id}` for being an ALT")
elif days < 14:
self.tempban(user, bannedday)
await user.ban(reason="Your account is too new! Feel free to join back when your account is atleast 15 days old. discord.gg/")
channel = self.bot.get_channel(676931619294281729)
await channel.send(f"Auto banned {user} `{user.id}` for being younger than 14d. Come back in {banday} days")
``` And then doing this to add a document however the user is banned but no document is added when the user is older than 1 day but younger than 14
this is pymongo btw
!d discord.ext.commands.Bot get some idea
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.
if message.content.lower() in list:
await message.channel.send(list1)
only works if the message is just the word from the first list, how do I make it so it works even if there's other words in the message?
turn the thing around
for item in list:
if item in message.content.lower():
...
break
if any(message.content.lower().split() in list):
I actually had some issues with that stuff earlier since I had it like that and it kept giving me this error TypeError: 'in <string>' requires string as left operand, not list.
thanks for the help
!u
You are not allowed to use that command here. Please use the #bot-commands channel instead.
Hey, does anyone know how to make buttons unavaliable?
Like this:
Like if you click on it, it should become unavaliable
grayed out... however you wanna say
what lib are you using
discord-py-slash-command
do they have docs?
send their github
Kk one second
HOLD UP that is actually smart!
A simple discord slash command handler for discord.py. - GitHub - LordOfPolls/discord-py-slash-command: A simple discord slash command handler for discord.py.
Should be this
Yes it is this
i have a problem with my rickroll detector, when you dont give it admin perms and it dms the server owner and leavesit
my code works but the bot doesnt dm the server owner nor throw errors
what is wrong here
https://cdn.discordapp.com/attachments/799338868818182145/901881019668525116/unknown.png
Would be fun if ctx.author is a moderator, then their role gets removed and then banned.
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.
🤣 true
!paste Instead of picture, I don't like reading from image
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
yo, any1 knows how to create a channel nuke on discord.py and if so, can you explain to me how does it work. I'm new to discord.py
Nuke in what way..?
search in github, there are a lot of nuking bots
in the way to clear all messages from a channel
Like copy the channel and create a new one prob
i mean, do $nuke and it deletes the channel and creates another and it's like if it cleared all msgs instantly
you could also use purge to remove messages
For a nuke command if its in a channel with a lot of message copying the channel then making a new one would be faster
True, whatever ways fits the most
is searching for messages in servers against terms ?
Hey guys so im trying to make a thing so if write >ping in any channel its says Pong in 1 specific channel i tried this code but for some reason its not working
async def Ping(ctx):
channel = bot.get_channel(CHANNEL ID HERE)
await channel.send("Pong")```
can someone help?
theres no error code
it just doesnt send to the channel id i entered
@slate swan y pass context
stop copying code
and ur command is >Ping
not >ping
do u read ur own functions?? 😂
i did it with a capital
just didnt send with a capital in this server
and im not copying code
its litterally 4 lines
Why are you passing context
^
try getting the channel from guild and not bot
guild.get_channel?
yes
# BALANCE --------------------------------------------------------------------------------------- Fortu'Neko#2987 --
@commands.command(aliases=["bal", "money"])
async def balance(self, ctx, member: discord.Member = "this"):
if member == "this":
with open(wallet_path, "r") as f:
wallet = json.load(f)
wallet = wallet[str(member.id)][str(ctx.guild.id)]
with open(bank_path, "r") as f:
bank = json.load(f)
bank = bank[str(member.id)][str(ctx.guild.id)]
a = discord.Embed(description=f"{member.mention}'s currently balance check!",
color=col)
a.set_author(name=f"{self.client.user.name}",
icon_url=self.client.user.avatar_url,
url=inv)
a.add_field(name=f"Wallet",
value=f"{wallet}",
inline=False)
a.add_field(name=f"Bank",
value=f"{bank}",
inline=False)
await ctx.send(embed=a)
else:
with open(wallet_path, "r") as f:
wallet = json.load(f)
wallet = wallet[str(ctx.author.id)][str(ctx.guild.id)]
with open(bank_path, "r") as f:
bank = json.load(f)
bank = bank[str(ctx.author.id)][str(ctx.guild.id)]
b = discord.Embed(description=f"{ctx.author.mention}'s currently balance check!",
color=col)
b.set_author(name=f"{self.client.user.name}",
icon_url=self.client.user.avatar_url,
url=inv)
b.add_field(name=f"Wallet",
value=f"{wallet}",
inline=False)
b.add_field(name=f"Bank",
value=f"{bank}",
inline=False)
await ctx.send(embed=b)
``` `-bal @` works but `-bal` not
async def Ping(ctx):
channel = guild.get_channel(899011791605084161)
await channel.send("Pong")```
still dont work
@bot.command()
async def Ping(ctx):
await ctx.send("Pong")
ctx is authors channel
or you want to send in a spec channel?
no im trying to make the pong send to 1 specific channel
yes
@staticmethod
def join_role_stats(role_ids: list[int], guild: Guild, name: Optional[str] = None) -> dict[str, int]:
"""Return a dictionary with the number of `members` of each role given, and the `name` for this joined group."""
member_count = 0
for role_id in role_ids:
if (role := guild.get_role(role_id)) is not None:
member_count += len(role.members)
else:
raise NonExistentRoleError(role_id)
return {name or role.name.title(): member_count}
^
Why do I get a add global statement warning here?
u know how to do it
@bot.command()
async def ping(ctx):
channel = guild.get_channel("id")
await channel.send(f"Pong!")
any1 help me?
.
bruh thats exactly what i did
" id "
" you've to use
"
wait
but if im entering the channel id into the code if i use speach marks it makes it a string no?
youve to put it in a string xD
your id
f"" is replaycing the .format... thing
async def Ping(ctx):
channel = guild.get_channel("899011791605084161")
await channel.send(f"Pong")```
That dont work
replayce guild to client
oh
well not for me but yh
2 secs
bot
xD
I'm using self.client.-
async def Ping(ctx):
channel = bot.get_channel("899011791605084161")
await channel.send(f"Pong")```
still nothing
._.
what do you need
i wanna make it so i can say >Ping anywhere in my server and it says Pong in 1 specific channel
y'all got any good and cool command ideas? i kinda need some since i suck in terms of imagination
@bot.command()
async def Ping(ctx):
await channel.send(f"Pong")```
how’s that gunna work there’s no channel id
dont have to be a channel id if u put a channel id its gon send to one
if embed_footer.strip().lower() == "none":
embed_footer = discord.Embed.Empty
```what will this do?
get the channel using its id and then send the message to that channel
How would I get all roles ID in a guild and store it in a list?
not set the footer
if the if returns True
bruh that don’t make sense 😂
i did this
iterate over Guild.roles
bro, can any1 just answer me rq?
example?
use a for loop and loop over a guild's roles, the property name is roles
i ain't gonna spoonfeed ya
u mean like if the footer is already set it wont set this footer?
if whatever you put in your param is none then it won't set the footer
ok
for role in guild.roles:
return role.id
does role have an attribute called id in this case?
you need a Guild instance, it has the property roles which returns a list of Role objects, a Role object has an id attribute
yeah that'll work
thanks for the help love this channel 🙂
alright so now I've got to add it to a list
it makes more than enough sense
yep
dude, you're not the only one who needs help
just be patient
this didn't work because the id is supposed to be an int not a string
@slate swan can u help me w sum
?
puting it in speach marks makes it a string i swear
yeah, but you need an int not a string
role_ids = []
for role in guild.roles:
role_ids.append(role.id)
role_ids would be ["id", "id", "id", "etc.."] right?
i did that stil didn’t work
yes
ok ty
is mutedRole None?
print mutedRole and see what that prints
any error?
ah a response
nope nothing happens
do you have an on_message event in your code
@bot.event
async def on_message(message):
if message.content == "hi":
await message.channel.send("hello")```
that's why
oh use .listen()
instead of .event use .listen()
aren't ids ints?
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").
Example...
they are
i love you
i'm not gay nty
😦
¯_(ツ)_/¯
.
bruh
any1 answer pls?
😂
a warning?
Aren't warnings usually for modules
what
!d discord.Member.display_name
property display_name: str```
Returns the user’s display name.
For regular users this is just their username, but if they have a guild specific nickname then that is returned instead.
wb a massunmute
wdym
unmutes all the muted mmembers
@bot.command(aliases=['massunmute'])
@commands.has_permissions(manage_messages = True)
async def unsilentall(ctx,member : discord.Member):
mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")
await member.remove_roles(mutedRole)
await ctx.send('All members have been unmuted!')```
property members: List[Member]```
Returns all the members with this role.
You might use asyncio.sleep() or else your bot will be ratelimited
ight
This will just cause you to get API banned
Just clone the role, remove it then add it back
ima jus use asyncio.sleep
@reef shell
@commands.command()
@commands.cooldown(1, 3, commands.BucketType.user)
async def cat(self, ctx):
nick_of_old = ctx.author.display_name
print(nick_of_old)
nick_of_new = 'ᓚᘏᗢ ' + str(nick_of_old)
yes, mass removing roles will ratelimit you anyways
nick_of_old is NoneType
how to get message id from ctx?
<class 'discord.ext.commands.context.Context'>```
AttributeError: 'Context' object has no attribute 'id'
context has a message property which returns a Message instance
and as you know, a Message instance has an id property
is it message or Message?
@reef shell
@commands.command()
@commands.cooldown(1, 3, commands.BucketType.user)
async def cat(self, ctx):
nick_of_old = ctx.author.display_name
print(nick_of_old)
nick_of_new = 'ᓚᘏᗢ ' + str(nick_of_old)
Yes?
nick_of_old is NoneType
if you can't tell the difference then you really need to learn more python, that's basic OOP knowledge
there's a difference between properties and classes
Have you turned on members intent?
so ur not going to tell me?
Try after turning it on both in your code and developer portal
it's message, learn python please
even though it should work fine without that intent
god ur so stupid
discord.Message is a class
says the one who doesn't firstly learn the basics and expects people to just tell them what it is lmao
what?
It's for imp#2573
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.member = True
class U(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
@commands.cooldown(1, 3, commands.BucketType.user)
async def cat(self, ctx):
nick_of_old = ctx.author.display_name
print(nick_of_old)
nick_of_new = 'ᓚᘏᗢ ' + str(nick_of_old)
await ctx.author.edit(nick=nick_of_new)
def setup(client):
client.add_cog(U(client))
Error:
C:\Users\Савелий\AppData\Local\Programs\Python\Python38\python.exe C:/Users/Савелий/Desktop/Glidingtheo/main.py
Traceback (most recent call last):
File "C:\Users\Савелий\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 606, in _load_from_module_spec
spec.loader.exec_module(lib)
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Савелий\Desktop\Glidingtheo\cogs\fan.py", line 5, in <module>
intents.member = True
AttributeError: 'Intents' object has no attribute 'member'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:/Users/Савелий/Desktop/Glidingtheo/main.py", line 50, in <module>
client.load_extension(f"cogs.{filename[:-3]}")
File "C:\Users\Савелий\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\Савелий\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.fan' raised an error: AttributeError: 'Intents' object has no attribute 'member'
Process finished with exit code 1
members
Not member*
And you must pass that intent instance when making your bot instance
Not in a cog
hey, i have a problem:
i need to make a command that sets a variable to a channel, executed by a command.
like /setchannel or something, that sets the channel to a variable, so i can make the output of the bot, go to the set channel.
please @ me if you can help.
do you want to store the channel and get it as a variable
or just get the channel for the command?
@commands.command(aliases=["bal", "money"])
async def balance(self, ctx, member: discord.Member = "here"):
if member == "here":
with open(wallet_path, "r") as f:
wallet = json.load(f)
wallet = wallet[str(member.id)][str(ctx.guild.id)]
with open(bank_path, "r") as f:
bank = json.load(f)
bank = bank[str(member.id)][str(ctx.guild.id)]
a = discord.Embed(description=f"{member.mention}'s balance check!",
color=col)
a.set_author(name=f"{self.client.user.name}",
icon_url=self.client.user.avatar_url,
url=inv)
a.add_field(name=f"Wallet",
value=f"{wallet}",
inline=False)
a.add_field(name=f"Bank",
value=f"{bank}",
inline=False)
await ctx.send(embed=a)
else:
with open(wallet_path, "r") as f:
wallet = json.load(f)
wallet = wallet[str(ctx.author.id)][str(ctx.guild.id)]
with open(bank_path, "r") as f:
bank = json.load(f)
bank = bank[str(ctx.author.id)][str(ctx.guild.id)]
b = discord.Embed(description=f"{ctx.author.mention}'s balance check!",
color=col)
b.set_author(name=f"{self.client.user.name}",
icon_url=self.client.user.avatar_url,
url=inv)
b.add_field(name=f"Wallet",
value=f"{wallet}",
inline=False)
b.add_field(name=f"Bank",
value=f"{bank}",
inline=False)
await ctx.send(embed=b)
``` {prefix}bal @slate swan is working, but only {prefix}bal not, why...
if you want to store the channel you do it in a json file, I would recommend using a database like sqlite
i need it to then be used in other commands.
lol, sql makes me cry.
alrighty
use json
you can get the mentioned the channel and store the channel id
so this will be fun.
is this bot only for one server
how do i check if a bot reacted to a message
json is really bad for data
no.
then you should use a nosql database
alright
thx for nothing bth
👍
ya but if the bot is only for one server and you don't want sql then its easier to just use json
for small bots
yea
but i still recommend using sql
which database would you use for a public bot?
sql is more like literal english language
?tag database
This is not a Modmail thread.
there are 2 that i like to use
right and then suffer
https://www.postgresql.org/ - Widely used, open source database with good data integrity and feature set. The typical recommendation for bots.
https://www.mysql.com/ - The de facto SQL standard in software development. Usually not recommended here due to the decreased feature set in comparison to PostgreSQL, but strongly time-tested.
https://www.sqlite.org/index.html - File-based DB, no authentication. Lack of networking means query-by-query time is relatively fast, but tends to chug past a certain amount of load.
i prefer postgres to mysql
sql makes him cry
that was another guy
Oh mb
how do i make mt bot deafen itself???
if you want nosql (databases that don't use sql) just ping me
!d
!p
pep_number
Does anyone know how to check if a bot reacted to a message
!p fetch_invites()
Converting to "int" failed for parameter "pep_number".
using the on_raw_reaction_add event
I'd suggest Postgres SQL bcz many big bots use it and it's highly scalable
ya sqlite is better for smaller bots
can any1 help me find fetch_invite()
Well...
!d discord.ext.commands.Bot.fetch_invite
await fetch_invite(url, *, with_counts=True, with_expiration=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gets an [`Invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Invite "discord.Invite") from a discord.gg URL or ID.
Note
If the invite is for a guild you have not joined, the guild and channel attributes of the returned [`Invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Invite "discord.Invite") will be [`PartialInviteGuild`](https://discordpy.readthedocs.io/en/master/api.html#discord.PartialInviteGuild "discord.PartialInviteGuild") and [`PartialInviteChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.PartialInviteChannel "discord.PartialInviteChannel") respectively.
tysm
I said i recommend postgres
I too said that.
i want to use fetch_invite and later on see how many online and offline members there are in a guild, but I don't understand what to pass in the fetch_invite
The invite url or id
!d discord.Invite.url
property url: str```
A property that retrieves the invite URL.
I don't understand
you pass in the invite URL
py_invite = await self.bot.fetch_invite(constants.Guild.invite)
online_presences = py_invite.approximate_presence_count
offline_presences = py_invite.approximate_member_count - online_presences
member_status = (
f"{constants.Emojis.status_online} {online_presences:,} "
f"{constants.Emojis.status_offline} {offline_presences:,}"
)
as you see here, this code has constants.Guild.invite as their argument in fetch_invite, but I don't have the constants class so I don't understand what to write here
copied code?
but the url can vary on different servers the command is ran in
that's the code from the Python bot, i'm rewriting it
so far it's been good and I've found a way and another to fix stuff, but I've never used fetch_invite so idk what I can do here
then constants should be defined
then dont use it?
i wont? my question is how can I use fetch_invite in this case?
you pass in a url or an invite code as we told you
chess
yes I understood that, but the url/invite code varies, how can I get the invite code for the guild the command ran in?
you need to fetch one from the guild
!d discord.TextChannel
class discord.TextChannel```
Represents a Discord guild text channel.
x == y Checks if two channels are equal.
x != y Checks if two channels are not equal.
hash(x) Returns the channel’s hash.
str(x) Returns the channel’s name.
It has a method called create_invite or smthng like that
what does textchannel have to do with this, ur confusing me
ty
and its only one argument I need to pass right
in fetch_invite
Context obj. has an attr. called channel
what?
Returns the channel associated with this context’s command. Shorthand for Message.channel.
how does this involve with fetch_invite, that's what im not understanding
Are you using a this code inside a command's function?
yes
You do know that context is passed in command functions, don't you?
yes
So, i hope you understand how to get the TextChannel from context and then create an invite using TextChannel.create_invite()
That's what you asked for
ahhhh
inv_url = ctx.channel.create_invite()
g_invite = await self.bot.fetch_invite(inv_url)
so this would work
ahh
Need help so i write code like this for dm welcome message
bot = commands.Bot(command_prefix = '!', intents=intents)
its work perfect but why my commad with "!" die how i can fix this ?
if i remove intents=intents dm message did't work.
did you define that intents var?
How i can do that?
he asked if u could send what those intents variable is
@tasks.loop(seconds=600)
async def checker(self):
try:
fetchall = self.coll.find({}) # return all documents inside the db
print("Hello!")
current_time = datetime.utcnow()
async for x in fetchall:
if current_time >= x["BannedUntil"]: # do stuff after this
unbanuser = x["user_id"]
member = discord.Object(id={unbanuser})
guild = self.bot.get_guild(int)
await guild.unban(member, reason="Tempban for new account expired.")
await self.coll.delete_one(unbanuser)
except Exception:
pass
Why wont my task start? It doesnt print anything either
My innit
class newcomers(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.coll = bot.plugin_db.get_partition(self)
self.checker.start()
Well likely it's throwing an error. And because you do nothing if an error happens it acts like it
I'd recommend raising the error
is there a way i can set a max ram usage fro my bot hosted on my pc ?
hey can someone help me? #help-bread
you're catching the error since you catch everything, you don't wanna do it
But, it won't start and it's erroring because you shouldn't start a task in __init__
the bot won't be ready yet, you should start it in on_ready
so add a listener like
@commands.Cog.listener()
async def on_ready(self):
if not self.checker.is_running():
self.checker.start()
created = embed.timestamp(ctx.guild.created_at)
embed.description = (
f"Created: {created}"
f"\nVoice region: {region.title()}"
f"{features}"
f"\nRoles: {num_roles}"
f"\nMember status: {member_status}"
)
why I get an error saying created is empty?
@kindred epoch havent found something?
argh
Does anyone know how to make an embed appear like this?
discord-py-slash-command
Those are buttons
How do I go about logging the use of commands in a specific channel?
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.
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 added [`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.
get the channel > send info ig
can someone help me? #help-cake
I think its created_at()
@brave vessel @slate swan whats that symbol on your name for?
Try .catify
.catify
oop
Hey @coral vessel!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
whats the purpose of it
Honestly no purpose lol
@boreal ravine```
created = embed.timestamp(ctx.guild.created_at())
TypeError: 'datetime.datetime' object is not callable
hm
🤦♂️
how tdf
.created_at is a property
@client.event
async def on_member_join(ctx, member):
global hasloo
channel = 828011225292079124
haslo = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
haslo2 = 5
hasloo = "".join(random.sample(haslo,haslo2))
await channel.send(f"**Wyślij komendą** `!verify (kod)`\n**Twój kod weryfikacyjny to** \n`{hasloo}`")``` why bot no send to channel? nothing
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
ohhh
what?
on_member_join only takes member, also you need to get the channel using the id not the id itself
@slate swan
i know?
you don't call properties
It a cat
Only fo cool pepel
I did, kyle told me to change it to created_at()
Yes I meant buttons
it was a suggestion
Mb
👁️
use a fork not a 3rd party lib for buttons
anyways don't call it
Wdym
The master version of dpy has buttons
@slate swan whats he supposed to write then
I didn't
What exactly
Like I literally got almost everything
nice
since you don't call properties, you don't call it
I just need that its not able to be clicked
dude, that's basic python
in the code you just sent you're calling the property
😂
🤦♂️
ah this one
no i didn't, i posted my code and asked what I could do to solve error i was getting, kyle told me to change it to created_at() and i sent him the error, then I changed back to mine
oof
!d discord.Guild.created_at
property created_at: datetime.datetime```
Returns the guild’s creation time in UTC.
elaborate "created is empty"
mhm
created = embed.timestamp(ctx.guild.created_at)
TypeError: '_EmptyEmbed' object is not callable
this is the error im getting
this ```py
@client.event
async def on_member_join(ctx, member):
global hasloo
channel = discord.utils.get(client.get_all_channels(), guild__name=f'{ctx.guild.name}', name='【✅】weryfikacja-1')
haslo = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
haslo2 = 5
hasloo = "".join(random.sample(haslo,haslo2))
await channel.send(f"**Wyślij komendą** `!verify (kod)`\n**Twój kod weryfikacyjny to** \n`{hasloo}`")
Does anyone know how to make buttons appear so I cannot click them???
discord-py-slash-command
buttons appear so u cant click them? wot
Yes
you don't call embed.timestamp
wdym
embed.timestamp = ctx.guild.created_at
If you create buttons and change some kind of property or something so you can still see it, but not click it
or multi-assignment: created = embed.timestamp = ctx.guild.created_at
but I need that to be a variable
ahh
Its embed.timestamp isnt it
Uh
Wwll
@slate swan I think ik ur error
ctx.guild.created_at returns 2021-08-25 10:07:29.575000+00:00
and It cant be converted into a timestamp
???????
what
!d discord.Embed.timestamp
The timestamp of the embed content. This is an aware datetime. If a naive datetime is passed, it is converted to an aware datetime with the local timezone.
what
.created_at returns a datetime object
yes
wait why wont it work
that's how you put the timestamp in an embed
Plsplspls someone HELP me
hm
!server
i already told you
embed.timestamp = created = ctx.guild.created_at
ya I did
but it doesn't work like this command
that'll set the timestamp and make the variable created
I can't hover over the timestamp
i-
So i write welcome dm message with this
bot = commands.Bot(command_prefix = '!', intents=intents)
bot working fine with dm message.
but my command prefix did't work!
if i delete intents=intents command Work again, but welcome dm message did't work.
how to resolve this ?
!d discord.utils.format_dt
discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.9)") for presentation within Discord.
This allows for a locale-independent way of presenting data using Discord specific Markdown...
any error?
No all working fine no error
embed.timestamp = created = ctx.guild.created_at.format_dt(style=relative)
weird
is this correct?
nope
that's very wrong
fuck, im so bad at understanding docs
discord.utils.format_dt is a function that takes a datetime object and a style
ahh
try discord.Intents.all()
discord.utils.format_dt(ctx.guild.created_at, style=R)
also remove embed.timestamp since that's far from what you want
R needs to be a string but yeah that'll work
ah I see
ty
yw
wait
discord.utils doesn't have a method called format_dt
i get an error
print discord.__version__
bruh
🤦♂️
python package installation
ah
!pypi discord.py
ty kyle
ok
i did pip install discord.py something
this
install the master from github
why?
the pypi version doesn't have it
pypi version outdated asf
then all my code wont work?
you'll also need to do some rewriting
pst man I got no time for that
¯_(ツ)_/¯
then install from master branch
how do I add the custom emojis?
uh.. just add them?
no shit, but what method do I need to use?
Its Work! thx
it doesn't
what method could i use for it then?
you just add the emoji, <:emoji_name:emoji_id>
custom emoji
yeah, as i said, <:emoji_name:emoji_id>
but it wont be available for other servers?
if your bot can see the emoji it will work
why wouldn't it be available for other servers
middle part #discord-bots message
oh
so if i have 1 emoji in my server, I run the command in another server, how can it get that emoji in this server
dude, just pass <:emoji_name:emoji_id
took me a while but i think this was it
where you replace them accordingly with your emoji's info
yeah i didn't bother reading everything mb
!server
click on the green and the grey circle emoji
how can I add that to a string
if your bot can't see the emoji, then you can't add it
idk what you mean
if your bot is not in the same server where the emoji is, your bot can't use the emoji
yes exactly
that's what im saying
but those emojis are not in this server
you can do \emoji to get it formatted already
u don't understand
e.g:
\:lemon_clown:
!lemon_clown
and you’re not explaining
!server
"how do i put emoji"
how does it access it
i fucking explained you more than 5 fucking times i'm fucking done 🚶♂️
If the bot is in a server with that emoji, it can use that emoji anywhere else, just like nitro
kraots just said if the guild the command ran in doesn't have the emoji it can't use it
they never mentioned "command"
dude, can you not read?
i dont know where you got that from
.
Can't you use #bot-commands?
let me just telepathically see your code real quick
member_status = (
f" :online_misa: {online_presences:,} "
f" :offline_misa: {offline_presences:,}"
)
very much helpful
wow you totally missed the point on how to send emojis
<:online_misa:emoji_id> correct?
read middle part #discord-bots message
I'm waiting to see him send the !server command again
correct, and where is your emoji_id ??
fr 😂
someone help
LOL
what so funny
idk they like to make fun of me
right because we explained this like 4 times
way more than 4 times 😂
ah it works
🎉
#bot-commands
someone help me
you forgot to break


55,151
213,210