#discord-bots
1 messages · Page 779 of 1

doesnt matter
So not specific?
not file, folder in which all files will be in
the file type were talking about name
cof cof no need
should be in a cogs folder
okay!
Eh? Doesnt matter
I name it ext typically 
better
cogs ext all the same
and you may check out these channels , they got pretty decent resources #886584307454472243 #888117544546869258
seen plugings
High standard peeps
Deleted channels?
no
for anyone ( everyone ) who is not in hikari
hikari channels
Oh lol
Name the main folder discord and the cogs folder ext ezzz
carberra is in the server...
Sooo?
yea , he's a staff there
Write everything in one file, ya'll inferior
nah youre tripping
I like the dude he makes great tutorials
People dont even have any humor left inside them
I mean, I wrote cogs in one single file
Facts
them*
uwu
write cogs in the main file
You're going down with me, uwu
That's what am talking about
First, stop with this uwu
Second, why not
Lol
If we eval os.system('reboot') would the python bot shutdown or it has a protection against that
i mean , if you really do it only in the main file whats the point of using cogs
!e
while True:
print("uwu")
or what?
@slate swan :x: Your eval job has completed with return code 143 (SIGTERM).
001 | uwu
002 | uwu
003 | uwu
004 | uwu
005 | uwu
006 | uwu
007 | uwu
008 | uwu
009 | uwu
010 | uwu
011 | uwu
... (truncated - too many lines)
Full output: too long to upload
expect for making categories
cursed
Is there any "guide" for hikari like the one you just provided to me for lightbulb?
Categories
¯_(ツ)_/¯
:))
Idk, I'll be half dead
Groups?
lmao
So you'd be completely dead?
Anyways gtg, gotta grab breakfast
!e
import random
while True:
print(random.randint(1,1000000))
@tender estuary :x: Your eval job has completed with return code 1.
001 | File "<string>", line 3
002 | print(random.randint(1,1000000))
003 | ^
004 | IndentationError: expected an indented block after 'while' statement on line 2
and help my mind overcome this uwuness
ofc indent.
Ok cya
indents

dont remember but this https://github.com/hikari-py/hikari/blob/master/examples/
!e
import random
while True:
print(random.randint(1,1000000))
@tender estuary :x: Your eval job has completed with return code 143 (SIGTERM).
001 | 745801
002 | 421545
003 | 219828
004 | 980093
005 | 195534
006 | 616568
007 | 209081
008 | 549983
009 | 317698
010 | 693305
011 | 431404
... (truncated - too many lines)
Full output: too long to upload
password generator
if no uwu, i'll put my ugly face as my pfp again
its just one run... I am not building a game or snth
yes
theres ot channels for a reason
We can talk about developing discord bots on python as the channel topic says
print("Talk off topic here")
hehe
but we can always move to #ot2-never-nester’s-nightmare
Wao
ill just stay here
rather not
waiting for a new error

