#discord-bots
1 messages · Page 872 of 1
It isn't open sourced, sorry (also I don't have a GitHub repo)
what lib are you using
So that people can talk to the bot in VCs too
Hunai is disnake right?
Disnake
Yups
@maiden fable can you make hunai forgive me
ooh
It hates me
pycord already has voice support
Fuck pycord
Does the bot have other features except chatbot?
Time to purge it's memory
nextcord*
Nope, sorry
both i guess
@maiden fable this name.. my inner php brain is comming back
php 😭
!ot for that (:
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
The last time I checked, pycord doesn't have it
@maiden fable you just lost a friend
||tss someone is going for helper||
nah they do
Whom?
Panda…?
Ah, then most probably I am mistaken
Nah
That broke pandas heart
unless they deleted it cause of some bugs lol
which i high probability
Yessir
!ot :)
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Petition to remove !ot as command
Told you
!ot
Please stop it
lol im kidding
Once is enough lol
ok
Ok
Mina~, (the most active admin) prob dm'ed him to keep her in the loop.
damn
No, the python bot intimidate
intimidating
I haven't sent even a single DM to her, also #ot2-never-nester’s-nightmare
You guys know that mina has been contributing to the python bot..?? So proud 🥲
Yea
Oww, like it when you get all serious 😘
🤦
Does anyone have a video tutorial on how to make a music bot?
Against ToS
It is?
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
Yeah but a music bot doesn't have to be youtube and he never said he's using yt
What else would he be using..?
How can I get the channel where the command has been ran into?
I mean I want to code a music bot and I require some assistance
Anybody?
I think I got it
ctx.message.channel + pass_context=True
No they don't, this discussion has been made before a couple of times even as low as local files etc. We don't know your intentions so we just don't help with music bots at all.
pass_context is so 2016
😂
Lol yeah not kidding the command you copied is 4 years or older.
Google it
Thx man
Lmao
Hi
Hi
how i can change a user to member ?
i want to change the nick after fetching the user
no problem 👍
and it is showing user object hsa no attribute edit
you can't
then how i can fetch a user as a member ?
or is there any way by that i can get a user from string ?
guild.fetch_user
no?
guild.get_member_named
no?
No
okay
thats not a thing
:/
!d discord.Guild.fetch_user doesn't exist
No documentation found for the requested symbol.
fetch_member?
!d discord.User.mutual_guilds is what u need
property mutual_guilds: List[Guild]```
The guilds that the user shares with the client.
Note
This will only return mutual guilds within the client’s internal cache.
New in version 1.7.
what is it ?
read the embed
i have a string "clear @steep estuary" how i can get user by that ?
don't you use commands
split the <@/> and use bot.get_user/bot.fetch_user
just convert @steep estuary to an argument on the invoke
i use that but this is inside a command
i tried that and then i am trying to edit the user
and their it is giving a error
yes
this was a really bad formation of a sentence
use get_member then? why are you getting/fetching a user
i tried theuser = ctx.guild.get_member(id) but it is giving None
or typehint the first argument to Member....
make sure the argument you pass in get_member is a proper ID, try fetching the member
!d discord.Guild.fetch_member
await fetch_member(member_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") from a guild ID, and a member ID.
Note
This method is an API call. If you have [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_member()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.get_member "discord.Guild.get_member") instead.
i should use fetch_member instead of get_member ?
@steep estuary Are you using disnake?
yes
ohk
Ah then i recommend this ```py
async def getch_member(self, guild: discord.Guild, member_id: int) -> discord.Member:
return guild.get_member(member_id) or await guild.fetch_member(member_id)
Would look something like this ```py
member = await self.getch_member(ctx.guild, 758941956600102943)
i am trying that
update
That Worked Finally
How to do that?
Tysm @boreal ravine@cold sonnet@cloud dawn
pip install git+https://github.com/Rapptz/discord.py
np, the function i sended i always used with discord.py since i then won't have to think about if i should use fetch or get.
Disnake has a similar functionality but theirs is build into the lib.
dumb me
Ghost ping?
what's reactionmenu?
why are you even using an external library for buttons when discord.py already has them
A module
and... why?
dpy has buttons though
Buttons
you're using dislash, dpy and reactionmenu
Yes
It's a github source
everything's on github
Wait come dm I am sharing github link
Or replit link
no, not repl 
ah yes give your repl link and someone will eventually delete all of your bots code
he gave it to me
and I wouldn't
matter of fact, I won't even look at it
either reactionmenu doesn't have buttons or he doesn't have the right version
and idk which one, I don't use reactionmenu (why could that be)
For making a value dependent on who's mentioned in a slash command, do I use
if user = @hollow portal:
gay_level = 100
```?
try converting the mention to a discord.Member by typehinting and checking if that member's id is 715943793500749925
I want it so if my friend runs the command, it says
{member.name} is {gay_level}% gay.
But if my friend runs it, gay_level is 100%

