#discord-bots
1 messages · Page 669 of 1
then you shouldnt get that shit
You shouldn't be getting that error
So the bot has Admin perms by default
contact discord if you do so
Like when you create invite, i ticked admin
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.
for i in range(len(level)):
if lvl == levelamt[1]:
await message.author.add_roles(discord.utils.get(message.author.guild.roles, name=level[i]))
embed = discord.Embed(description=f"{message.author.mention} you have gotten the role **{level[i]}**!!")
embed.set_thumbnail(url=message.author.avatar_url)
await message.channel.send(embed=embed)```
i have this code but it doesnt give me the role when i level up
anyone have an idea on what could be wrong
ive given my bot manage roles so there shouldn't be a problem with the perms
Is there a way to check channel's type?
Like community, text, voice?
half the code isnt even there
U can do isinstance
o_O
!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).
use the channel classes
Or
me or the other person
how do you do this? do you do it manually or is there a button for it
Lemme get it
ignore what i posted, i identified an error in the levelling system which adds xp
send whole function code
nice
^
the snippet thing happens automatically
lol
no
when you copy link with highlights
i mean the gh link
U can do channel.__class__
hold shift and click on line number
thanks
Advanced shit ik
not really, I said the same thing and you were coming up with an "or"
does the font look weird or i'm I going insane ,-,
It's custom font
With 85% discord scaling (zoom)
when you're too free in life
Well yea... I installed it like 1 year ago
I thought you made it oof
you gonna need glasses soon ig
The worst thing is I can't differentiate between ; ans :
,-,
oh yeah i remember keeping a font like that
!ot
Off-topic channels
There are three off-topic channels:
• #ot2-never-nester’s-nightmare
• #ot1-perplexing-regexing
• #ot0-psvm’s-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
it was crap for coding
Kinda ot but one of my cousins is trying to code games what languages do you guys recommend i recommended him c++ and java
for mobile/desktop?
Maybe both idk his interests
Probably desktop
Hes a beginner btw
for desktop any language is fine actually, based on their preferences
for mobile, Java is the easiest
could i have the python for dummies pdf?
But what are languages most easy or most popular
depends, if you want to make 3D games most of the game engine uses c#
Well i think hes dream is too become a high level dev for games like minecraft and others ik minecraft java uses ofc java and minecraft bedrock uses c++
how can one host their bot for free
You can self host or use free options which arent that great
i cant self host, and can u recommend me free ones
pslpslspls'
do any of you have the python for dummies pdf?
Best is heroku
alr thx
But compared to vps is nothing good
only if you sponsor
🚶
!ot
Off-topic channels
There are three off-topic channels:
• #ot2-never-nester’s-nightmare
• #ot1-perplexing-regexing
• #ot0-psvm’s-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
it depends on their need ig, both of the language is fine (Java and c++). But c++ is more complicated imo. Back again to their preferences
,-,
Ah i see
why the ping?
why not
What should he start with?
its kinda annoying
I like annoying people
nice
isnt that limited
like u can use it for like a month or something
yes
bruh
you can make another account though
:/
if you're up for it that is
hmm, if they have sufficient experience on coding then maybe c++. But java is more widely used tho. But maybe c++
Nah their beginner
do u know of any other free way to host a bot
Doesnt even know how to make a function correctly not being offensive lol
without having to use replit or self hosting
railway
is that time limited?
what do u rate it overall out of 10
jumping to c++ directly is... Pain. They might want to learn py or js before learning c++
No like no kidding their fully beginner to programming
if they really serious learning it then it might not took some time. But if they like, do it as a hobby then nah
But they could try eventually
Idk he doesnt have much time but ill have to speak to him
why do you even wanna make a game if you dont have time lol
He mostly admires me so hes kinda learning a bit from me but im not really orientated to game development
For his future job
how old is he?
Idk like 13
hm
He is passionate about his stuff hes just very limited to things
how do i even use this
import discord
from discord.ext import commands
from discord import Activity
from typing import Optional, Union
Token = ""
bot = commands.Bot(command_prefix=".", owner_id=521325126722125874)
@bot.command(name="ping")
async def pingme(ctx):
# ws ping
embed = discord.Embed(title=':ping_pong: Ping', color=discord.Colour.dark_gold(), timestamp=ctx.message.created_at)
embed.add_field(name=":green_heart: WS Ping", value=f"```py\n{round(bot.latency * 1000)} ms```")
@bot.event
async def on_ready():
print("Launch Successful!")
bot.run(Token)
no errors but .ping doesn't work
( doesn't send anything )
Uhhh
You arent sending the embed🕴️
Lmao
Bruh
after adding self.client.preocess_commands, my bot is sending every commands 2 times
any help?
dont use that in bot.listen() or Cog.listener()
why does this come up three times
code?
async def ban(ctx,member:discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'{member.mention} was banned')```
commands.Cog.listner()
const Discord = require('discord.js');
const client = new Discord.Client({ intents: 32767 })
const prefix = '$';
client.once('ready', () => {
console.log('Twinnem is online!');
})
client.on('message', message =>{
if(!message.coontent.startsWitch(prefix)|| message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'ping'){
message.channel.send('pong!');
}
});
client.login('token'); did i do some wrong to make the command not work?
i'll remove it?
???
this is js
yeah this is js?
you dont need to use bot.process commands in listeners , its meant only for events
This is a python server you know that🕴️
and this is python discord
oh got it
yeah go there and ask
ty
@ocean leaf
you have your bot running thrice
what
Thrice = twice🕴️
yea removing it will fix that
you clicked on run , but didnt click on stop before running the bot again
ahhaha yes
oh
English isnt my first language either 🕴️
you can control it from here , the square to stop it , the round one to rerun the bot ....
by thrice i meant 3 times tho :/
You mean three 🕴️
i mean this
now it dosent give me xp
your code?
class levelsys(commands.Cog):
def __init__(self, client):
self.client = client
async def on_message(self, ctx):
await self.client.process_commands(ctx)
mongo_url = "mongodb+srv://mongo url"
cluster = MongoClient(mongo_url)
db = cluster["discord"]
collection = db["levelling"]
author_id = ctx.author.id
author = ctx.author
user_id = {"_id": author_id}
if ctx.author == self.client.user:
return
if ctx.author.bot:
return
if not ctx.channel.id in talk_channels:
return
if(collection.count_documents({}) == 0):
user_info = {"_id": author_id, "level": 1, "xp": 0}
collection.insert_one(user_info)
if(collection.count_documents(user_id) == 0):
user_info = {"_id": author_id, "level": 1, "xp": 0}
collection.insert_one(user_info)
exp = collection.find(user_id)
for xp in exp:
cur_xp = xp["xp"]
new_xp = cur_xp + 1
collection.update_one({"_id": author_id}, {"$set": {"xp": new_xp}}, upsert = True)
lvl = collection.find(user_id)
for levl in lvl:
lvl_start = levl["level"]
new_level = lvl_start + 1
if cur_xp >= round(5 * (lvl_start ** 4 / 5)):
collection.update_one({"_id": author_id}, {"$set": {"level": new_level}}, upsert = True)
level_updates_channel = self.client.get_channel(884386906064965662)
await level_updates_channel.send(f"{author.mention} just levelled up to **level {new_level}**")
How is that a thing🚶
here it is
if ctx.author == self.client.user:
return
if ctx.author.bot:
return
if not ctx.channel.id in talk_channels:
return``` any of these conditions are true mb
Oh its indian english my bad🕴️
nope none of them are true
alr thx
its a british word
and it used to word when you had process_commands?
when i had commands.Cog.listher() it worked
oh lol you removed the listener decorator xd
i asked you to just removed the self.bot.process_command
add it back , remove process_commands only
ok
Link you gaved me said its a old english word/ indian english
oh i didnt even read that lol
great
Lol
is there like a website or doc that has a list of color?
how can i make a command disabled for a user for a specific user??
the command which i want to disable have cooldown, so if the user uses that disabled command then he would get the cooldown after the command gets enabled
how to fix this issue ?
You can use a colors hex
You get the color and do
color = 0x-----
or essentially for example: color = 0x#ffffff which would generate a custom embed color
discord.Colour.<>() is only just a preset
you dont need the #
could anyone help me with this ?
yeah you don't
whats the command to make multiple aliases for a command?
discord.Color.color()
The color name has the color hex inside but really cant get a specific color
you can always do @bot.command(aliases=['put','your','aliases']) if you want aliases for a command but how tf would you make multiple aliases
oh ok thx, that was what i was wondering
Wdym multiple
You making multiple aliases there?
Im not going to say a word
it works though 💀
Ik that
i think i should ditch f strings and use .format()

2.0 moment
Cause i just know
🤔
Format still is usable but f strings are better syntax wise
ill prob ditch f strings once i realize how to use sql in discord.py
seems like i can't really do it caue there's a int+str
wait its 0x<hexcode> like 0x24252A
Yes you can
no idea
ppl say f strings are bad practice in py sql
i bet this is another spoonfeed trick
And no need for int+str its called a complex
A complex= a mix of integers and strings
Dont really know
nvm im just gonna go for .color stuff
Using hex is better in my opinion
!d discord.Color <=
Not really hard
!d discord.Colour <=
class discord.Colour(value)```
Represents a Discord role colour. This class is similar to a (red, green, blue) [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)").
There is an alias for this called Color...
i only use classes to make discord buttons smh
you dont use cogs?
Only class you need to do is a sub class of view
f strings are fine and they are better than .format
For SQL statements
yea class niosfndsirhfi(discord.ui.View): should do
That's an exception
Got my new pc and now my os cant find any files for some reason
f string SQL statements are dangerous as they can be used for SQL injection
But there are ways to avoid that too
Imagine using SQL
Postgres uses SQL btw
Used os and aiofiles and cogs but seems like it never finds the file even with its path or name
and SQL is good
Imagine not using a nosql database
wanna see some "good" classes of discord buttons:
import discord as shoe
from discord.ext import commands
class fdjsidsjfo(shoe.ui.View):
@discord.ui.button(style=shoe.ButtonStyle.yellow, label='💀')
async def bru(self, button: discord.Button, interaction: discord.Interaction):
await interaction.response.send_message("")
wut
yello doesnt exist though
🥚sactly
what are you on about
its a joke :skull:
Why are you adding the label kwarg at the end it seems so weird to me
there are only 4-5 button styles in discord's api
why not
still works though
Grey green blurple red something else
MongoDB is fine but it's way too overrated
Think its just them
disabled
imo
SQL is overrated imo
🥲
Why?
mongodb is json basically
yes
its just better
It's a document based storage system and it's based as key values
Its not
Try storing relational data in mongoDB
true
or maybe some complicated data
because everytime you ask what db is good for a beginner in #databases, they recommend you use sqlite and other sql dbs
eh mongodb is good too
if ";" in query: return best way
😐
Lmao
Me learning about dbs like:
🚶
SQL is like the easiest language that ever exists
Only NoSQL db that I like is redis
you learn about databases?
jsonc*
No but just learning the terms and other stuff like tables 🕴️
Nah some legends also used discord text channel for their db
jconc > regular json
tables rows columns, cells, datatypes
Thanks for the sarcasm