And wait for juice wrld uwu
Imagine a bot for hosting bots
divide by 0
is that a insult
which uses a bot for hosting the bot
oh and , https://paste.pythondiscord.com/ixoqubakaq.py suggestions?
Imagine hosting a hosting service for hosting a hosting bot for hosting more bots which require hosting
Who would do that
i should go to sleep after that
I had a stroke
Autocode?
Oh nevermind
That's bad
I have a friend using the free ver or smth... totally sucks
No hosting sucks more, something is better than nothing
I mean maybe because he just runs around editing strings not knowing discord.js but
replit enters the chat
leaves
I use it 
its kindof bad
Autocode is literally a Discord bot that helps you host other bots within itself
Only for hosting though.. I am poor
its always "i use replit so my bot is online 24/7"
wow?
ye
Essentially the product of MEE6 premium and retardation having sex
lmfao
mod enters the chat
mina like: 👁️ 👁️
although its uptimerobot who does that job
I spend 2 hours trying to fix my bot's build on heroku and delete the app after 1 day
heroku sucked hard
cof cof
heroku 
just use your device to host
stop coughing
paid hosts are the best, but replit because me wnats bot 24/7
I remember when I actually didn't know about git and updated everything with SFTP
gonna give us covid
Just get a VPS
I have no problem if you are going to buy me a vps
lmao
ggs plans are good
Yeah 3$/mo pretty decent
¯\_(ツ)_/¯
Hetzner has the best price/reliability according to most, but I use Contabo (better value for more powerful vps')
with ddos protection its 6bucks right
i have an idea , stop hosting your bots and okimii will do everything your bot does
Loooooool
No uwu better
🚶
???
Send an embed 🥺🥺🥺
no bro
hunter's uwu eyes, cutie
No stop it
BTW oki, do u know that which is used for non living things and who is used for living things 👀
I'm on laptop
no
Anyways it's getting OT yet again
Now u do
i have my desktop off lol
Same. My laptop is in my bag
We're botting okimii, easy
Okimii the discord bot
@manic wing 👀
bro?
uwu
hunter likes children
No
huwunter
die
oban @obtuse obsidian guys do this
Time to block y'all out of my GitHub profile
Bot
hides and renames github connection
jeez
Okimii's softwares, software's okimii
cof cof
a snake game? 
no
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
@slate swan you know... I ain't a 5 y/o
Yeah, i did that once and got warned for selfbotting 😐
yeah hes 4🫂
by discord system
but i am
discord smh
fr ? its just like sending a youtube url
imagine flagging the doge god
Yeah
It was like Jan or September 2019 though
Me who joined disc in 2020: 😐
lmao
i joined in june 2019 iirc
lmao
. No
Sad
well done
2018 gang
i thought i was in the bot commands chat
👁️ 👁️
used the command cause i never knew you could iterate with a key and a value for a dict
thought it was key only
I just love how this chat is about everything except discord bots
.topic
we need more topics!
okimii
nothing
wut.......
AI
proud of making okimii the self bot
hunter makes discord AIs cause hes a fancy man
discord about to flag me as a self bot
or maybe the AIs fancy him

Lmao
maybe hes an ai
or maybe i am
ais arent dumb
but AIs dont make a typo , i do
exactly
dont disrespect your father
😷

```py
def sarcasm(message : Message)-> bool :
if message.author == okimii : return False
return True
cant even follow pep8
you need black to format it for you👁️ 👁️
```py
def makes_sense(message : Message)-> bool : if message.author == okimii : return False
guys dont listen to my child
he gets grumpy if he doesnt eat his daily gummies
❤️
!ot ,<= funny but
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
make one
oki, do u know 3 OT channels exist for talks like this...?
whos hunter talking to
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...
@slate swan
If anyone knows hikari, Will this work?
role = interaction.guild.get_role(935824707897401374)
why does it return None /
if its lightbulb , it will work
but the message thingy
you cannot send it that way , probably get a channel first , and send the message
Yea I got that figured
and you need to await it too
the role is there in the server what is the problem ?
the role id is wrong
you're right .
<coroutine object GuildChannel.create_invite at 0x0000027BFD9DDC48> why do i get that as an output when im trying to get a server invite?
activeservers = self.client.guilds
for guild in activeservers:
for channel in guild.channels:
invite = channel.create_invite(unique=True, max_uses=1)
and when i am trying to await it, i have this error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10003): Unknown Channel
await channel.create_invite
^
help i want to set it to
null
set it to None
thnx
who sent that
you are still a developer in my bot XD