How do I do that?
show me your function definition
I haven't finished it yet but it's this
import disnake
from disnake.ext import commands
import random
class Gay(commands.Bot):
"""How gay are you?"""
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.slash_command
async def gay_rater(self, inter, user: disnake.Member):
"""How gay are you?
Parameters
----------
user: User rated for gayness.
"""
gay_level = random.randint(0,100)
if user = @hollow portal:
gay_level = 100
😂
probrain
I was more commenting about user != member
you can just check
if user.id == 715943793500749925
since you use double equation sign for comparisons 
yeah it's user in your code
it's kinda like client and bot
Also it's @commands.slash_command() not @commands.slash_command
i have a function to write everything that gets printed in my console to a text file, it works perfectly fine, however, whenever i reboot my bot, all the data in the txt file gets overwritten, heres my function
def log(text: str):
"""Log the given text to a file.
Parameters
----------
text : `str`
The text to log.
"""
with open(f"logs.txt", "a", encoding="utf-8") as log_file:
log_file.write(f"[{date()}] {text}\n")
# output the text to the console
logger.info(text)``` i was under the impression that `a` meant append, so it wouldnt overwrite anything?
basically all im doing is making a historic log
x = 100%
Is not valid Python syntax, remove % and put it when you use the variable in a string like the following:
x = 100
y = f"{x}%"
"keep the comments that are about not to the issue related errors to yourself"
you see now he's gone
He isnt properly defining the command, how is that not related
I mean his command won't run without it, your comments we're optional.
now I have to quote
Thought of using logging module?
Im using my own for colors
This is now how you make a file handler for your logger.
his command wouldn't have run either
:3
the default logger module makes no sense to me, so i decided to make my own so i can have custom things, such as colors and a better date format
thats pretty cool
Yeah usefull for debugging so i know what function and line executed the code.
Anyway, how can i prevent my function from overwriting everything in my txt file after reboots
# File handler
file = logging.FileHandler("bot.log")
fileformat = logging.Formatter(log_format, datefmt=log_date_format)
file.setLevel(log_level)
file.setFormatter(fileformat)
``` i've done this.
logger module opens the file for you.
open it in write only mode
/get file.readlines() and rewrite it and then the next stuff
then adding the handler to the main logger logger.addHandler(file)
Thats not how my logger works
Im not asking any questions about my logger, im just asking about the function
Here you can copy mine and play around with it. ```py
import logging
import coloredlogs
log_level = logging.DEBUG
Log format
log_format = '%(asctime)s [%(levelname)s] - [%(filename)s > %(funcName)s() > %(lineno)s]: %(message)s'
log_date_format = '%m/%d/%Y|%I:%M:%S %p'
Info color/format logger
fieldstyle = {
'asctime': {'color': 'green'},
'levelname': {
'bold': True,
'color': 'black'
},
'filename': {'color': 'cyan'},
'funcName': {'color': 'blue'}
}
Message color/format logger
levelstyles = {
'critical': {
'bold': True,
'color': 'red'
},
'debug': {'color': 'green'},
'error': {'color': 'red'},
'info': {'color': 'magenta'},
'warning': {'color': 'yellow'}
}
Creating logger
logger = logging.getLogger(name)
logger.setLevel(log_level)
File handler
file = logging.FileHandler("bot.log")
fileformat = logging.Formatter(log_format, datefmt=log_date_format)
file.setLevel(log_level)
file.setFormatter(fileformat)
Adding handlers to logger
logger.addHandler(file)
coloredlogs.install(
level=log_level,
logger=logger,
fmt=log_format,
datefmt=log_date_format,
field_styles=fieldstyle,
level_styles=levelstyles
)
Some demo codes
logger.debug("debug")
logger.info("info")
logger.warning("warn")
logger.critical("critical")
logging.exception(raise ValueError)
logger.error("error")

Most code is for the custom coloring lol
this is my custom coloring
def formatColor(text, color: str = "reset"):
grey = "\033[;90m"
gray = "\033[;90m"
yellow = "\033[;33m"
red = "\033[1;31m"
bold_red = "\033[;31m"
green = "\033[;32m"
reset = "\033[0;m"
if color == "reset":
return reset + str(text) + reset
elif color == "grey":
return grey + str(text) + reset
elif color == "gray":
return gray + str(text) + reset
elif color == "yellow":
return yellow + str(text) + reset
elif color == "red":
return red + str(text) + reset
elif color == "bold_red":
return bold_red + str(text) + reset
elif color == "green":
return green + str(text) + reset
else:
return "Invalid Color: Please use either:\n• grey/gray\n• yellow\n• red\n• bold_red\n• green\n• reset (resets color back to white)"
Ah you are coding the colors yourself. Well i was to lazy for that.
{embed}$v{description: desc}$v{color: #000000}
``` is it possible to use this for embed from dict?
i color colors yes
use a dict...
uSe a dIcT
sure
{"Use a dict": "yes"}
log(
f"{formatColor(ctx.guild.name, 'green')} ({formatColor(str(ctx.guild.id), 'gray')}) added to the database [{formatColor('servers', 'gray')}]"
)``` logger moment
i saw a python bot use this embed code py {embed}$v{description: desc}$v{color: #000000}
and was able to send this as en embed
thats javascript
or not python, ion know
Why not check if a word is int then color it differently and if # in word aswell.
Could save a lot of time later on xD
i know it's not python but how can i convert it into python lol
idk this was easier
but a dict ain't? 
all i need to do is import 1 thing from a file then just log()
But you are not using the logging module and not using a color module. Now i understand the weird file append stuff
my logger isnt interfering with the function tho
"a" is appending yes but "a+" is the mode you are looking for
oh, alright sweet, thank you
I knew the answer i just wanted to know why you are torturing yourself.
eh, it makes sense to me
Lemme know if it works

latency moment
also, ping has been super low lately, pretty nice
88 is pretty pog
it still overwrites
mine is 101ms
It worked, thanks :)
Anyone fix my error I am stuck
What's the error?
Come dm ill share a replit link
i suppose ill just create a new file with the date the file was made as the name
!paste Just copy the code to this
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.
hmm then i recommend just opening it in r+ mode and copying the contents then paste it back overwriting the whole file. Altough, can i ask why you want a logger?
Check dm
Paste it to the link, I can't open replit
I don't have an account and my internet sucks ass
few reasons, makes my console cleaner and easier on my eyes, allows me to make a historic log of my bot to make sure i dont overlook errors, and why not? I dont have anything to do
Why not use a discord channel in a private server?
ratelimits
Uff
Compress it, send only errors and limit it.
Processing log data is easier when in a text file
ive already had my account disabled before, its just easier to log to a file so i can still look at it without the need of a discord account
Whom?
yes
what is reactionmenu?
It's a github open source
subway cookies are awesome
subway cookies are expensive
How do I use emojis in the footer?
https://github.com/Defxult/reactionmenu/blob/main/reactionmenu/__init__.py#L31
Did you want ReactionButton?
Impossible.
Seriously? I can't put a gay flag in the footer for the gaydar?
its like a dollar a cookie
Yes
in russia its 8 billion rubles a cookie
Check dms
!d discord.Embed
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
embed.set_footer("text", icon_url="emoji url")
nothing is open its 5am

It's an url
i think you should make it if user == not just =
cuz the two == means is
and = is just equals
== means datatype is the same as and equal to
= means you want to set a variable
is means is the same as
oh nvm
isnt text a kwarg
cuz he already got it
It is unfortunately.
== Also depends on how an object implements __eq__, when comparing objects it's usually the best option to use is to check if the pointer is the same
Indeed
Are you seriously making a class for one command only
I mean like where :gay: is
Yes, it's for organisation reasons, plus I like it that way :)
why are you subclassing commands.Bot and taking a commands.Bot instance in the init?
just use a dict
or use match cases if you're using 3.10 <
no im ok
intentions: making a cog
makes: a bot class
😳oh, I just realised
What library are you using @drowsy thunder? Just so I can look at the right docs lmao
discord.py right
Ok, for a start I recommend changing libraries, dpy is pretty shit compared to others
best library for dsicord?
I need rich presence
how to use repl.it]
and any other whiich is the best of all time?
!d discord.ext.commands.Bot.change_presence rtd
await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the client’s presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
``` Changed in version 2.0: Removed the `afk` keyword-only parameter.
Create account,make a repl,its easy
not really
bro can i inbox you?
No
theres one called disco but it's severely outdated
what you recommend which library should I use?
ain't no way
how is discord.py shit?
I dont know
Yeah
just is ¯\_(ツ)_/¯
lmaoo
Use discord.py
!d import discord
7.11. The import statement
import_stmt ::= "import" module ["as" identifier] ("," module ["as" identifier])*
| "from" relative_module "import" identifier ["as" identifier]
("," identifier ["as" identifier])*
| "from" relative_module "import" "(" identifier ["as" identifier]
("," identifier ["as" identifier])* [","] ")"
| "from" relative_module "import" "*"
module ::= (identifier ".")* identifier
relative_module ::= "."* module | "."+
```...
Use import discord
you make no sense, what library do you recommend then?
Dpy has literally none of the new shit, so timeouts, slash commands, modals, none of em
Disnake, Nextcord or Hikari
..
yes, because it isn't maintained
After installing discord.py package with
$install discord.py in the Shell
@abstract dagger
Dm me,I will help you for the start code
pip install discord.py not just install
Thanks buddy ill contact you!
Install also works Ig
Yeah
just is

How do I get an emoji to work in the footer in an embed?where :gay: is
imagine saying dpy is shit
ikr
use the <:name:id> format
\:emoji:
\🏳️🌈
custom emoji
then use the unicode or copy paste it directly
Error ahead
error?
using repl.it yes
what is the error?
The yellow text isn't an error
and this isnt the right channel
but it isn't installed
its just a warning lol
it is
oh!
how?
hun 
hi
oh lol thanks hunter
all cool
its all good
Hi uh, so i rlly wanna ask this question, so Im curently using python for my bot, but it seems running so slow.. i mean the bot respond to me a little slow, so i have a little bit of research and i just knew that python IS slower than other language, but my question is does the slow effect on python effect the bot respond speed?
nope
its probably due to the ping
🏃♂️ python is not really that slow how people talk about it
Indeed
On which hosting you hosted your bot?
milliseconds of difference
How do I create a cooldown in an on_message command?
your code may be the reason too, if you do too many API calls or time consuming things it may make the bot slow
!custom-cooldown
Cooldowns in discord.py
Cooldowns can be used in discord.py to rate-limit. In this example, we're using it in an on_message.
from discord.ext import commands
message_cooldown = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user)
@bot.event
async def on_message(message):
bucket = message_cooldown.get_bucket(message)
retry_after = bucket.update_rate_limit()
if retry_after:
await message.channel.send(f"Slow down! Try again in {retry_after} seconds.")
else:
await message.channel.send("Not ratelimited!")
from_cooldown takes the amount of update_rate_limit()s needed to trigger the cooldown, the time in which the cooldown is triggered, and a BucketType.
@cloud dawn see his name 👀
Why it is not imported yet @maiden fable
thanks for the token
its wrong anyways
tho its an invalid one
Lmao see the error 🤣
You are not allowed to use that command here. Please use the #bot-commands channel instead.
~token
!token
@abstract dagger delete message
i have used the token it is not because of the token
bro you just did client.run("your token here")
no you are showing the token
don't dp that
delete the message
lmao it is not complete token
I...don't lol, i use only terminal
still
Hmm so can u explain how can i make less API calls?
why are you using replit to host your bot?
but wat will yo do with my half token lmao!
@cloud kiln can u try printing bot.latency?
than what i will use
Huh? Wdym?
try checking your latency first as hunter said (print(bot.latency))
api calls are mostly the methods which use await
ping for the bpot
Hmm okok wait imma try
how you do this?
A proper IDE
santa, wot is this
lol i just didn't used the "" i used ''
@cloud kiln Are you hosting your bot locally
client.run('your token here') 🤨
Wait, canni change the "bot" to 'client'?
they are command made inside the @unkempt canyon bot, nothing from my side
yes
oh ok I just testing repl.it btw i am using pycharm
Oh ok
yes i am asking you that how you just printed here?
yea
its a bot command... there are many other similar ones just to make explaining things easier
how can i fix this problem

learn python maybe?
Put a colon at the end
and you're missing a colon at the end of the parenthesis
tnx
But yeah, no learn python lmao
so many things wrong in your code
indent goes brrrr
yeah i am just asking how i can ask a bot to print such a commend
Indent size of 2 be like
it isn't printing anything
: at the end of line
!source custom-cooldown
Unable to convert 'custom-cooldown' to valid command, tag, or Cog.
ok
lol how can i get commands or source code on discord
Oh, so like how does it do the embed?
wdym 'do the embed'
source code on discord?
!source source
Display information and a GitHub link to the source code of a command, tag, or cog.
take a look at this :D
haha really😆
Well I have a python discord bot. It has a mc server status command working with api. I want to post the description of the server and not all the motd. Can you tell me how can I post only the "text" in the picture?
motd = str(json_data["motd"])```
json_data["motd"]["text"]
Lemme try
@client.event
async def on_guild_join(guild: disnake.Guild):
embed = disnake.Embed(title="Thanks for adding me to the Server!")
embed.add_feld(name="Before securing your server 100%, please make sure to:",
value="Have a channel named protech-logs\nGive bot an Administrator Permission\nPut the Bot's Role high enough to be able to Moderate the users below it!",
inline=False)
embed.add_field(name="Help & Support",
value=f"[Alpha Bot Website]()\n[Support Server](https://discord.gg/)\n[Commands List](https://urlhere.com)",
inline=False)
embed.add_field(name="Documentation", value=f"[Privacy Policy](https://urlhere.com)", inline=False)
embed.add_field(name="Get AlphaBot", value=f"[Add AlphaBot to your server](https://urlhere.com)", inline=False)
embed.add_field(name="Version", value=f"V1.1.1", inline=False)
await guild.system_channel.send(embed=embed)```
This is my code, it says that the add.embed (line 4) has no attribute.
Hmm
embed.add_feld(name="Before securing your server 100%, please make sure to:",
AttributeError: 'Embed' object has no attribute 'add_feld'
OH ITS FIELD
You write embed = disnake.Embed
All good, misspelled smth
No worries
Thanks it worked
Can someone share disocrd.py docs link?
!d discord
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.
How can I get a number of the users / guilds using a bot?
!d discord.ext.commands.Bot.guilds
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
!d discord.Client.users
property users: List[discord.user.User]```
Returns a list of all the users the bot can see.
Thank you champs!
remember to len those objects
yep
what do you mean by len?
the len function
field*
wait, do I get the number or?
I need it so it just pops up a number of the users
.
len()
nice
lol
Totally me
can you please give a example
len(client.users)
Imagine removing PFPs
len([";","5"])
dunno what you're doing so 
It's basic python my guy
!e print(len([";","5"]))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
2
why that xd
he wants examples
How do I add the , tho?
What
thats for list 💀
#bot-commands
.
so I don't get 69999 I need 69,999
Ah that
aah
XD
print(", ".join([guild.name for guild in bot.guilds]))
s.m.h.
There a formatting thing for that
like f'{len(client.users):,}'
Yea something like .2f, right?
it was a colon isnt it?
{:,}
!e print(len([";","5"]))
Idk I never used that thing, so don't know anything about the syntax, sorry
Yep I believe it's that. Lemme test it
int:,.2f or smth ig
dont remember really 
!e ```py
guilds = 46316974151
print(f'{guilds:,}')
Ah yea
@slate swan :white_check_mark: Your eval job has completed with return code 0.
46,316,974,151
woah cool
Hmm, I never understood that syntax tbh
same
same 
Reasons I ain't able to remember it
use list comprehensions to manually add delimiters
Yea, but then it's a bit typical for a beginner like me
count me in
Sure
Same
anyways, lets adhere to rule 7 now
Was waiting for kayle to run the command but thanks for saying it without using the command 👀

Channel dead once again 
what syntax?
To add , automatically in a big number
https://docs.python.org/3/library/string.html the specification for it is here, scroll down until you see format, etc
What's this?
base64 data
Infernum any idea on this?
uh I'm not too sure if I understood the question correctly
so you just wanna make a bot for a server?
basically just a bot to have a special profile picture for one server
and for the rest, it's constant
i've seen some bots like mee6 or dyno that have different profile pictures, but the bot account isn't verified
so it should be a webhook
this is MEE6 ^
that's definitely not a webhook
a really complicated answer would be the same bot instance, running on a different token and thread with a new account
I'm not sure how mee6 does it, maybe just another bot account
¯_(ツ)_/¯
possible
i mean i know it's a mee6 premium feature but mee6 is a big bot so would they have that many accounts..?
no
so if I want a bot to have a profile picture different in one server only anyone can give ideas?
i guess just make another bot application
Any help?
you closed the f-string with a quote that you prolly didn't intend
make sure to use " and '
use ' for the name
Ok
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
How can I make it picture?
u can use bytes
Wdym
you responded too late. You must respond within 3 seconds, if you don't respond within that time limit you must defer the interaction @kind cargo
Would go OT if we continue here
okay
How do I actually send embed? 😂
send(embed=...)
channel.send(embed=embed)?
Yea
wait,
@client.command(description="A basic help command.")
async def help(embed, seconds: int):
embed = disnake.Embed(title="Thank You for adding Protech to this Server!")```
what do I type now? and is this good?
uh
async def help(ctx, embed, seconds)
also it will override the default help function
tbh I don't get the point of the seconds arg
!d help lol
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
and also the embed arg
😄
https://github.com/nextcord/nextcord/blob/master/examples/application_commands/sub_commands.py love how nextcord uses the Interaction class that d.py made, unlike disnake/pycord making another class for context
A maintained fork of Danny's discord.py. Contribute to nextcord/nextcord development by creating an account on GitHub.
remove embed too
Ikr lmao
Don't hardcode your help command
Hold on, how do I disable the default help command again?
help_command=None in the bot constructor
thanks
what's better, help_command=None or bot.remove_command("help")?
first one ofc
got the reboot card
can anyone here tell me what x and y co-ordinates I should put to draw a rectangle down the synetrical centre of a image
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
okay yeah it's for a discord bot I wanted that but i guess it's still irrevlevant
can't even revive the chat
pip install git+https://github.com/Rapptz/discord.py
error: Cannot find -git, do you have 'git' installed on you PATH?
how to install git :/
Are you on windows?
nobody, literally 2 questions in a row not related to the channel topic 
Ash
meh
🤫