Yeah that stuff
Protobuf is better than json
Anyways
I used that once, a while ago lol
This is getting off topic
yeah true
Ik this is ot but how can i learn about sqlite3 🕴️
tutorials on google
Yeah let me check those 9 year old stackoverflow questions/tutorials 🕴️
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
sql syntax still the same 9 years ago... (I think)
Thank you 🕴️
Doubt but okie🕴️
Fax
.bm
It is, now (:
what did you use
oh shit
@bot.command(name="ping")
async def pingme(ctx):
# ws ping
embed = discord.Embed(title=":green_heart: WS Ping", value=f"```py\n{round(bot.latency * 1000)} ms```",color=discord.Colour.red())
await ctx.send(embed=embed)
was sypposed to send
do you still use it
sended:
You need to add the description kwarg🕴️
Me?
yes
websocket ping and discord.Embed has no value kwarg
its description if you're adding it there, if u add a field then its name and value
this is somewhat interesting to me
wdym
embed = discord.Embed(title="title kwarg",description="description kwarg",color=discord.Colour.red())
await ctx.send(embed=embed)
!d discord.Embed @slate swan
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
it has no value kwarg, instead use the description kwarg to put something in the embeds description
async def mute(ctx, member : discord.Member, *, reason=None):
if (not ctx.author.guild_permissions.manage_messages):
await ctx.send('u need permission dumbass')
return
guild = ctx.guild
muteRole = discord.utils.get(guild.roles, name="muted")
if not muteRole:
await ctx.send('no mute role was found, creating muterole')
muteRole = await guild.create_role(name="muted")
for channel in guild.channels:
await channel.set_permissions(muteRole, speak=False, send_messages=False, read_message_history=True, read_messages=True)
await member.add_roles(muteRole, reason=reason)
await ctx.send('user is muted')
await member.send(f"you've been muted from **{guild.name}** | reason: **{reason}**")
@client.command()
async def unmute(ctx, member : discord.Member, *, reason=None):
if (not ctx.author.guild_permissions.manage_messages):
await ctx.send('u need permission dumbass')
return
guild = ctx.guild
muteRole = discord.utils.get(guild.roles, name="muted")
if not muteRole:
await ctx.send("the muted role was not found")
return
await member.remove_roles(muteRole, reason=reason)
await ctx.send('user is unmuted')
await member.send(f"you've been muted from **{guild.name}** | reason: **{reason}**")```
why dont these work
- Because it's copied obviously
- Doesn't work isn't in my vocabulary, give me the error
no error
use @commands.has_permission(manage_messages=True)
show error handler
y copied?
u saw somewherre ths code?
Because it's obvious, I've seen that code at least 10 times here
jsk py ```py
abc = [{'footer': {'text': 'Updated'}, 'thumbnail': {'url': 'https://cdn.discordapp.com/avatars/711043296025378856/243d61cb7bff98fd1844b465a88f46cf.png?size=1024'}, 'author': {'name': 'ggashish#6132', 'icon_url': 'https://cdn.discordapp.com/avatars/711043296025378856/243d61cb7bff98fd1844b465a88f46cf.png?size=1024'}, 'fields': [{'inline': False, 'name': ':unmute: Self un-mute', 'value': '@outer basalt un-muted themself'}], 'color': 3066993, 'timestamp': '2021-12-11T07:02:14.556425+00:00', 'type': 'rich', 'url': 'https://discord.com/users/711043296025378856', 'title': 'Member voice state updated'},
{'footer': {'text': 'Updated'}, 'thumbnail': {'url': 'https://cdn.discordapp.com/avatars/711043296025378856/243d61cb7bff98fd1844b465a88f46cf.png?size=1024'}, 'author': {'name': 'ggashish#6132', 'icon_url': 'https://cdn.discordapp.com/avatars/711043296025378856/243d61cb7bff98fd1844b465a88f46cf.png?size=1024'}, 'fields': [{'inline': False, 'name': ':mute: Self mute', 'value': '@outer basalt muted themself'}], 'color': 3066993, 'timestamp': '2021-12-11T07:02:15.078014+00:00', 'type': 'rich', 'url': 'https://discord.com/users/711043296025378856', 'title': 'Member voice state updated'}]
embeds = [discord.Embed.from_dict(i) for i in abc]
await ctx.send(embeds=embeds)
this is not sending the first embed
whats the error besides it not sending the embeds
seems you're using an eval to do that. How about doing it without eval?
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.
i dont have another help command?
how do i fix this
code please
async def help(ctx):
embed = discord.Embed(title="help", description="`$utility`,`$moderation`", colour=000000)
await ctx.send(embed=embed)```
put help_command = None in your bot's constructor
uh
remove the default help cmd
wheres that
your commands.Bot var
what
yes
wtf
where is this
what
put help_command=None in ur commands.Bot variable
what do u not understand in this?
u tell me
idfk
uk python?
no
then how da heck u plan to make a bot
trying to learn
learn it for fucking sake then make a discord bot
calm tf down
stop being rude
can u atleast tell me where to put it pls
No.
<@&831776746206265384>
fr
okay
this guy is too mad
ur making a discord bot without knowing python
kkk m sry
tht is rude?
if it is i shud have called mods long time ago
when it happened to me
lmao
man this person is making a bot without learning python and copying code, anyways m sry
While a discord bot is not the most advised first project to learn python, it is a valid one
And we try not to discourage people from doing that, as a lot of people get into python from making one
he has to learn some things like asynchronous programming, coroutine etc
Nobody is required to help, so if you're having trouble there's no problem with you backing off
I mean, yes, but also no. A lot of things are red plug red outlet, and that's enough to get by with the basics
Yes, just like you have for your = discord.Embed(... code
pass help_command=None to the commands.Bot() call
discord.py includes one by default
It's an unfortunately common stumbling block because you have to remove it a specific way
client = commands.Bot(help_command=None, command_prefix = '$')
yep
Yeah, well, one step at a time :P
Old man voice: "when I was your age discord.py didn't have async"
guys what happened here
a recommendation, if you're making a custom help command there won't be any form of handling so make sure to add a @help.error error handler if you know about those
if you don't you could always read documentation, i'm on the not-spoonfeeder side
Dont
use the default one, its already good
This help command subclasses/edits the default help command. Overall it looks pretty nice.
Did u just... color out the dpy server invite?
it's rdannys invite
There's a different server?
yes, rdanny, dpy, danny
O
Traceback (most recent call last):
File "C:\Users\the rore\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\the rore\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
await self.prepare(ctx)
File "C:\Users\the rore\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "C:\Users\the rore\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\the rore\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 542, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.```
error the comes up
async def userinfo(ctx, member = member or ctx.author, member: discord.Member):
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.add_field(inline = False, name="ID:", value=member.id)
embed.add_field(inline = False, name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("`%a, %#d %B %Y, %I:%M %p UTC`"))
embed.add_field(inline = False, name="joined at:", value=member.joined_at.strftime("`%a, %#d %B %Y, %I:%M %p UTC`"))
await ctx.send(embed=embed)```
with this command
mention a member
oh
im smart
wait how can i make it so it automatically uses me
instead of having to mention myself
ctx.author
use an or statement, set the member param to None```py
member = member or ctx.author
or member: discord.Member
they did that already..?
I never really read it kk
lol
where lol?
what is a param
def b(member): #member is a param
onh
async def userinfo(ctx, member = member or ctx.author, member: discord.Member):
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.add_field(inline = False, name="ID:", value=member.id)
embed.add_field(inline = False, name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("`%a, %#d %B %Y, %I:%M %p UTC`"))
embed.add_field(inline = False, name="joined at:", value=member.joined_at.strftime("`%a, %#d %B %Y, %I:%M %p UTC`"))
await ctx.send(embed=embed)```
like this?
no
uh
in the function, not where u define the function
what
can u pls correct it for me?
i dont understand how
def b(member): #where u define the funtion
member = member or ctx.author
...
``` ^
yes
discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.
this comes up?
show code
or do what winrar said
Well this is needed, otherwise it will always be a required argument.
async def userinfo(ctx, member: discord.Member):
member = member or ctx.author
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.add_field(inline = False, name="ID:", value=member.id)
embed.add_field(inline = False, name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("`%a, %#d %B %Y, %I:%M %p`"))
embed.add_field(inline = False, name="joined at:", value=member.joined_at.strftime("`%a, %#d %B %Y, %I:%M %p`"))
await ctx.send(embed=embed)```
Adding a default value to None makes it optional
^
Add this ^
where
^
async def userinfo(ctx, member: discord.Member, member : discord.Member = None):
member = member or ctx.author
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.add_field(inline = False, name="ID:", value=member.id)
embed.add_field(inline = False, name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("`%a, %#d %B %Y, %I:%M %p`"))
embed.add_field(inline = False, name="joined at:", value=member.joined_at.strftime("`%a, %#d %B %Y, %I:%M %p`"))
await ctx.send(embed=embed)```
like that?
No.
what
Replace your previous member : discord.Member with this....
Don't add a new parameter.
async def userinfo(ctx, member : discord.Member = None):
member = member or ctx.author
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.add_field(inline = False, name="ID:", value=member.id)
embed.add_field(inline = False, name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("`%a, %#d %B %Y, %I:%M %p`"))
embed.add_field(inline = False, name="joined at:", value=member.joined_at.strftime("`%a, %#d %B %Y, %I:%M %p`"))
await ctx.send(embed=embed)```
like this?
Yes.
no idea lol
Yes
cool
heroku wipes their dynos and more because they're intended for stateless web applications
railway has an example on hosting a discord bot in their docs so
oh cool
See this actually
Paid
I deploy on my rasberri pi and other old computers I have laying around as servers
There's a free tier
??
Specs?
And how many hours a month can we use it for?
512mb ram, 1gb disk
infinite, it appears
although I don't think they're very powerful hours
WoW that's amazing
more than I need
Significantly more than I need as well
I don't think you need more than 400 mbs for a discord bot unless it's a currency bot
try:
client.run(TOKEN)
except:
Default_TOKEN = info["Default TOKEN"]
client.run(Default_TOKEN)``` Lol this still gives me an error
whats the error
event loop is closed
Mines 300 mb and it's got a lot of libraries too
show full error
nicee
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/http.py", line 380, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/http.py", line 335, in request
raise HTTPException(response, data)
nextcord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "main.py", line 106, in <module>
client.run(TOKEN)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 666, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 645, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 608, in start
await self.login(token)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 476, in login
data = await self.http.static_login(token.strip())
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/http.py", line 384, in static_login
raise LoginFailure('Improper token has been passed.') from exc
nextcord.errors.LoginFailure: Improper token has been passed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 109, in <module>
client.run(Default_TOKEN)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 638, in run
loop.add_signal_handler(signal.SIGINT, lambda: loop.stop())
File "/usr/lib/python3.8/asyncio/unix_events.py", line 89, in add_signal_handler
self._check_closed()
File "/usr/lib/python3.8/asyncio/base_events.py", line 508, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed```
We can install external libs right?
yep
Improper token
This is good?
try:
client.run(TOKEN)
except:
Default_TOKEN = info["Default TOKEN"]
client.run(Default_TOKEN)
print("Using Default Token")```
U have heard about it
f
Using requirements.txt?
Yeah
yes
That's how you install dependencies lol
The TOKEN is invalid
requirements.txt
On other platforms it may differ
Wow what should it do?
No it doesn't
Go to dev portal and fill your token properly
Your token, both of them are improper
The default one too
@west escarp so how do i use railway lol
and you only get a single token for a bot
wrong token
You don't get multiple tokens for a single bot account
Yeah
So that try except won't work as you intented
maybe he has another bot account, who knows lol
the deafult token var is the token
If you want to run multiple, use bot.start and a different starting method
.run is intended for only one bot
Use ```py
try:
client.run(TOKEN)
except:
Default_TOKEN = info["Default TOKEN"]
client.run(Default_TOKEN)
print("Using Default Token")
else:
print("Invalid Token!")
@west escarp how to use railway?
This
You would need to create your asyncio main event loop and then start your bot
Example link please
.run() is a blocking IO
yeah pls
i dont understand any of that
what I mean it doesent even do the except or else
Its containerized then
something is blocking it
It's so easy lol
Is .gitignore important?
wait so do i need a github acc over a month old
and then run your worker
yes
Anyone?
^ ?
yes
Does railway let you run your own docker containers?
I dont know
Oof how to make one?
Iirc, its like repl
How to make one?
hmm
.gitignore
@west escarp is this necessary?
look up a good default one
That's the file
And just leave it empty?
where you need to add your files/ directories
absolutely. That tells railway what to start up when it's deployingyour code
No
hm what does web mean?
So write what in it?
"front process" it's a bit of a borrowed term here
How to?
after the "webserver" that would normally run
thanks
help pls?
Cuz invalid token
/some_fir
Some_file.py
some_image.jpg
These files in the .gitignore file will be ignored
And what does that do?
it ignores those files, aka any changes / anything in em
What is the meaning of "ignored"
it doesent do the except?
Why would anyone want to do that?
@twin moon
important files, dist files, useless files (pycache) etc
means git does not consider it
Let's say you have files that you do not want upload your public repository
^
if you a .gitignore file, git will ignore those files when you push
no idea, i havent seen your code lol, and make sure you have the right token foe your bot
Useless files too
Ok but I don't wanna ignore anything
What then?
That's what I am asking from last 5 mins
So it has ephemeral filesystem?
it isnt important
Hey @twin moon!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Yeah I got confused by what they were asking
That's what you were supposed to tell me earlier
it's useful but not very important
i never saw your question, my bad
o
Poof
Idk tbh. I never used it
Dunno
probably varies
You have to try it and see
Still how much?
I mean
Like around 25?
hm
Yeah as mistle said
Heroku gives 25?
No
my friend uses railway, decent uptime ans ping ig
So let's host it and then I'll see myself
But it spikes up to 600 or more
129 ms cool
Not bad
Mine:
Websocket: 94ms
HTTP: 263ms
http being the total time between posting a message and getting it returned
So I am still not going to choose railway over heroku
sure
I mean, choose what you like, but heroku is not designed for constantly running applications
their free tier will turn off your bot at times because it has limited hours
That's a big point
if you're ok with that then there's no reason to bother
2 accounts solve the issue
Okay what
Well, that's against their TOS and not something we'll help with or advise
But yeah still an issue
Didn't ask for help?
Cuz heroku is cool af
They might be using GCP, and discord also uses GCP, so they could have some datacenters next to each other to make it nice
My stuff has comcast in between

As I said
My heroku dynos are free tier
Oh now I get it
Okay railway is similar to docker containers
That's cool
how can i do something like this
with an embed
async def userinfo(ctx, member : discord.Member = None):
member = member or ctx.author
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.add_field(inline = False, name="ID:", value=member.id)
embed.add_field(inline = False, name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("`%a, %#d %B %Y, %I:%M %p`"))
embed.add_field(inline = False, name="joined at:", value=member.joined_at.strftime("`%a, %#d %B %Y, %I:%M %p`"))
await ctx.send(embed=embed)
in here
what
!d discord.Status
class discord.Status```
Specifies a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") ‘s status.
where do i add that
create an embed field, with status as its title and then check if the status of the member is dnd or not
Its simple
manually change it
juan do you enough python? for me it seems like you lack python knowledge to use dpy and python
:I
like
check=?
C:\Users\ADMIN\PycharmProjects\Fluxo>python main.py
Traceback (most recent call last):
File "C:\Users\ADMIN\PycharmProjects\Fluxo\main.py", line 10, in <module>
x = round(bot.latency * 1000)
ValueError: cannot convert float NaN to integer
i feel the same way about you, no need to be rude
no, check something using an if statement
@boreal ravine pls help
That was the nicest way I could think of..
what do I check?
bot.latency isnt a number ig
¯\_(ツ)_/¯
hey guys
@bot.command()
async def invite(ctx):
embed = discord.Embed(title=f"Invite {client.user.name}", color=0xff0000, description=f"Wanna invite {client.user.name}, then [click here](https://discord.com/api/oauth2/authorize?client_id={client.user.id}&permissions=8&scope=bot)")
await buttons.send(
content = None,
embed = embed,
channel = ctx.channel.id,
components = [
ActionRow([
Button(
style = ButtonType().Link,
label = "Invite",
url = f"https://discord.com/api/oauth2/authorize?client_id={client.user.id}&permissions=8&scope=bot"
)
])
]
)``` I want to button with a link and I have problems why
what y'all up-to with discord.py
well, what's the problem- oh wow
u cant send an empty message nvm
@boreal ravine
C:\Users\ADMIN\PycharmProjects\Fluxo>python main.py
Traceback (most recent call last):
File "C:\Users\ADMIN\PycharmProjects\Fluxo\main.py", line 10, in <module>
ping = round(int(bot.latency * 1000))
ValueError: cannot convert float NaN to integer
ping = round(int(bot.latency * 1000))
whats the error?
just do ping = ctx.bot.latency smh
i hv problems no error
isn't that literally the same thing?
Me who does huneval return bot.latency 😐
try printing the type of bot.latency (I havent gotten this error before)
@boreal ravine look
define it lol
web socket latency
now
now?
Yes now.
Now.
!nan
You're converting a float into int
isnt that what he wants to do?
It can convert to int
!e print(int(2282.22))
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
2282
isn't float just decimal'd int
Your bot hasn't started yet
Why do you round()
yes
!e print(float(2822.22))
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
2822.22
Or it's disconnected
Just do round(bot.latency*1000)
!e print(type(1.0)) # @shadow wraith
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
<class 'float'>
You can also use if bot.latency to detect this and output something helpful when it happens
if i put it after bot.run it won't run the code after it, ..
!e ```py
if float("nan"):
print(1)
@west escarp :white_check_mark: Your eval job has completed with return code 0.
1
?
eew it's in math

!e ```py
from math import isnan
if isnan(float("nan")):
print(1)
@west escarp :white_check_mark: Your eval job has completed with return code 0.
1
are you putting your code below the bot.run()
Well, yes. What are you trying to do?
all your bot's code should be above it
Are you doing this in on_ready?
on top
use it for a ping command
oh so like this right?
# code
bot.run("token")
code here runs before bot starts
bot.run()
code here runs after bot exits
It's been ages since a Mod is here, without the ping to mute/kick anyone toxic ngl
do the math in the command then?
Presumably you're doing ctx.send() somewhere right? put it with that
import math?
!e
print(int(12.29))
@tough lance :white_check_mark: Your eval job has completed with return code 0.
12
yes..
wait a second, you're trying to get the bot's ping and "multiply" the bot's ping by a 1000?
high level calculations
what to do? SyntaxError: Non-UTF-8 code starting with '\xd0' in file C:\Users\User\Desktop\2 bot discord server console\bot.py on line 193, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
ofc ignore the other message, czzz, uhhh, it's dpy server
That's not that bad tbh
yeah
oh yeah and what ptero host you using?
Open bot.py and show kind 193
0 ping for me
💀
Lucky
A friend got a paid hosting, he's hosting the bot for me
nah your ping amount just floated
If you want to use cyrllic characters for python variables, you need to indicate the file is UTF8 encoded
lucky
wait....
Yea
U mean at the top when people write something like utf-8 encoding

Ah
thank you
That way I can also use emojis as variables? 🥺
Maybe, I don't recall the details
O
I do however recall you can use a custom coding to really do cursed stuff
Gonna try that out
r!tag buttons
class 😭:
pass
cry = 😭()
i use it ◆
nvm mine shows 81 now
That's discord code syntax
Welp ;-;
asdf?
Jkl
here
lmao ik but i cant put it there lol
you high?
embed.add_field(inline = False, name="guild name:", value=member.display_name)```
lmao how am i supposed to do that
Sadly, no
value = f"`{member.id}`"
guild name will be- member.guild.name
sadly?
Mhm
may i ask how is this related to the channel ?
It isn't, but I thought coding utf-8 would work and Bast was talking about that, soooo
excuses
¯_(ツ)_/¯
(。_。)
Aight I'ma head out
well considering my friend hosts their bot on replit and gets around 50 ping , thats bad 
Anyone got any discord bot ideas
And a high chance of getting ratelimited too
Mass DM bot
Jk
I was just kidding
Also mine is a Chatbot and all it has to do is.... send messages. So it's gonna get ratelimited as soon as I start it up
Can I get some more context please?
@maiden fable make among us discord bot
What about akinator? It ai right?
There is
Make a word search generator
There is
wao
would it be considered a chance anymore 
Minesweeper
a bot that creates other bots
There is
Hahaha
Uno
a k h h e l l o n c
j f m q a f n c s m
d a a b y e f s z k
find: hello, bye
Already is
@maiden fable create an fps bot
Ah
make a bot that works like grammar 
🇦🇧🇨🇩🇪🇫🇬🇭🇮🇯🇰🇱🇲🇳🇴🇵🇶🇷🇸🇹🇺🇻🇼🇽🇾🇿
How am I gonna get the refresh rate of the screen
!raw 919167241478619156
your headache
== Raw message ==
🇦🇧🇨🇩🇪🇫🇬🇭🇮🇯🇰🇱🇲🇳🇴🇵🇶🇷🇸🇹🇺🇻🇼🇽🇾🇿
Lmao
Don't tell me u r serious dude
Yea dude
on todays instance of discord being a pain in the butt
Haha discord is always weird
and we still use it 
this is a code block, don't render emojis in it
It can be used for both the genders (;
ffs
🤣
thanks for the info tho
why does it render as an emoji tho
discord
What u tryna do tho, Bast?
Mhm
to make a word search
O
indexing the column and the row, the user will experience difficulties
:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1639217723:f> (9 minutes and 59 seconds) (reason: discord_emojis rule: sent 21 emojis in 10s).
Yea that's what I was gonna say

No way to index the rows and columns of each alphabet
!unmute 730644317894344734
:incoming_envelope: :ok_hand: pardoned infraction mute for @slate swan.
sorry to randomly bump in the conversation but here's a good bot event to use, hunter recommended me it and i am totally using it:
@bot.event
async def on_message(message):
await message.delete()
,-,
Lmao
sorry i was trying to make the thing work lmao
lol
I recommended many more tho
send a screenshot
Woah
how can i add 2 buttons to one message?
true but the one i used sparked me
(Not to mention I was sleep drunk last night)
message above is 💀
!d discord.ui.View.add_item
add_item(item)```
Adds an item to the view.
i have 2 buttons without using discord.ui.View.add_item
view = View()
view.add_item(button)
Make solitaire
Imagine using decorators
you can subclass view
pfff, could be me
Ik (:
Same
not subclassing view - > 
I prefer decos rather than writing code
@maiden fable Make a || || bot
I prefer result
woh
lmao
_ _
More of invisible bot
invisible message bot lmao
when the
_ _
Anything else?
_ _
_ _
_ _
😐
_ _
_ _
huh how could a bot get that badge i thought it was only for users
very helpful. should be pinned imo
Which bot
is probably a bot made by discord itself
Iirc that's the bot used in Bug reporting server
bug hunter badge
wrong reply ,-,
💀 bug hunts exist
Hunter 
it is what it is
well that's good
yeah


