#discord-bots
1 messages Β· Page 997 of 1
Clash royale is ok
better documentation
Yes
opinions? Curious
good you mean?
look down
No no he's got a point
no
No, Clash of Clans is way better.
ye
trash
Guys please, way off topic
Ok
tru
.ot
!ot
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
Mm
Ok yes
#ot3
...
LMAO
clash of clan bro
coc π€¨
tf there are 012
When I call client.user it returns the username along with it's 4 digit number, how do I make it so it just prints the name without the numbers?
π³
client.user.name
tytytyty
yup
hello... i'm building a discord bot that can monitoring several websites... the bot is online and monitoring the website now.. but the bot didn't send a respond message in the channel...
Code?
i used this guy github as main references...
i just changing my token, channel id, website url etc...
Hey @stuck lily!
It looks like you tried to attach file type(s) that we do not allow (.rar). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
this my finished code... feel free to check..
I'm too late
x3
I'm sry for ping
npnp ty anyway
it's a help channel, you don't need to point out if a chat isn't active because that won't help in any way
if anyone can figure what went wrong with my code, its really2 helping me...
just ask questions to keep it alive :P
!paste please post only the relavant file, and not your entire project directory, along with any tracebacks you get
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.
It's just hard to tell where and what the issue is with nothing to go off of but your entire project directory
i change my token as 'my_token_here' for security purpose...
the issues with it, my discord bot is able to monitor my target website... but the bot didn't send any status on the discord channel...
Any traceback?
after i run my bot... this pop-up showed telling me that the bot are now monitoring my target website
discord bot supposedly send message on discord channel like this
but it didn't send anything
its just update my bot status to this
Py vs js
the reason i've post my entire directory is i dont know which py. files have problem... cuz all related.. sorry
my traceback
whats admin_channel()
admin_channel() is returning none
has anyone experimented with sound effects for their bots through using VC?
@sick birch
i already paste the channel id...
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
i kinda curious about this admin_channel on this code... isn't it enough if we just pun channel id
channel not found
oh my
+1
somekind of botnet
Please don't ask for help on such things that are in clear violation of rule 5.
yo
async def mybanner(ctx):
mbed = discord.Embed(
color=discord.Colour(0x303136),
description=f"{ctx.guild.name} [banner]({ctx.guild.banner_url})"
)
mbed.set_image(url=f"{ctx.author.banner_url}")
await ctx.send(embed=mbed)```
i made this command to get a users banner and for some reason i get a error saying
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'banner_url'
and how is that?
Are you on discord.py v2?
what +1
no i havent coded in months
alot of my commands dont work
await ctx.reply dont work
any idea how to fix?
datetime at #help-bread
ctx.guild.banner.url, not ctx.guild.banner_url
Same with ctx.author.banner.url, not ctx.author.banner_url
well nvm
!d discord.User.banner
property banner```
Returns the userβs banner asset, if available.
New in version 2.0.
Note
This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
!d discord.Asset
class discord.Asset```
Represents a CDN asset on Discord.
str(x) Returns the URL of the CDN asset.
len(x) Returns the length of the CDN assetβs URL.
x == y Checks if the asset is equal to another asset.
x != y Checks if the asset is not equal to another asset.
hash(x) Returns the hash of the asset.
Bruhh, here, it's kinda like " I support this"..
why
oowwhhh.. thnks for support.. sorry.. new here
That's all okay, dw :")
nah, I just opened discord, read your message and the reply, easy
Haha, cool
XD
..
...
You are now up a directory. Now what?
?
Now I can say that Hunter has a good sense of humour
lunter
C:\Users>cd ..
C:\>
that I lunter
heh
Highlight ftw
!ot π
I was just about to say I don't wanna derail this channel again
Hey so I wanna do like a setup for my bot, example:
,setup cmdlogschn #general
And every command used in that particular server should say something like (user used cmd) in the channel mentioned during setup
Possible?
or is it, vsauce music intensifies
idk
yes
h o w can I do it?
So you essentially want on-demand logging?
Yes I gave the logging for an example
h o w = homework
.
if yuo're planning to ocassionallly chagne it, then use database, else,get the channel & send stuff in it
k
I highly doubt making a discord bot is given as homework in many education institutions...
lol get the joke
Have I been whooooshed?
dont u understand a joke
yeah kinda ig
dw, it's ok haha
nope
get some help
the number of time you edited your message is just... π
I smell mods
oh shit, hi cokecane :")
Hello
license to watch age-restricted content with legal age license :>
A what
..
Cokecan 2
Then your birthday is in 4 days
yeahhh
Wait where ashley
I didn't get to reply
Cokecane 2
π
someone named Cokecane2 was typing
its okay, like anybody would care π
I did
π wdym by someone?
I was about to reply
u ignoring me? lmao
its eito smh
No delete π
This is how mods are forced to ban the name cokecane
corrected thanks
lmao
on a side note, we'll be warned sooner if we stay here
..
yo
@slate swan im making timer for my giveaway cmd :>
nice
lol
@bot.command()
async def cokeban(ctx):
for members in ctx.guild.members:
if members.name.lower() == "cokecane":
try:
await members.ban(reason="cokecane")
except:
pass
.ban is a coro btw
fine
Excerpt from a refactoring extension I use:
We suggest making the following changes to Function cokeban:
- Use except: Exception rather than bare except (
do-not-use-bare-except[ https://docs.sourcery.ai/suggestions/do-not-use-bare-except/ ])
@bot.command()
async def cokeban(ctx):
for members in ctx.guild.members:
- if members.name.lower == "cokcane":
- try:
+ if members.name.lower == "cokcane":
+ try:
members.ban(reason="cokecane")
- except:
+ except Exception:
pass
Sourcery - Use except: Exception rather than bare except sourcery(suggestion)
Sourcery is an integration for your IDE or GitHub that suggests refactoring improvements to help make your code more readable and generally higher quality.
uh
lmao get refactored
;-;
After accepting that one, I got this:
Function cokeban refactored with the following changes:
Use contextlib's suppress method to silence an error. (use-contextlib-suppress[ https://docs.sourcery.ai/refactorings/use-contextlib-suppress/ ])
+import contextlib
import discord
from discord.ext import commands
import os
async def cokeban(ctx):
for members in ctx.guild.members:
if members.name.lower == "cokcane":
- try:
+ with contextlib.suppress(Exception):
members.ban(reason="cokecane")
- except Exception:
- pass
Sourcery - Use contextlib's suppress method to silence an error. sourcery(refactoring)
Sourcery is an integration for your IDE or GitHub that suggests refactoring improvements to help make your code more readable and generally higher quality.
π oh gwad wtf
It turned this:
@bot.command()
async def cokeban(ctx):
for members in ctx.guild.members:
if members.name.lower == "cokecane":
try:
await members.ban(reason="cokecane")
except:
pass
to this:
import contextlib
@bot.command()
async def cokeban(ctx):
for members in ctx.guild.members:
if members.name.lower == "cokcane":
with contextlib.suppress(Exception):
members.ban(reason="cokecane")
Damn
NOBODY ASKED +NOBODY WANT +NONE CARESπ π₯
Rude
NOBODY ASKED +NOBODY WANT +NONE CARESπ π₯
π€£
Lmao I got ratio-d...
π
NOBODY ASKED +NOBODY WANT +NONE CARESπ π₯
yo u cant copy me
Lmao ok I'll appoligize
I'm sorry
Let's not make this channel any more ot than it has to...
import contextlib
@bot.command()
async def cokeban(ctx):
for members in ctx.guild.members:
if members.name.lower == "cokcane":
with contextlib.suppress(Exception):
members.ban(reason="cokecane")β
This is New for me
The exception
ye
with contextlib.suppress(Exception):
why do u need to suppress Exception?
XD i have to try this
Haven't used this
now get questioned
It was a joke that @slate swan made, and my refactoring engine took it seriously...
"refactoring engine"
Original @paper sluice
π
Yes
Im newbie na
What else am I meant to say? Refactoring extension, helper, free cop-pilot, Sherlock Holmes?
and lower is a method
its my patent
Should apply ()?
u dont need to run it...
no i just saw that again because discord decided to be dumb and jumped to that message when i came back here
..
yes
happens to me too
so much chat related to cokecane
Wtf
coffe
A bare except: clause will catch SystemExit and KeyboardInterrupt exceptions, making it harder to interrupt a program with Control-C, and can disguise other problems.
~~bare except will also catch a robber, so we should keep it ~~
Use contextlib's suppress method to silence a specific error, instead of passing in an exception handler. This refactoring will add an import for contextlib if needed.
Before
try:
travel_world(days=80)
except DistractionError:
pass
After
import contextlib
with contextlib.suppress(DistractionError):
travel_world(days=80)
XD
I was reading that article
its time, we deal with real world problems
Like?
catching a robber....
Using python
sure
Well
This is embed title
this is embed description
today at 11:30
nice for normal msg errors
Who have study automata here?
This is embed title
this is embed description
today at <t:1650779880:R>
promotion get banned
ah ive seen this
how do u do a minute ago
hacks
Does sharing a link here result ban?
sus
How to do minutes ago?
<t:1650779940:R>
!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.10)") for presentation within Discord.
This allows for a locale-independent way of presenting data using Discord specific Markdown...
there is this also which u can use, for ur bots
Well damn, TIL
help?
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
print(f"{filename} Cog Loaded!")
it gives me an error:
main.py:30: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
bot.load_extension(f"events.{filename[:-3]}")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
but if i put await bot.load_extension it wont work either
# Load the Cogs
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
bot.load_extension(f'cogs.{filename[:-3]}')
print(f"{filename} Cog loaded!")
It might be an indentation error
if that's the same indentation you have in your actual code
is there any website of site that have basic code for discord bot build?
eh. basic code? u can easily get in examples of most of the libs
example folder i mean.. that they've in their repo
:'/
sparky shush
Ok
lmao
uh
Pfp
Change pfp
no
π yeah, even i dont like that idea too much
friends be thinking that i'm catfishing π
lmao
was thinking about you the same
lmao
Lol
Ur already cat fish
i like cats tho
nvm, this is off topic
Pls change ur name to the original one
uh, u need to put it in an async function
Both of u
- load_extension is now an asynchronous function
so yeah you gotta make a function to load them
I can load without it
π€ it wasn't an async function before right?
Without awaiting it
you're a legend
yus
lmao same.. maybe cuz it wasn't async before
Lol you are using a old version ig
No error nothing just all works fine
oh yeah, thanks
ur on 1.7 ...
I use disnake
big fan peter parker :")
π
you could monkey patch the library code and change it to a normal function
Im using latest disnake ig
..
me too lmao, like i'm using latest py-cord.. and still ain't feeling the need to await...
py-cord uwu
discord.Bot so uwu
no disnake.Bot
i'm using discord.ext.commands.Bot :'/
only py-cord has that
good
my sense of names has left, and grammar f
at least u remember the spelling of grammar, that's good
@commands.command(name="help", description="view the usage for a command", usage='help [cmd]', aliases=['commands', 'usage'])
async def help(self, ctx, command=None):
if command is None:
# commandsList = ""
# for command in bot.commands:
# commandsList += f"`{command.name}`,"
commandsList = []
for command in self.bot.commands:
if command.require_var_positional:
commandsList.append(f"{command.name}*****")
else:
commandsList.append(f"{command.name}")
embed = discord.Embed(
description=f"**questions @ woke#7396**\n"
f"{len(self.bot.commands)} commands in total\n"
f"\u200b\n"
f"{', '.join(commandsList)}",
color=0x8e65b3)
await ctx.send(embed=embed)
else:
for cmd in self.bot.commands:
if command == cmd.name or command in cmd.aliases:
if not cmd.aliases:
cmd.aliases.append("no aliases")
embed = discord.Embed(title=cmd.name,
color=0x8e65b3,
description=cmd.description
)
embed.add_field(name="usage", value=cmd.usage, inline=False)
embed.add_field(name="aliases", value=', '.join(cmd.aliases), inline=False)
await ctx.send(embed=embed)
this is my help cmd, how do i make it so i can see the help embed from group commands?
for instance:
,help welcome works
BUT
,help welcome add doesn't work
Me too kid π₯Ί
Bye imma go play some games
A Bad Practice
:>
what do u mean?

how do i make an argument optional in a command?
Why
Tobey Maguire was good :)
tysm, cant believe i forgot that
this is from docs of py-cord.. latest..github branch... not an async :"/
you should subclass HelpCommand and make a help command
subclass the default help command
Everyone is great in their own way
i was talkin bout discord.py
how do i make that work?
my bro, ego, been typign since last 2 minutes
nah i've sent a few messages lol
oh lol π
whyy
I can make absolutely no sense of that
I've already looked that over and read it through carefully a few times, but it just makes no sense
π€¦ββοΈ
π today i realized that ive this thing in my starred ones.. but i was not aware WTFFF
sparky as nail typer?
snail
sheesh
Ye im snail typer
i was literally about to say that same thing for u .. like wtf what have u even been typing
Sparky a snail typer
rip
π my english is bad even though thats my main language, sheesh
Imagine so fast without using pc
That was a joke
I didn't open Discord in pc for 2 months lol
Sad why
Preparing for entrance exam π
Delete dc now
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
they pollute the chat with embeds then delete
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
role = discord.utils.get(ctx.guild.roles, name="muted")
if member is None:
return await ctx.send("missing arguments")
if member is not None:
if member.top_role >= ctx.guild.me.top_role:
return await ctx.send("i can't mute someone above my top role")
if role not in ctx.guild.roles:
perms = discord.Permissions(send_messages=False, speak=False)
await ctx.guild.create_role(name="muted", permissions=perms)
how do i make it so when it creates the role, it also makes it so it edits the category/channel permissions to send_messages=False & speak=False?
can I store additional data in a message not visible to users using discord.py? For example, I send a message showing the profile of a user via my bot, and then the bot has added a delete reaction to it. How can I store the owner users user id or some other unique id for the user to that message, so that when the user reacts to that message, it checks if the message is owned by the user, and only the user can delete it.
So basically make the reaction buttons of one message only usable by a certain user
And hard coding is not an option as it basically is like a server list
Thanks
use discord.Permissions
i'm already using that...?
emoji = "" if round(self.bot.latency * 1000)<100 "" elif round(self.bot.latency * 1000)<500 else ""
```
what is proper syntax for this
async def name(ctx, required: str, optional: str='None')
use checks with id as user.id where user is your author. also can be ctx.author.id
just set a default value
But now it just edits the global server perms, not the channel/category perms
oh ye, so its not working?
what whats your problem?
u can do without str
yes
you need to edit the channel for that iirc
str = None
Yes, but how do i store that value in the message, for example
When a user reacts, I get his user id, but then i need a second id to compare to, so where in the message should i store that value, so its different for each message?
then u can do
if not str:
!d disnake.TextChannel.set_permissions
await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sets the channel specific permission overwrites for a target in the channel.
The `target` parameter should either be a [`Member`](https://docs.disnake.dev/en/latest/api.html#disnake.Member "disnake.Member") or a [`Role`](https://docs.disnake.dev/en/latest/api.html#disnake.Role "disnake.Role") that belongs to guild.
The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://docs.disnake.dev/en/latest/api.html#disnake.PermissionOverwrite "disnake.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions "disnake.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.
If the `overwrite` parameter is `None`, then the permission overwrites are deleted.
You must have [`Permissions.manage_roles`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_roles "disnake.Permissions.manage_roles") permission to do this...
same thing
you wait for the reaction in the same message function. Use wait_for
wow this is a perfect example @junior plinth , only the user who ran this command can delete this prompt, not any other user
how do i do something like this?
!d discord.TextChannel.set_permissions
await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sets the channel specific permission overwrites for a target in the channel.
The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that belongs to guild.
The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.
If the `overwrite` parameter is `None`, then the permission overwrites are deleted.
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...
!d discord.Client.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.10)"). 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.10)") 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.10)") 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**...
why 2 times?
No, disnake and pycord are separate things
@waxen ruin
Both are forks of discord.py (which is maintained and probably has more features)
see the examples as well for better understanding
ahh , ill read through it, is it okay if i dm you incase i have any further queries regarding this?
maybe lets make a thread here, and you can ping me?
that works
for example, ```py
method 1
overwrite = discord.PermissionOverwrite() # create a copy of perms
overwrite.send_messages = False # change wanted perms
overwrite.manage_messages = False
await channel.set_permissions(role_obj, overwrite=overwrite) # use the channel object to set the perms for the role_obj to overwrite
method 2
await channel.set_permissions(role_obj, send_messages=False, manage_messages=False)
same as method 1 but just set the perms to key word values```
arent overwrites supposed to be dicts?
yes, yes they are
hello, if the instruction tell us to write 'pip install' something, where do we suppose to type it? i try cmd, not working... p/s the requirement need me to install ping3
just run that command
pip install -r requirements.txt it'll install all the necessary dependencies with that command
C:\WINDOWS\system32>pip install -r requirement.txt
Fatal error in launcher: Unable to create process using '"C:\Users\AMD\AppData\Local\Programs\Python\Python310\python.exe" "C:\Users\AMD\AppData\Local\Programs\Python\Python310\Scripts\pip.exe" install -r requirement.txt': The system cannot find the file specified.
i got this error
the file doesn't exist
in the cwd
are you using whole of the pip's executable path....?
yes... when i install phyton before... i include PATH as well
kinda weird, i run pip install on cmd before and its work well... this time it doesn't exist
i added a cog and restarted my bot, the new commands work in a server but not in another? its weird
the requirement need me to install ping3 module... any other way for me to do that?
did you add the guild_ids kwarg in decorator of the commands
ah, i didn't, ty ty
If the user provides any member object by pinging them, is it == to discord.Member?
is this concept good? like a reminder command, you can create a repeater that repeats every time specified, like >repeat 1D, would repeat every 1 day forever, until you cancel it. It's meant to help you run commands at intervals, like if there is a cooldown on a command in dank memer, just set a repeat for every length of the cooldown and you can keep grinding it constantly
wait, do i add this for each command?
if you typehint it, yes
WDYM>
I take an argument member: discord.Member = None.
And if the command user pings the member, will it be equal to discord.Member?
async def mute(ctx, member: discord.Member, reason: str='None'):``` would accept , 879807617260716143, HRLO77#3508, or @quaint epoch as a member
the : discord.Member reads that as a member
I wanna check if the member actually exists.
anyone mind helping?
you could just not type hint it, clean the prefixes, try to remove the first @ and fetch the member
ez
...
you dont need to I just asked smhhh
hey ashley
!e
class Someclass:
...
a: Someclass = 12
print (a == Someclass)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
False
okay
Oh!
how do you clean up prefixes again?
That works
!d disnake.Message.clean_content
A property that returns the content in a βcleaned upβ manner. This basically means that mentions are transformed into the way the client shows it. e.g. <#id> will transform into #name.
This will also transform @everyone and @here mentions into non-mentions.
Note
This does not affect markdown. If you want to escape or remove markdown then use utils.escape_markdown() or utils.remove_markdown() respectively, along with this function.
yeah, this is it
hola
ok so like im rly confused rn, some commands are not working in specific servers
YEAHHH... finallyy did it... thanks u all for helping me!!! 
any reasons this could happen?
i regenerated my token & restarted, the commands still do not work in one specific server
do they work in every other?
yes.
make sure the bot is in the server and has permissions to send messages
an issue with your help command....?
the commands don't work either
....?
was an error with help command
lmao
its alright, shit happens
dont set the colour easy
!e
def a(some: int = 'Hi'):
print (some == int)
a()
or if you mean that extra strip, that remains
mhm
@slate swan :white_check_mark: Your eval job has completed with return code 0.
False
eww
What
wth was that smh
why would anyone do that
thanks
just set the colour to be the same the embed colour
!d discord.Embed
class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if itβs within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") for you.
Changed in version 2.0: `Embed.Empty` has been removed in favour of `None`.
yeah just set the colour to be jet black or smth
Can someone help me to understand how do i develop a discord bot in python?
!d discord @lofty tide
In order to work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
l
then how do i create a bot account?
Itβs so easy π
Just an advanced "warn" command took me around 1 hour.
Which handle every exception.
And keep track of warns.
Its not that easy when you are trying to make a public bot.
Ah ok
What are you tryin' to say? @slate swan
Watch them type for hours
This happened with jaguar
Yeah lol

Type quicker
Please I beg
no
I will literally go insane
lol
Oh are you ash
Your eito
you are
yes i am Eito :")
Exposed
?...?
Ay I donβt understand what Iβm saying cause I just woke up
lmao it's okay
Back to discord bots
Yes
its easy as drinking water
+1 ^
anyone?
bruhh?
bro
!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.
use this from next time :")
ok sorry
don't say sorry, it makes me feel guilty lmao
lmao
lol evil eito
can you tell me now?
if u want to send to yourse.f. then use get_user
ofc i am lol
do u have members intents enabled?
TO CREATE A BOT ACCOUNT FOR DISCORD.
-
Visit https://discord.com/developers (alternatively search discord developer portal using a search engine)
-
Login/Sign Up
-> On the applications page (https://discord.com/developers/applications), Choose CREATE NEW APPLICATION -
Type in your desired name
-
A new application is now created
-
In the menu of your application, go to the bot tab of your app from the navigation bar on the left
-
Click on CREATE A BOT (or whatever is written there) and CONFIRM it
-
Scroll down, Toggle the required Intents, and set the required Permissions
-
Now select Oauth2 from the navigation bar on the left, Click on general, Set the required Permissions and the method for app authorization (or whatever it is)
-
Now click on URL Generator, select the required permissions, scroll down and copy the url, paste it in your web browser, and authorize it and choose a server to add it to
pls explain not understood
do u have members intent?
yes or no...?
yes
woah 
sheesh nothing, why would I "try"?
π woah.. u r really hardworking
π no cap
tysm!!!!!!!!!
do u have it enabled in the dev portal?
....
i was saying that to ashley...
yes
Why are you always a discord tutorial
show ur intents @slate swan
!d discord.ext.commands.Bot.get_user use this
get_user(id, /)```
Returns a user with the given ID.
Changed in version 2.0: `id` parameter is now positional-only.
use this ^
Average idiot
then DM to yourself.. π
lol
π
you're good
!d discord.AppInfo.owner
The application owner.
π€ woah i didn't know we had this thing.. i ws aware of bot.owner_id only
no u
|| you're more||
its not really used anywhere
π€ yeah yeah, thanks tho
Created the bot (: @tawny loom
Now, how do i do that he is always online & how do i develop him?
so eito is ashuwuley and ashley is eito
oo so APP is like the one in developer portal, but not related to bot, right? @slate swan
ashuwuley nice
wth, Am I the only one who didnt give my bot a specific gender π
ew
LOL
yeah you could say that, the class basically stores the data you provided for that application
π well.. i think it depends on the pfp you've give to the bot.. that's what i do π
aah that's cool.. thanks lmao
how do you identify "paper" a m or a f?
butttt can u answer my question?
psycho
LMAOO
@slate swan
you first need to choose a library you want to start developing with
π

what do u suggest?
my friend -> mf, guys
nah definitely not
so, if I'm getting it right, you dont want your bot to do anything, just stay online?
!pip hikari is what i use , if you have an intermediate/strong hold on python go for it
You want your butt to talk π
``` what does this mean
lol
!pip discord.py base and mostly used library
yes ^
and then they say my humour is broken
LMAO that sounds wrong
i want him to auto-responde if i write something speciphic (my english is not that good pls dont judge me if i have mistakes)
#databases ? looks like thats a sqlite query
Their butt is broken
π€ write something.. in terms of message or command?
its mongo but
i see
and its okay, nobody judges you and thats against rules to do so
its still a database
yes, i didnt know there was channel for such
if message.content == some_string:
await message.channel.send("Ok, so.... you said that")
In yr on_message
message, like...
if i write "whats the ip?" he sand: "the ip is: play.tryserver.net"
....? that person just made their frst bot account and you are on it straight away
see above message sent by @maiden fable
but try to get the grip tho
!d discord.ext.commands.errors.BadArgument
~~```py
if 'ip' in message.content:
...
#bot-commands
Bro
back
mb
i realize, thats too vague
Sis
I'mma just go away
amm
can u explain to me like..
how do i open a python project or something like that and program it?
MC IP Address
yeah lol
ur name suggests that u hunt urself 
hurt*
I want to
nvm NVM
hunt*
.
Ik (:
?
chat moving kinda wild
if msg.content == "whats the ip?":
await m.channel.send("the ip is: play.tryserver.net")
fr
do you at least know python?
A normal day in #discord-bots
ofc
i dont think
π€ u know about classes?
not that good but basic
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 193, in foo
await me.send("``I have been added to:``")
AttributeError: 'NoneType' object has no attribute 'send'
ok so whats this called in python {}
What's me
Curly Brackets!
make sure me is not None 
..
uhm... discord bots are considered to be somewhat of intermediate level stuff.. i wouldn't recommend u to go for discord bot if it's your first project..
I started discord bots when I didn't know functions exist π
im asking him not you!
same lmao
@client.listen("on_guild_join")
async def foo(guild):
channel = guild.text_channels[0]
rope = await channel.create_invite(unique=True)
me = client.get_user(967692505162346536)
await me.send("``I have been added to:``")
await me.send(rope)
i started discord bots when i was NOT familir with classes.. all my commands in one file.. imagine having to maintain a bot with over 2k lines (ik it's not too much, but at that time it was a hassle to me)
bro
correct?
no
why?
oh.. can u just try to explain to me where do i open a project (what site) and how do i link it to the bot and do somthing i thing basic like auto respond?
use on_guild_join event with event decorator
client.listen("on_guild_join") u can pass it in like this?
@client.listen("on_guild_join") ?
Uh, how does that make a difference?
yes sure
Yea
...?
!resources @lofty tide I would suggest looking into this
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
π it wouldn't π€ i wasn't aware of bot.listen.. i was only aware of cog.listerner shit
lmao eito nub
:>
Ashley*
...
you probably dont have member intents
!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.
there is anothe rpossibility too tho
everyone just do !resources i dont think anyone has learned python from that
u need to enable it in code also
!d discord.ext.commands.Bot.listen this prevents the bot from overriding the default listeners
@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.10)").
Example...
in your code too, sir
like imagine they not having permission to send message in 1st channel of hat guild
Your nick
how sir?
!d discord.Intents @slate swan
class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.
Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.
To construct an object you can pass keyword arguments denoting the flags to enable or disable.
This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
New in version 1.5...
yeah, if the id is wrong or not in bot's cache
there is so much here... idk what to choose.. i dont undernstand much in this kind of things
hm
Just click different links and see what each thing offers
what is up guys
all bad
yeah.. so there are like 3 or some possibilitieies of error with on_guild_join stuff even if the code is correct
The channel is already crowded, not rn, but nothing much
Sky
up is my head and down legs
roof :'/
mii
isn't here
You did that twice π
import discord #importing the library
from discord.ext import commands # importing the commands framework from that same library
bot = commands.Bot(command_prefix="uwu", intents=discord.Intents.default()) # initiating your bot
@bot.command() # command decorator to register the below function as a bot command
async def ping(ctx: commands.Context): # an asynchronous function initiator, this function will be responsible for the behaviour of the command. On a side note, the first argument passed is always required by the commands
await ctx.send("No pong, an uwu for you instead") #sending the message back when the command was used
@bot.listen("on_ready")
async def on_ready_uwu():
print("online") # this function will print "online" when the bot is ready to use
bot.run("token") #starting your bot, in essence, getting it online and working
NOTE: the above code follows the syntax of discord.py
Which is a good thing
π wot?
Welcome back, basic_bot.py exists in the examples directory
for the get_user part yes,
there's much more
guild.text_channels[0] this fails if the guild has no text channel ( tho only a weirdo will make such server)
rope = await channel.create_invite(unique=True) this fails if the bot does not have invite member permissions
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
while True:
statusType = random.randint(0, 1)
if statusType == 0:
await client.change_presence(status=discord.Status.idle, activity=discord.Activity(type=discord.ActivityType.playing, name=f"with {len(set(self.get_all_members()))} users"))
else:
await client.change_presence(status=discord.Status.idle, activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(set(self.get_all_members()))} users"))
asyncio.sleep(16)
this aint looping, it remains same always 
Roof π
ofc u and ur uwus
π ok ok
the commenter
shouldnt it change after every 16s?
!d discord.ext.tasks.loop
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with
optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
why is there 2 ashleys
U r an ||us||
Use this (:
huhh, im on phone, so uhh, too lazy to go te dpy server and type ?tag examples
can u pls sand a link to which side do i type this?
python -m discord newbot
Send*
@lofty tide this would be helpful to you π
us = ultimate sparky
oh right srry
im not sure how to use this inside a class :/
channel go brrrrr
u didnt await asyncio.sleep and by what i can see its outside the loop, and just use tasks.loop as hunter said
?tag bb exists
?tag bb
This is not a Modmail thread.
No need to say sorry for that lol
no
Wym
just type it on the back side of your pc
In dpy server
lol
π lol
Bruh, stop it
lol
Thanks for letting me know the prefix π
oh
π that was unintentional but okay xD
I feel you Spark π«
it was me who said hewo and chat was dead...
at least i replied.. eito nice guy :>
now realy?
...?
sand
send*
sed*
srry
π₯ͺ
π
π₯ͺ
Ignore her, she's trolling messing with you
LMFAO
hahaha
ππ
k im going to play minecraft (:
What I interpreted:
-> Someone named Eito changed his name to Ashley
-> Someone named Ashley changed his her name to Eito
!ot i wanted to do it
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
create_custom_emoji takes a byte-like object
idk im new to discord.py
!d discord.Guild.create_custom_emoji
await create_custom_emoji(*, name, image, roles=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a custom [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji") for the guild.
There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.
You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
ong
..
well if you're familiar with python, coro, OOP then it's easy...like OOP is the main part..
imo
class shit
hes not new to coding lol ik him
oh lol, is he trolling?
no
no
classes arent shit
yes you're right
bro i know how to code too and i still can barley read the docs
classes are worser when u didnt completed ur homework
I wont have school for one and a half year, classes are good as long as I dont have to attend them
π well.. i wish i could agree.. but i can't
dont we mean class objects when we say classes here?
yeah lol
owo i see
just pass in a Bytes or a Bytes-like object of the image instead of you know, passing the url
classes are..... fun to attend
In short, you need to get the image file
and convert it to bytes
class bytes([source[, encoding[, errors]]])```
Firstly, the syntax for bytes literals is largely the same as that for string literals, except that a `b` prefix is added:
β’ Single quotes: `b'still allows embedded "double" quotes'`
β’ Double quotes: `b"still allows embedded 'single' quotes"`
β’ Triple quoted: `b'''3 single quotes'''`, `b"""3 double quotes"""`
Only ASCII characters are permitted in bytes literals (regardless of the declared source code encoding). Any binary values over 127 must be entered into bytes literals using the appropriate escape sequence...
i dont want an infraction for unnecessary reports
PLS send a link to where i should type that
in an ide.....?
Lmao
π bro, in your python file you'vE to type that
._.
pls just send a link and dont troll ):
@lofty tide I would suggest u go to #python-discussion and ask them on how to get started with Python coding
^ +1
Nvm
just use any code editor. Period.
it doesnt need any specific machine/software
while True:
print("+1")
that's not a wrong suggestoin tho
βοΈ
ok it's False now :")
Was gonna say smth else too but Nvm
!?
oh lol, sorry if i interrupted lmao
β ’βΆβΉ
!e
while True:
print("+1")
@slate swan :x: Your eval job has completed with return code 143 (SIGTERM).
001 | +1
002 | +1
003 | +1
004 | +1
005 | +1
006 | +1
007 | +1
008 | +1
009 | +1
010 | +1
011 | +1
... (truncated - too many lines)
Full output: too long to upload
idk where`s that lamo
im preety
thats more of a how to get insulted in seconds
Nahh, I just thought to leave. People already hate me 
k
no hunter π we love u
yes you're pretty asf no doubt & here's your 'lmao' :>
right
dw, i hate u too bro <3 lmao
u hunt urself, and people hunt the things that they like, so u like u which is all that matters
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
I never insulted anyone. I just told him so cz this is a topical chat and we don't tell people how to get started with Python
imagine asking hunter to move to an ot channel
Eh, I'm going out anyways
no
I didnt even say that smh
Mb
Dont delete ur account :<
I wish I could tho. Would be the best thing ever
π my dude really chilling nice i like it
ok as you wish
!ot finally i got a chance to do i t:>
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
Bruh everyone stop using these ot commands now
no he will got outside
......?
idk, good night, its already 8 am
8 am
who sleep at 8 am
chat's getting out of hand, imma ask a question related to discord-bots
how do i make my bot bake a cake
- Take a microwave
- take a cpu that is hosting a dc bot
- connect microwaave to cpu
- type !run
microwave and a cake.....?
how....
I mean, ovens exist
microwave and ovens are same ig
no
channel turning from discord bots to recipe
lmao
nice, ima learn something today :")
take a knife make a cut put salt in it
u will be a angel
microwaves are ideal only for heating things up, plus you can set temperatures as desired in an oven and you need a specific temperature for baking a cake
nvm
ok so i have oven
.topic
Suggest more topics here!
i'd love it if hikari made views simpler without miru support
really want a rich presence feature now
bot bake a cake
make me a discord mod :'/
@slate swan but, how do i link my bot to the code?
owo so hikari is dependent on another stuff (i mean miru or whatever)?
nah, its like hikari allows you to use several other extensions
use the token from the bot section of your app
hikari is dependent on anime
oooo
what.....
wtf waitt
π anime?
yes
https://github.com/sarthhh/gojo/blob/fcb78fc5d85f98ff101b1d2a34b4c735c6e2e396/src/extensions/fun.py#L79-L83 "defining a select menu be like"
src/extensions/fun.py lines 79 to 83
act_row = (
fun.bot.rest.build_action_row()
.add_select_menu(str(context.author.id))
.set_placeholder("Select an animal.")
)```
owo i see
!pip hikari-miru
An alternative component handler for hikari, inspired by discord.py's views.
π€ why u chose hikari over discord.py tho? @slate swan
where you writed "token" put the token?
yes
chose*
doesnt hikari sounds like anime
right
goto bot menu
in the bot section of your app you created on the website
i find it easier, better codebase, faster cache, built in logging, Cache and RESTClient class "which is documented", i bet there are many people who use discord.py but still dont know that something like bot.http exists which is a HTTPClient and can be used to do stuff like sending messages, adding reactions and stuff with just snowflakes (ids) only because its not documentated
you gotta reset it and copy it
i see the word "token" but i dont see the token
And the BEST thing:
Compliant with MyPy Strict
yesssss
voice. receiving.
what....the heck is .http
xd
uh....?
helpful, thanks a lot
ill just click reset token
yes you have to reset and copy
literally the best file in the library
Agreed
k it worked
π€ i see, that makes some sense to me
oh thanks
Why wont this work?
ooo yeahh i've seen some mf using it during eval... when i was a beginner but wasn't even aware of it lmao
suppose you want to send a message to channel with id 123 you can simply py await bot.http.send_message(123, content="....") instead of manually get_x'ing the stuff
damn that's nice fr
This is one thing I love about hikari
add a Role object, not an id
when you realise that this example was for discord.py
for hikari is bot.rest.create_message
add_roles(discord.Object(id))
..
Yeah was thinking about the same when hunter said that
LMAO
I meant hikari allows using the underlying http methods directly which is good
yeaah