yes
Then go here and download it
ty
🗿
imagine still using dpy 
Imagine
facts
imagine making discord bots anymore
literally
use 3 3rd party libraries instead 😎
meh
no
How do I make a welcome command? I have this, but idk how to get it to send in the right channel when someone joins
import disnake
from disnake.ext import commands
import random
class Welcome(commands.Cog):
"""Fires one of many welcome messages."""
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.Cog.listener()
async def on_member_join(self, member: disnake.Member):
"""Fires off a welcome message on user join."""
welcomeEmbed = disnake.Embed(
title = f"Welcome {member.name}!",
description = "Shitter >:)"
)
channel = bot.fetch_channel(channel_ID)
await channel.send(embed = welcomeEmbed)
def setup(bot):
bot.add_cog(Welcome(bot))
print(" | Loaded Extension: Welcome")
print(" | ")
sad maintainers noises
events
lol
you either make the server members with perms configure the channel or just dont make a welcome message
How do I make it so they config the channel?
I'd imagine maybe using a /config command?
yes
But idk how to keep the stuff
what do you think?
A db maybe?
don't forget this 👀
I forgot 🧍♂️

What is a common approach to keeping a remote VPS updated and restarted when a github repo is commited towards/released?
depends on your vps provider, also this is not the appropriate channel to ask this question
I would recommend adding a self-hosted service to your repo and setting up some deployment workflow (like that would just execute the command)
https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners
https://docs.github.com/en/rest/reference/deployments
I mean for discord bots, I supposed there would be some people here that have done a similar thing
Awesome, I'll look into it thank you
what is a way i can get all commands in a group? i can get all commands in cogs, main files, etc. but im having a hard time getting commands in a group.
@modest plover
guild = self.bot.get_guild(guild_id)
channel = self.bot.get_channel(channel_id)
my first answer i figured was [subcommand for subcommmand in command.walk_commands() if subcommmand.parents[0] == command] but i want to know if i can do this easier
did i tag u?
?
!d discord.ext.commands.group
@discord.ext.commands.group(name=..., cls=..., **attrs)```
A decorator that transforms a function into a [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group").
This is similar to the [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator but the `cls` parameter is set to [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group") by default.
Changed in version 1.1: The `cls` parameter can now be passed.
It's easy
how can i get all groups and the commands inside of said groups, this is basic knowledge.
so i can list them in an array, embed, etc.
Can i check if a role added to a user that the bot will write a message per dm to this user?
@sick birch want me to make this channel active again?
you could get the role then dm the user
Nvm this is already active
role = discord.utils.get(ctx.message.server.roles, name="my role")
for member in ctx.message.server.members:
if role in member.roles:
await member.send("Hello user! This is in a dm now!")
@arctic kindle hope this helps
Thx
np
ctx.message.server.members server? aint it guild?
server is easier to iterate through
ah ok
But i want a signal when i add a role to a user yk
then you need an event
Which event and what i have to do
!d discord.on_member_update
discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.
This is called when one or more of the following things change:
• nickname
• roles
• pending...
it could be a command
like if you have a "announcement" role or something
you can dm them updates, news, and other stuff
but if u want alert when they get role given its on_member_update
thats if you're logging stuff
I want if i add the mod role to a member that he gets the Rules for Mods yk
but if you want to dm all that already has a role, then someone already gave u the code
oh ok so you use on_member_update and check the roles before, then after, and if after has mod, you can dm them
ye i was reading it as he wnats to log it to a channel
ahh
@silk kelp this msg
Can you write the Code for me pls 🙂 im 15 years old HAHA and im a Beginner
Im 15 lol
All good, but i can't spoonfeed sorry.
I could give you a short example if it helps
Okay i will try my best
he actually only needs to check after, and check if role is there
Yeah thx
but it could keep sending it if it was already there and the user just got a different role
yeah it will trigger even if change name n stuff my bad 😄
oh yeah
Noice
what is the thing with wanna code bots but dont wanna learn :S
Haha
its like all wanna drive a car but no one wants to learn theory
coding bots is pretty fun, but time consuming
@arctic kindle https://discordpy.readthedocs.io/en/stable/api.html
its like any other event but it has 2 paramters before, after those 2 will be objects of the member before a changes was made is after, so you can see what was changed
like before.name after.name if those same name wasnt changed e.q
@bot.event
async def on_member_update(before, after):
if 'mod' in str(before.roles):
return
elif 'mod' in str(after.roles):
await member.send("Welcome to the mod team! here are the rules:")
i tried, ive never used on_member_update so i dont know if it will work
it checks if the user already has it?
if he changes nickname and still has mod role he will get dm's
that was the only problem, right?
if they already has it it returns and doesnt trigger
if 'mod' in str(before.roles):
return
lmao nw
@arctic kindle its case sensitive so if your role is called Mod it will not work, you will have to change "mod" to "Mod" or "Moderator" depending on what its called
or id
Okay bro thx
o yeah, but easire if u just change since its 4 one server
but yeah check ID's is still optimal cause maybe u wanna change rolename later
or include emois to the name etc
i feel like were overcomplicating this with ideas
😄
i was about to say we could log the id in a json file, array, etc, and pull it out on an on_member_update when iterating through the ids in the file
Im trying to install py-cord but im getting this error :/
No module named pip
send the error
installed pip?
how to install it
what are u using?
when you install python https://python.org/downloads
can u also type the command u try execute
py -3 -m pip install -U py-cord
ive installed already
3.8.6
with pip?
is it windows?
yes
just do pip install -U py-cord
sure?
whatyou get if u do pip -V
They don’t have the pip executable
pathname?
oh yikes
want disnake
im still using og discord.py
im using it until it literally does not work
e
@stray carbonpip install py-cord==2.0.0b1
Install it from GitHub
intressting, https://pypi.org/project/py-cord/2.0.0b1/
I told you this a few hours ago
pip install git+<GitHub link>#egg=py-cord
that didnt work so im trying pycord
Same thing
and in your PATH?
where do i paste it 
ig no
path enviorment
Bro your Code triggers when i add the modrole but in await member.send("Welcome to the mod team! here are the rules:") member is red underlined what i have to do
Right-Click on My Computer
Click on Advanced System Settings
Click on Environment Variables
Then, under System Variables, look for the path variable and click edit
Add the path to git’s bin and cmd at the end of the string like this:
;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd
OR
;C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\bin;C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\cmd
To verify, restart cmd and type git --version in cmd```
original dpy 
ok
yeah thats probably why
member object never declared
disnake and the other bootlegs that popped up changed alot so i cant help as well as i used to
in disnake, for example, there's member, before and after
it's really unnecessary but yeah
im dpy original its automatically declared for me
you can do after.send() instead of member.send()
right
i have a year
lmao just update everything
Thanks lol
cause you have multiple installations now.
lemme uninstall 3.7 first
👍
python3.8 -m pip install py-cord==2.0.0b4
if you're on linux or something
for windows you can just pip install if you have pip in the path
I don't know how to exactly use a DB normally in the CMD line let alone in discord
why would you use command prompt to interact with the bot and a database?
there are already libraries for all ( or atleast most) of databases
Because I can't see what's in a database on sqlite3
Without using the command line
DB browser for SQLite exists
how make add emoji command how get the emoji from the message?
Is there a mobile version?
no? why would you code and do that on mobile in the first place
maybe they dont have access to a computer but they want to code?
you can still use in browser ides.
yeah but its not ideal to program on a phone
sqlite file viewer
you can just use this to view it.
hello
I need help at this
Traceback (most recent call last):
File "main.py", line 6, in <module>
from chatbot import Chat, register_call
ImportError: cannot import name 'Chat' from 'chatbot' (/home/runner/PowerChat/venv/lib/python3.8/site-packages/chatbot/__init__.py)
use a command argument and typehint it to discord.Emoji
whats chatbot ?
a package
i'm pretty sure not a discord bot relevant package
seems like it does not have a Chat class
it! is
show full traceback
I don't even find the resource of the package online D_D
!pip chatbot
What about adding to the file?
you can write the queries there..
How?
after uninstalling py3.7 i am getting error: "pip' is no a recognized internal or external....
there is no class named chat in that package. The class is called ChatBot
dont you see a command there? you can change it
I do but adding to it makes the text go away
you didnt click on add to path while installing python
Its mean Chat is not a class
...
That's the answer @eager prism I think
I'm trying to get a bot to print ascii-art but it's formatting wrong. I think it's an issue with Discord eating tabs that are in the art.
what it should look like
what it does look like
right now i have it replacing tabs with 4 spaces
it's printing inside of ```
try more spaces
i'll try it with 6
try both with 6 and 8 and see what brings most correct shape
oh it's so close
🙂
in the process of making a bot respond to a string of text. i can do it when the text is all lower case but im trying to make it case insensitive.
ive tried adding the string in different cases and labeling them string_1, string_2 etc. anyone know the way to do this?
with add like msg = message.content.lower()
if msg.startWith("hello") etc
done,installed it tysm
ty
startWith doesn't exist
what ever its spelled 😄
return
if message.content == ("xxxstring herexxx"):
await message.channel.send(
"Finally, a WINNER! Still hope left for humankind after all. Will need to scan specimen's brain waves. Come here. Only the first one to get this wins."
)
else:
await message.channel.send(random.choice(list))```
@winter moth```py
if message.author.bot:
return
msg = message.content.lower()
if msg == ("xxxstring herexxx"):
await message.channel.send(
"Finally, a WINNER! Still hope left for humankind after all. Will need to scan specimen's brain waves. Come here. Only the first one to get this wins."
)
else:
await message.channel.send(random.choice(list))
msg = message.content.lower() this .lower() makes a string be only lower-cases
will it respond to a input if it is not only lower case?
please help me finding the registercall pkg pls https://sourceb.in/EATlqTyHEv
yes
lets say message.content is "HeLlo"
msg = message.content.lower()
if msg == ("hello"):``` will still be true in the if statement
np
so the () in it is the part where it is ignoring the case?
does this include slash commands as well
what module is this?
its .lower() that tells message.content convert into only lower-cases
ok that makes sense
im assuming its discord.py, if it is it doesn't have slash commands
@winter mothlook here
!e
myvar = "ABCdefGh"
print(myvar.lower())
print(myvar.upper())
print(myvar.title())
@honest vessel :white_check_mark: Your eval job has completed with return code 0.
001 | abcdefgh
002 | ABCDEFGH
003 | Abcdefgh
okokok
what the 
if message.author.bot:
return
msg = message.content.lower()
elif msg == ("xxxstring herexxx"):
await message.channel.send(
"Finally, a WINNER! Still hope left for humankind after all. Will need to scan specimen's brain waves. Come here. Only the first one to get this wins."
)
else:
await message.channel.send(random.choice(list))
doesnt really matter
that msg var will never be declared n run and throw an error
Command
@bot.event
async def on_message(message):
for i in links:
if i in message:
await message.delete()
await message.channel.send(f"{message.author.mention} doesn't work my friend")
else:
await bot.process_commands(message)```
**Error**
message.content
message.content.lower()
i did what #! said and its working exactly as described
ignore them
Guys when i try to create a text channel in a category i get this error:
AttributeError: 'NoneType' object has no attribute 'create_text_channel'```
This is how i defined "TICKET_CATEGORY":
https://lel.link/5vkvuZAUhr
category is returning None
And how i fix this?
i am just guessing but bot.get_guild(guild) guild.create_text_channel() and pass akwarg for parents/category id?
let me check docs
Yea
!d discord.Guild.create_text_channel has a category kwarg
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either 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")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
ah ye
Like this?
ticket_channel = await GUILD.create_text_channel(name=f"{ctx.author.name}", overwrites=overwrites, category=TICKET_CATEGORY)
what is GUILD?
that should work
if it is a guild object, then sure
probably a variable for ctx.guild
yea
is that the guild where the command is been run in?
Yh a slash command
you don't have to use bot.get_guild then
what i should use?
!d disnake.Interaction.guild
property guild```
The guild the interaction was sent from.
to be fair i didnt know if he ran a command or not 🙂
no
What's this copy service
imagine posting the image directly 
if its a command then just ctx.guild
await interaction.guild.create_text_channel()
oh
remove the bot.get_guild var (variable)
BTW its gonna return an error on the GUI since we ain't deferring the interaction
^
you need to defer to get the guild?
That is how discord works 
Never seen it before
no, just to remove the error
No documentation found for the requested symbol.
just make a slash command and just do pass in it
uh
!d disnake.InteractionResponse.defer
await defer(*, ephemeral=False, with_message=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Defers the interaction response.
This is typically used when the interaction is acknowledged and a secondary action will be done later.

I got ya
That message wasn't meant for you sry
Ah okay
(did I say it politely enough)
Everything is polite for me unless it isn't said in an argument
AttributeError: 'property' object has no attribute 'id'
code
wot
Property object lookin sus
ticket_channel = await interaction.guild.create_text_channel(name=f"{ctx.author.name}", overwrites=overwrites, category=TICKET_CATEGORY)
show whole traceback
a sec
How tf you have ctx and interaction at the same command? That's abnormal
how are you doing ctx?
Apex do be taking ages to find a match 
ah yea, that too