ok
hellow. I have these to buttons and i want to make something like a stopwatch. Mu code is this and i get this error```python
@nextcord.ui.button(label=" ", style=nextcord.ButtonStyle.green)
async def on(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
user = interaction.user
self.start_time = time.time()
emb2=nextcord.Embed(title=":green_circle: On Duty", description=f"{user.mention} Μόλις μπήκες σε υπηρεσία. Πάτα το κόκκινο κουμπί για να βγεις.", color=color, timestamp=datetime.now())
emb2.set_author(name=user.name, icon_url=user.avatar.url)
await interaction.response.send_message(embed=emb2, ephemeral=True)
@nextcord.ui.button(label=" ", style=nextcord.ButtonStyle.red)
async def off(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
user = interaction.user
self.end_time = time.time()
self.time_lapsed = self.end_time - self.start_time
async def time_convert(sec):
mins = sec // 60
sec = sec % 60
hours = mins // 60
mins = mins % 60
emb2=nextcord.Embed(title=":red_circle: Off Duty", description=f"{user.mention} βγήκες από υπηρεσία. Ο χρόνος που ήσουν online είναι: "+ "{0}:{1}:{2}".format(int(hours),int(mins),sec), color=color, timestamp=datetime.now())
emb2.set_author(name=user.name, icon_url=user.avatar.url)
await interaction.response.send_message(embed=emb2, ephemeral=True)
time_convert(self.time_lapsed)
convert' was never awaited
time_convert(self.time_lapsed)
what do you understand with "was not awaited" ?
I am trying to store few command and then get those cmd names and if the command name is in the list for that guild , it will be disabled. How can i do this. Can someone give me an idea about it?
Custom Command Checks in discord.py
Often you may find the need to use checks that don't exist by default in discord.py. Fortunately, discord.py provides discord.ext.commands.check which allows you to create you own checks like this:
from discord.ext.commands import check, Context
def in_any_channel(*channels):
async def predicate(ctx: Context):
return ctx.channel.id in channels
return check(predicate)
This check is to check whether the invoked command is in a given set of channels. The inner function, named predicate here, is used to perform the actual check on the command, and check logic should go in this function. It must be an async function, and always provides a single commands.Context argument which you can use to create check logic. This check function should return a boolean value indicating whether the check passed (return True) or failed (return False).
The check can now be used like any other commands check as a decorator of a command, such as this:
@bot.command(name="ping")
@in_any_channel(728343273562701984)
async def ping(ctx: Context):
...
This would lock the ping command to only be used in the channel 728343273562701984. If this check function fails it will raise a CheckFailure exception, which can be handled in your error handler.
you get a context object so you can do if ctx.command.name in disabled_command_list
@client.slash_command(description="Clears the number of messages you entered.")
async def clear(ctx, amount=None):
if amount is None:
embed=disnake.Embed(color=0xb30000, title="Amount not entered", description="Please input the amount of messages you want to clear.")
await ctx.send(embed=embed)
else:
await ctx.channel.purge(limit=amount)
why doesnt work?
🙂
hlep
hi , i want to make a bot with python so any good tutorials for that?
typehint amount to int it will work
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
okay
no need for the else statement aswell
and argument naming
slash command doesnt take context
but interaction
it does
an argument
no
which isnt correct
it doesnt but its good practice to
i didnt said it affects run time but it is not correct
in a sense of naming as i said
it doesnt matter
its just a name
print ("thank you")*100
check disnakes git
i have seen it
and tell me when you see ctx in there examples
np
argument
ok argument
its in a methods parameters
it doesnt matter its just a name
that's like naming an apple a banana
it automatically takes the first arg as what is required
how to make two settings for it? example:
amount=None:int
yo anyone know how to make the snakeeyes from dank memer?
or the dice roll animation/emoji
amount: int = None
expecting a string and the argument has a default value of None
making it an optional argument
oh and how to send custom emojis with our bot like example:

you can send it like this
 or get it
anyone have any example of code using slash command that have "Options"
Which module??
same goes there iirc
What are you trying to say?
I assume you tried to mention a user in footer, which might not be possible
im using disnake
WTF
a wrapper
I didn't
I didn't really bother myself on figuring what you are trying to do..
I sent the pic for a reason 😕
then can you tell what you are trying to do
Can you look at the pic?
it has some stuff but I cant remember what that is supposed to do, so can you explain what are you trying to do
A timestamp
Huh?
you cant have special things such as mentions, discord epoch timestamps in discord embed footers, titles and more
You can have them in footer 🙂
I am aware with that and I don't wanna rely on discordpy for this
then as kayle said, I think you can't set a timestamp into a footer using embed.set_footer
there is timestamp param for timestamp
duh-
Yk what I never said I am using discordpy
I wanna make raw API interactions
you never told what you are using either
so I just had to make a guess
there are already existing API wrappers, you don't have to reinvent the wheel
you could have said that as well...
I want to?
even if you made a raw interaction, I don't think you can pass that to footer
Ever heard of mimu it does!
never heard of it
Cool then I got no comments for you
why does it need to be specially for footer..?
i still need help
The bot cannot see the channel but you tried to create an invite innit
got it, thx
not related to discord bots
ok
Is there a way to make my leaderboard command to change the look so it goes from this:
2. Future_Fugitive
$845539
to:
$845,539
what is the code
The leaderboard command is this:
@commands.command(aliases = ["lb"])
async def leaderboard(self,ctx,x = 5):
"""
mother lb
**Leaderboard i guess**
"""
users = await get_bank_data()
leader_board = {}
total = []
for user in users:
name = int(user)
total_amount = users[user]["wallet"] + users[user]["bank"]
leader_board[total_amount] = name
total.append(total_amount)
total = sorted(total,reverse=True)
em = nextcord.Embed(title = f"Top {x} Richest People" , description = "This is decided on the basis of raw money in the bank and wallet",color = nextcord.Color(0xfa43ee))
index = 1
for amt in total:
id_ = leader_board[amt]
member = self.client.get_user(id_)
name = member.name
em.add_field(name = f"{index}. {name}" , value = f"${amt:.0f}", inline = False)
if index == x:
break
else:
index += 1
await ctx.reply(embed = em)
- inconsistent indentation
- what does x mean and why is it's default 5
Yeah there's something
and for the color, you just need to put the hex
the command works
the x is the amount of users shown i can change it to 1 to any number as it will just read the json
not nextcord.Color
k
"the command works" isn't an excuse for having bad indentation
but back to your question
i understand
yes?
!e
print(f"{10000000:,}")
@final iron :white_check_mark: Your eval job has completed with return code 0.
10,000,000
@royal oar
Thats how thank you
when did that started happening lol
Am I ancient
¯\_(ツ)_/¯
I mean it’s not particularly useful. I guess it’s good for people who need an eye aid and can’t read numbers.
lmaooooo


Basically half of discord users
10,000,000 looks more clean than 10000000
mhmm
that's why I configured my calculator to put a space every 3 numbers so that it looks cleaner 
idk I haven't worked on a bot for a long time 😳
good
@bot.slash_command(
name='sanime',
description='search the anime by the name given',
guild_ids=[
933231923533324290
],
options=[
{
name="title"
}
]
)
is this the right way to make an Option on slash commands
?
what library is that
Seems like Disnake , if it is
Then it's wrong
uwu hikari
{
name="title"
}
what datatype is this?
It's too complex in raw hikari ☠️
lol
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
?
Sorry
.....?
How can i log my bot's DM messages?
i mean if someone send DM to my bot, bot will send messages to specific channel
@devout iris use the on_message event to check if the channel is an instance of DMChannel
So how can i check if on DM?
!d discord.DMChannel
class discord.DMChannel```
Represents a Discord direct message 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 a string representation of the channel
!d isinstance
isinstance(object, classinfo)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") exception is raised.
Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
Ah thx
discord.errors.NotFound: 404 Not Found (error code: 10009): Unknown OverwriteCan someone help me, I have this error and i dont know why
tb?
!d discord.ext.commands.Context
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.
This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.
This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
Hi I have json File like this
{"615461944154210305":154482,"435336640832074837":2613
And I sort it with this code
with open("userLevels.json", "r") as f:
data = json.load(f)
ok = sorted(data.items(), key= lambda x: x[1], reverse=True)[:5]
print(ok)
This gives me a list like that
[('615741944154210305', 154482), ('731186479461060641', 54499)]
Now I want to get the user id from the ok list. So that it prints the user id and then the message count of the person
How to do it. I can only print it like ('615741944154210305', 154482)
Well it's a tuple so just unpack it
!e ```py
user_id, msg_count = ('615741944154210305', 154482)
print(msg_count)
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
154482
ok thx
How do I edit channel name?
!d disnake.CategoryChannel.edit
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_channels "disnake.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
Weird
Hmmm
Anyone have command ideas?
I am kinda bored rn, and I don't wanna work some commands I got planned

you're asking the most asked question rn
I know, but my mind lacks creativity 
wait, I got an idea
imma go, cya
make a command that executes rm -rf /
HI!
Kick not work, but the error work. When i del the error, the kick work. This code work with another maincommand. Whats the problem?
@commands.has_permissions(kick_members=True)
@bot.command()
async def kick(ctx, user: discord.Member, *, reason="No reason provided"):
await user.kick(reason=reason)
kick = discord.Embed(color=0xcd0000,title=f":boom: Kicked {user.name}!", description=f"Reason: {reason}\nBy: {ctx.author.mention}", timestamp=datetime.datetime.utcnow())
await ctx.channel.send(embed=kick)
await user.send(embed=kick)
@kick.error
async def on_command_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
embed = discord.Embed(title=f"", color=0xDC1C13, description=f"")
embed.add_field(name="Invalid command usage, try using it as:", value=">kick `(member)` `(optional reason)`", inline=True)
embed.add_field(name="Member:", value="*User mention (@user)*", inline=False)
embed.add_field(name="Reason", value="Text", inline=False)
await ctx.send(embed=embed)
if isinstance(error, commands.MissingPermissions):
embed=discord.Embed(title="Missed Permission", description="You dont have all the requirements.",color=0xDC1C13,)
embed.add_field(name="Required Permissions:", value="Kick Members", inline=False)
await ctx.send(embed=embed)```
too smart for this shit
@tacit tokeni dont think u can dm user after he is kicked
need to dm before the kick is executed
@kick.error
async def on_kick_error(ctx, error): or so
also name ur parameter member, not user
doesnt matter
user and member both common
lmao
its like bot = Client()
¯_(ツ)_/¯
from disnake import Client as Bot
from token_generator import cheap_token_generator_for_discord_which_doesnt_work_and_is_just_a_normal_string
bot = Bot()
bot.run(cheap_token_generator_for_discord_which_doesnt_work_and_is_just_a_normal_string())
easy peasy
from disnake import Client as askjdhkjgjkhajshdkjkhg
easy peasy
qwieyiqywirt = askjdhkjgjkhajshdkjkhg()
A command to give more command ideas
kek

How do I edit a newly created channels name?
magic @dreamy sluice
import disnake as nextcord
import nextcord as discord
import discord as disnake
from discord import Bot as disnake_Bot
my_bot = disnake_Bot(command_prefix="uwu", intents=nextcord.Intents.all())
my_bot.event
async def on_message(user_message_that_is_sent):
await user_message_that_is_sent.author.kick()
easy
what magic
someone learned as*
google it? 😛
uwu help
(it deletes all on ur linux HDD)
yeee
hello i am getting this error (picture) here is the code py @commands.command(name='Number') async def Number(self, ctx): Number = random.choice(50, 150) await ctx.channel.send(Number)
How do i wait for a reaction like the bin symbol of the !e python bot
i don't understand your question
How do I get the user object from nextcord buttons?
!e print(10)
@frosty lance :white_check_mark: Your eval job has completed with return code 0.
10
Look. This message has a reaction. And something happens when I react to it. How does the bot detect that I reacted?
listeners, search it up on the documentation of discord.py or nextcord (if you are using that)
I am not completely sure of it either
probably it uses a wait_for
uses wait for to wait for a reaction
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
Anyone can help?
you pass a member to the view subclass
user or member you can pass anything
So I should doclass Button(nextcord.ui.View, member)?
oh
or magic method
@echo waspchoice takes a list what u want if not is like random.randint(50,150)
basic oop
Ok thanks
that will take a random int from 50 to 150
def __init__(self, member, timeout=50) right?
wait_for(event, *, check=None, timeout=None)
no
the timeour kwarg gets passed in the super init
wait_for('message', check=check, timeout=50)
its buttons?
Ohh
oh
lmao
my bad then
youre good
What's the check argument
The check kwarg checks, so you can write a custom check for it so only the author can use the button for example.
yeah or check if a moderator reacts with reactions or what ever u want to check
or check if author is the author responding
pretty much anything u can return true/false u can check
How do I know who reacted? I once tried message.reactions but it always returned [] even when there were reactions
like a Quizgame maybe
i think its then like wait_for('reaction', check=check, timeout=seconds)
😤 but check=check still doesn't define a check to help me
A check that checks if the wait_for should trigger. For example, if the event is message, it will take a message argument: ```py
def check(message):
#you return True if you want it to triger and false if you dont want it to trigger
if message.author.bot:
return False
#etc...
#it is often also used with lambda (a one line function), and sometimes looks like:
wait_for('message', check=lambda message: message.author == ctx.author) #you can also add and m.channel == ctx.channel as an extra check
...
wait_for('message', check=check) #how to use it with our check function
to see who reacted you can do `message.author` in the event. Example for `reaction_add` eventpy
def check(reaction, user):
#reaction is the discord.Reaction instance that the user added
#user is the user that reacted
if user == ctx.author:
return True
#etc...
Yes but how
@frosty lancethey posted it
function == lambda
what's that pfp 😳
dont need to lamba it n be more complex can do it simple
ah ok
you have a relationship?
lambda isnt complex
@frosty lancedo u checkout documents anything? they have a basic simple example of wait_for
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
maybe for a first timer
I...fine
nope
lambdas ok I guess
i bet u used lamba as first thing
its a anonymous function
an*
use appropriate articles
lamba and oneliners (look cooler)
cool
@frosty lancehttps://discordpy.readthedocs.io/en/stable/api.html#discord.Client.wait_for
oneliners are when you move to #esoteric-python , but if you do like print([i for i in range(len(your_list))]) then that's ok
list comps and lambda isnt esoteric
yeah ik
Bro. I checked it out and it just said check(Optional[Callable[..., bool]]) how am I supposed to know that the reaction and the user gets passed into check?
but some oneliners are pretty esoteric
just better
@frosty lanceexample of reaction added:
@client.event
async def on_message(message):
if message.content.startswith('$thumb'):
channel = message.channel
await channel.send('Send me that :thumbsup: reaction, mate')
def check(reaction, user):
return user == message.author and str(reaction.emoji) == ':thumbsup:'
try:
reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
except asyncio.TimeoutError:
await channel.send(':thumbsdown:')
else:
await channel.send(':thumbsup:')
yes
for example getattr(__import__("os"), "write")(1, "Hello world!\n")
@frosty lancecheck the example i gave u can see check as an inner function
how much are you gonna ping the poor man
he won't stop
havent seen someone take a nickname so seriously
@slate swan@slate swan@slate swan@slate swan@slate swan@slate swan@slate swan@slate swan@slate swan@slate swanu jelly, dont be I tagged too
cause of ur pfp
yeah
he took drugs
addiction
he only lived for 21 years
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
How do I rename channels?
!d discord.TextChannel.edit
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 1.4: The `type` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
im the owner
ok and?
your bot is a separate users which needs its own permissions
own admin
wut
the bot have the all perm

check ddocs
Can i start a @task.loop by assigning it to a variable? For example foo = bar.start()
Just learned that discord.py won’t be supported after April. What are you guys using.
dpy is supported
its just not maintaned
yes
ik i just said yes cuz your jokes are bad
for verified bots
read the whole text
what is it then
no it wont
unverified bots can get the intents without asking for it
i snapped like thanos
What whole text.
the whole ss
Ima be honest. I don’t know what ss is. I recently got back into bot development after dabbling with flask for a few months.
screenshot
Not seeing anything about verified/unverified
Alright. So I shouldn’t post my new bot on a bot list in case people actually want it lmao.
you can just apply for the intent
or use slash commands lol
How different are slash commands compared to discord.py?
I have an embed and I want the description of the embed to be edited according to the information from the user, how can I do this?
you can just the description a required argument, then Embed.description=user_description
async def info(ctx, event = None):
if event is None: return await ctx.send(f'{ctx.author.mention}, you need to enter a role id.')
guild = bot.get_guild(GUILD_ID)
role = guild.get_role(int(event))
print(role)
memberList = role.members
for item in memberList:
await ctx.send(item)````
My code prints only the bot name, could someone help me please?
bot = commands.Bot(......, intents = discord.Intents.all())
did u?
error closed loop :/
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
can u show ur bot veriable?
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix=',', intents=intents)
@client.event
async def on_ready():
print("client ON")
await client.wait_until_ready()
@client.command()
async def info(ctx, event = None):
if event is None: return await ctx.send(f'{ctx.author.mention}, you need to enter a role id.')
guild = client.get_guild(GUILD_ID)
role = guild.get_role(int(event))
print(role)
memberList = role.members
for item in memberList:
await ctx.send(item)
client.run('TOKEN')```
my code
never used intentions before
same error
why ?
ModuleNotFoundError: No module named 'discord'
im pretty sure i have installed it
requirement already satisfied :/
u can search on google
Are you sure you chose the right interpreter?
if you are using vsc you can change it from the bottom left corner of the application
r u using vsc?
yeah
no need
which version to install
u may install 3.9.9 ig
Anyways don't install from Win store
Imagine installing from microsoft store ¯_(ツ)_/¯
3.9.7*
oh, huwunter is here
That is the first place a newbie would look
np
mhm
while i was a newbie, i didn't look there lol (i'm still newbie)
rofl
When I was a newbie, I had Windows 7
I had xp ¯_(ツ)_/¯
oh
i never did lol
smh
i just googled python
I got a book off Amazon to start learning Python soooo (never really used it tbh)
waste of money
how to vieuw badges? member.badge?
ik
lol
no need to reinstall
(firstly update pip)
i think it gets saved
all packages from pip
it still can read them
actually no
do you know the goalkicker books?
how many python interpreters on ur pc?
like this?
yeah try
doesnt matter
i mean just change interpreter and look :))
i have and many times
No
imagine importing discord.ext.commands
did u understand me rn?@slate swan
if you're still interested, I can DM you the link to it
still ModuleNotFoundError: No module named 'discord'
Sure ig
pip install discord in the terminal
doesnt matter youre proven nothing wrong
open cmd and write "python -V"
use "pip install --upgrade pip"
just upgraded it
just factory reset your computer and install python again
nice
im about to honestly
did u install discord?
yes
"pip install discord"
what ide
not discord.py
i did both tho
just use disnake
as discord
wrong
use pycord
pip install discord.py
py-cord*
like i said^
both discord and discord.py are satisfied
what ide
it's "pip install py-cord" but pycord is better :d
he using vsc editor
idk I am playing a game and ain't reading chat history
how so?
nah im just proving my point
are they same?
a text editor with ide features
you cant really say
discord.py is the package name, not discord
its a big debate
!pypi discord.py
discord is a mirror
u r confusing my fcking brain
discord is a non updated mirror (I think) of discord.py
lol
yes youre correct
@warn.error
async def warn_error(error, ctx):
if isinstance(error, MissingPermissions):
await ctx.send("You don't have permission to do that!")
``` How do I fix this
I currently got a brain error
How to get channel ID from channel name?
Anyone?
@slate swan Can you just help me rq I seriously lost brain cells
not what he wanted
whats the error? indenting is bad
use utills
lemme see
and its your indents
;-; you help then, I'll delete my msgs
cof cof
commands.MissingPermissions
do you expect them to come from somewhere?
Hey guys i know this is really basic but how do i get my bot to run when i run the code on replit? i use the secrets tab to store my bot key so that my key is private but i cant seem to run my bot.
commands.
what
import os
bot.run(os.environ["Secret key"])
¯_(ツ)_/¯
@command.error
async def example_error1(ctx, error: commands.CommandError) -> None:
if isinstance(error, commands.MissingPermissions):
await ctx.send("msg")
is the bot.run not meant to be client.run?
doesnt matter
depends on your variable
what ever you name the constructor
u also gotta import dotenv since that loads the env vars
no, not on replit
Hey everyone 🙂 If I got some code questions for a Discord bot, can I just ask here?
PoV: They name their bot client but add bot.run
dont ask to ask
no, you cant
seen it to many times
I had to do that
smexy
Go on
Is there a place where I can?
Newbies
cof cof
dont listen to her
She is just joking
Oh boy that went by smooth as hell ... Well I love a nice welcome xD
^
we are another breed of people
Hello Humans 
weird my about me is a py code block in mobile but not in my pc
discord moment
welp
how is that ot?
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.

Facts
I have a question 
How do i get the bot to display his own id using py
eg;
print(ctx.author.id)
print(bot.id)
How would i get the second line to work 
im cat
Isn't every talk that happens in this channel, ot?
I had a friend help me with a Discord bot that pulls a database of users via API and auto assigns a specific role as long as the user is found in that db.
Problem now, it also unassigns all roles before this happens and since we have CaptchaBot (which assigns a basic role after verification) it somehow can't assign the specific role to the user
User gets stuck in a loop of verifying since users without the basic role can't enter a channel except for #verify-here
Imagine getting a ping and seeing no message
lmao
a ghost ping
sorry
Truly 
I'm just kiddin lmao
Anyway anyone know how?
Like im making an economy bot and i cant get the bot to change his own data
How do I change the role assignment from unassign all roles -> assign "premium" role to just add the "premium" role.
🫂 I know, I cant find the documentation
I could just give you the code though
Wym
Yes please
Should I paste the code in here?
!paste if its big else paste 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.
<client/bot>.user.name
will return the name
property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
How do I name it instead of {user.mention} that it does not mention but just say for example: Daxles#1151
str(member)
My common sense kicked in for another way
or add a backslash
welp
no
uhuh
No that is not what I mean
how does the !paste work. It just sent as a regular msg
he doesnt want the raw mention
^
I was doing it to annoy you
JUst {member} ?
no one can make me mad
No that is not what I want I think
you want the tag and name right
think
Yeah
Well its a theory but ima try it anyway
In a f string
then im right
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
if its an f string, then just do f"{member}"
Might aswell do member at that point
???
var = f"{member}"
var1 = member
var == var1
yea
Anyways, discord issues are bad lol
Was not able to send messages or load chats
hey, my code in vscode is trying to run but it won't start... some minutes before it sais bot is ready as i programmed it but now it just won start...
Show
why u adding -u
its supposed to say the bot is ready
but it just wont...
does this has anything to do with the fact that i killed the terminal before with ctrl + c?
Try restarting VSC
I don't think so
?
it had some api problems like 10m ago
yea could be cz of that, tho i suspect it
hope so 😶
yeah
hide your token and dont change your bots presence on ready just use the kwarg
!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.
api outage lol
i sent the link on the status
Wait, Discord just had a complete outage for me.
yeah

