#discord-bots
1 messages · Page 590 of 1
what about 9.9%
There is a free plan in mongo db its called atlas
i don't know how to use db
Try watching a video or deploy from a app to understand how it works
uhmmm okok
learn
yup doing that
U will have to pay fro db if u are really making a public bot
why?
aiosql free
🤨
acts = member.activities
act = [i for i in acts if isinstance(i, discord.CustomActivity)]
if act:
act = act[0]
if discord.utils.find(lambda act: isinstance(act, discord.Spotify), member.activities) == True:
listening = "Listening to Spotify "
act = ""
elif discord.utils.find(lambda act: isinstance(act, discord.Spotify), member.activities) == False:
listening = ""
if discord.utils.find(lambda act: isinstance(act, discord.Game), member.activities) == True:
playing = "Playing A Game "
act = ""
elif discord.utils.find(lambda act: isinstance(act, discord.Game), member.activities) == False:
playing = ""
act = ""
if discord.utils.find(lambda act: isinstance(act, discord.Streaming), member.activities) == True:
streaming = "Streaming on Twitch "
act = ""
elif discord.utils.find(lambda act: isinstance(act, discord.Streaming), member.activities) == False:
streaming = ""
else:
act = 'None'
await ctx.send('{playing}{listening}{watching}{act}')```
`Command raised an exception: UnboundLocalError: local variable 'playing' referenced before assignment`
thats basically the part im having struggles with, but im not sure why that error comes up
i defined 'playing'
(I mentioned for powerful public bots)
how would i start a timer without using asyncio.sleep like it should'nt sleep. the bot shud be online
use a global keyword
so indents are whats causing the problem right
maybe
so i dont see how indents would be the problem
I said maybe
global variable
any ideas of what else it may be
When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.
Instead of writing
def update_score():
global score, roll
score = score + roll
update_score()
do this instead
def update_score(score, roll):
return score + roll
score = update_score(score, roll)
For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.
🙂
Huh
ok well
🤨
ive used it
your literally using it to make commands
but not in command statements
you are
obviously async def
def hello(ctx):
...
``` 🤨
^^
L
yeah, def assigns a function, async turns that function into an async function using asyncio
but how am i meant to use that in a variable for a command output
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'owner'
its not like i can do "{update_score()}"
Please use code blocks
Insert bot token in env tab with same variable name
well playing is causing the error right
i did
yes
do i need to import dotenv
!d discord.Guild.owner this?
property owner: Optional[discord.member.Member]```
The member that owns the guild.
No
then use the global keyword on that somewhere in the command
global playing
...
It should be put into env tab in railway repo settings
so i dont put in my vs code?
No. You don't.
Github and lauch from github
yeah im doing that
line 1: cannot unmarshal !!str web:pyt... into map[string]string
ERROR: failed to build: exit status 3
ERROR: failed to build: executing lifecycle: failed with status code: 51
this is my procfile web:python main.py
is it wrong?
@coarse shore is the railway thing unlimited usage?
ok im back
for free
ok
acts = member.activities
act = [i for i in acts if isinstance(i, discord.CustomActivity)]
if act:
act = act[0]
playing = ""
listening = ""
streaming = ""
act = 'None'
if discord.utils.find(lambda act: isinstance(act, discord.Spotify), member.activities):
act = "Listening to Spotify "
elif discord.utils.find(lambda act: isinstance(act, discord.Game), member.activities):
act = "Playing A Game "
elif discord.utils.find(lambda act: isinstance(act, discord.Streaming), member.activities):
act = "Streaming on Twitch "```
no errors, no handlers, no exceptions, but the output remains 'None'
sry for flood <3
Hm
Required python 3.8 or higher
oh, the status value is {act} btw
Change ctx.author.guild_id to what I said earlier
1 day ago 🤨
Im using python3.9
ERROR: failed to launch: determine start command: when there is no default process a command is required
ERROR: failed to launch: determine start command: when there is no default process a command is required
ERROR: failed to launch: determine start command: when there is no default process a command is required
ERROR: failed to launch: determine start command: when there is no default process a command is required
add a start command
?
okayy
Is there a way to edit the messages content and embed like: edit(content=f"{ping.mention}", embed=embed)?
await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
found nth
Oh i got it, there was a problem somewhere else and I fixed this here already with content=. Thank u 🙂
I checked the message history of this channel to help people that're using disnake
Mm try asking in the support server
🙃 okay
Probably pip is from a different version
hey, im getting a weird error witht his code
file = await attachment.to_file()
artist = msg.author
caption = "No caption" if caption == "" else caption
embed = discord.Embed(description=f"**Caption**: {caption}")
file = None
if attachment.is_spoiler():
file = await attachment.to_file(spoiler=True)
else:
embed.set_image(url=attachment.url)
embed.set_footer(text=f"Uploaded by {artist.name} (post unverified)", icon_url=artist.avatar_url)
embed.colour=self.colour
embed.add_field(name="Tags", value="-")
#else:
# await msg.author.create_dm()
# await msg.author.dm_channel.send("You cannot upload files that arent images or videos in this channel!")
#await msg.delete()
message = await galleryChannel.send( embed=embed, file =file)
File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\pc\Desktop\Projects\Cool art bot\cogs\artlevels.py", line 105, in on_message
message = await galleryChannel.send( file =file)
File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\dpy_overrides.py", line 323, in send_override
return await send(channel, *args, **kwargs)
File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\dpy_overrides.py", line 264, in send
data = await state.http.send_files(
File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\http.py", line 185, in request
async with self.__session.request(method, url, **kwargs) as r:
File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\client.py", line 343, in request
return _RequestContextManager(self._request(method, url, **kwargs))
TypeError: _request() got an unexpected keyword argument 'form
You gotta love it when u get an error in a file u didn't even program
tysm i did it
i think u need to send ur code lol
Is it possible to make a bot respond to another bot?
if so, what is the script of it?
How can I make my bot leave a server
what?
Yup like I want it to send a message as soon as it joins and then leave the server
@last moss
There is a thing called code blocks which you should use
It says message.embeds has neither of the functions title and description.. How do I get the title and description from the embed?
I just want my bot to leave the server
Sorry for late reply wifi died
@last moss
class discord.Guild```
Represents a Discord guild.
This is referred to as a “server” in the official Discord UI.
x == y Checks if two guilds are equal.
x != y Checks if two guilds are not equal.
hash(x) Returns the guild’s hash.
str(x) Returns the guild’s name.
Cuz you replied to me and then left
tysm
epehermal messages
eh?
Which lib are you using?
uk how to do in disjs?
No sir
then?..
I am using pycord, discord-components and disnake
ahh alright
views/interactions
ah?..
i replied to someone else
ahh i see alright :/
cringe 3rd party lib
It's better to use a fork rather than those.
Works fine for me
I
in discord.py, make sure you got the master branch (not on pip, only on git). Then when sending a reaction response, set ephemeral=True
??
ephemeral is just the "only one person can see this"
I was replying to the guy who tagged me
Oooo anyways thanks
ephemeral messages are in discord.py
the only thing discord.py doesn't have is slash commands
and buttons and dropdowns
discord.py has all buttons and UI toolkits
And user and message interaction commands too
^
thanks ^^
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
!d discord.ui.Button
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
all in discord.py
didn't know that tbh
also dropdown
Even user interaction commands?
!d discord.ui.Select
class discord.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.
This is usually represented as a drop down menu.
In order to get the selected items that the user has chosen, use [`Select.values`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Select.values "discord.ui.Select.values").
New in version 2.0.
Okay
@valid niche
i think discord-py-interactions does the job just fine anyway
slash commands is the only thing not implemented because that's ulimately the thing that made danny just say "nope" due to not agreeing with how the API was turning out
can someone help me if someone uses a command what they dont have cant use how do i make the bot tell them
hmm
make a check decorator that checks if they are not allowed, then an error handler that catches that check error and tells the user
how do i do that
Use if-else
if ctx.author.guild_permissions.ban_members:```
the story if you want, warning it's a whole "political" thing and it's a heavy read: ||https://gist.github.com/Rapptz/4a2f62751b9600a31a0d3c78100287f1||
I read that
make error handlers
Well there are many ways
Yep but easiest us error handler ig?
Ohh
it's either error handling, which is the easiest and most used way, you can find plenty of examples and such.
The other way is to make the bot tell it's not usable in the check function, and silently ignore the error
it's because the system is designed around it
Why not use if-else?
because it’s more work.
Not efficient
thats just wasting ur time making custom errors imo
because that means having a whole payload of if statements at the start of EVERY SINGLE command, instead of one uniform check function that you only have to write once. And a very well structured error handling function where you can define the behaviour for all commands
and you can also write local error handlers for those few commands you want to have different behaviour
Hmm but still for me if-else works good
i made error handler in bot.event and it's a weird and easy way tho
again, you can use any system, but discord.py is designed around this idea of checks and error handlers and has the entire system built on it making it as smooth and efficient as possible
Yup it is
Just my personal opinion I use if-else
How do we count how many reactions are on a message?
I got my bot online and set a prefix, now I’m just wondering how to find out what I can do with the bot? Like how do I figure out how to make the bot ping a certain person if a command is ran or ban someone?
yea, I did like this so I don't need to make a error handler after a command
the check system just allows you to easily write a decorator to check if someone for instance has a specific permission, instead of having to write clunky if statement that gets the permissions and checks if the specific permission is in there
I did the same with many commands
Use length on message.reactions?
useless f strings
But with those which need specific errors
cool
I used if-else
hm
ikr 
the checking of your requirements in the form of checks of if statements or whatever is step one
handling the result of that in an error handler is step 2
these can be completely separated and changed out
y the cringe hardcoded help command
my wish
i am creating a database, only the code does not create the table
code:
async def on_ready ():
db = sqlite3.connect ('my.sqlite')
cursor = db.cursor ()
cursor.execute ('''
CREATE TABLE IF NOT EXISTING main (
guild_id TEXT,
message text,
channel_id TEXT
)
''')```
error:
none from the console, no tables created from SQLITE
IF NOT EXISTS i think?
Can I get your help command's code if you don't mind
why are you using sync SQLite bruh
mm havent used sql before not sure
bruh
sorry I entered this because if I entered something else it gave me an error
theres a literal gist on how to get a help command
I am trying to make one and it's easy if someone gives it to me already
Link please
And you don’t need a cursor to execute your bots db schema.
I started a few hours ago and I didn't quite understand everything
I dont have it, check dpy server and look for a help command tag
Just use db.execute
I am not in dpy server
😭
uhm, and how i make the table without cursor?
Invite please
tysm
Just feed the schema string into db.execute and watch magic happen
Really you only need the cursor for fetching data.
Can I send here a thing that took me 5 minutes?
yes
Took 5-10 minutes
🗿
I love python
same
agreed
Why did it happen
u need 2.0
I have 2.0
can you do pip show discord.py?
Here
possibly venvs and different installs? otherwise your imports aren't correct
that means you have multiple python installs
How do i fix it
by either specifying what version to use in the pylauncher (py command), or uninstalling versions you don't use
you pip command is on PATH to a specific version of python, but the pylauncher (py command) by default goes to another version
I wanna make a discord bot. Where do I start?
is there any tutorial explaining how i can create a web control panel? like mee6 or carl
How do you get the relative time of a user? So like if someone did a user info command and it had when said user joined or whatever it would look like Tues, 20 March 2021 06:44 PM UTC (7mo ago)?
So I am trying to make a >clear command, which will either clear a certain amount for either users or just channel. I know how to do the delete for messages in just the channel. But I do not know what check function that is required.
Nvm I fixed it
When I try typing a command on my bot I get this error message
This is my code excluding the import and token
command_prefix = '='
bot = commands.Bot(command_prefix = command_prefix)
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
@bot.command()
async def ping():
await bot.say("Pong")
bot.run(TOKEN)```
how to wait for a task to cancel
is there a way to count the time it takes to complete a command?
Record the time stamp at the start, record it at the end, subtract
how would i do that?
*record the time
is this discord.py ?
datetime.datetime.now().timestamp() will return the current timestamp
yes i guess
use the timeit
That would work as well
I get an error when I run a command =ping in my code
command_prefix = '='
bot = commands.Bot(command_prefix = command_prefix)
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
@bot.command()
async def ping():
await bot.say("Pong")
bot.run(TOKEN)```
this is my error
Traceback (most recent call last):
File "C:\Users\rverm\timer\venv\lib\site-packages\discord\ext\commands\core.py", line 690, in _parse_arguments
next(iterator)
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\rverm\timer\venv\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\rverm\timer\venv\lib\site-packages\discord\ext\commands\bot.py", line 979, in on_message
await self.process_commands(message)
File "C:\Users\rverm\timer\venv\lib\site-packages\discord\ext\commands\bot.py", line 976, in process_commands
await self.invoke(ctx)
File "C:\Users\rverm\timer\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\rverm\timer\venv\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
await self.prepare(ctx)
File "C:\Users\rverm\timer\venv\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "C:\Users\rverm\timer\venv\lib\site-packages\discord\ext\commands\core.py", line 693, in _parse_arguments
raise discord.ClientException(fmt.format(self))
discord.errors.ClientException: Callback for ping command is missing "ctx" parameter.
because you forgot to add a ctx argument to your command
and bot.say is nothing
bot is just the bot instance, it has no say
and if that's meant to send a message, it has no idea on where to send the message
in disnake to check message content it is disnake.message.content but in the api it says as argument only startswith how do i check if somewhere in the message is a specific word or sentance?
when i restart the bot (in vscode) the "amount" is reset too... how can i make the amount not go out?
I used this public command to test and have a basis on how to create an economy command
amounts = {}
@bot.event
async def on_ready():
global amounts
try:
with open('amounts.json') as f:
amounts = json.load(f)
except FileNotFoundError:
print("Could not load amounts.json")
amounts = {}
@bot.command(pass_context=True)
async def balance(ctx):
id = str(ctx.message.author.id)
if id in amounts:
await ctx.send("You have {} in the bank".format(amounts[id]))
else:
await ctx.send("You do not have an account")
@bot.command(pass_context=True)
async def register(ctx):
id = str(ctx.message.author.id)
if id not in amounts:
amounts[id] = 100
await ctx.send("You are now registered")
_save()
else:
await ctx.send("You already have an account")
@bot.command(pass_context=True)
async def transfer(ctx, amount: int, other: discord.Member):
primary_id = str(ctx.message.author.id)
other_id = str(other.id)
if primary_id not in amounts:
await ctx.send("You do not have an account")
elif other_id not in amounts:
await ctx.send("The other party does not have an account")
elif amounts[primary_id] < amount:
await ctx.send("You cannot afford this transaction")
else:
amounts[primary_id] -= amount
amounts[other_id] += amount
await ctx.send("Transaction complete")
_save()
def _save():
with open('amounts.json', 'w+') as f:
json.dump(amounts, f)
@bot.command()
async def save():
_save()
Save it to a file or use a database
?
Good Evening guys!
I want to add some more parameters and make them optional so that the user can add for e.G one added field in the embed, just if he wants he could add a second one. How to make this parameters optional?
@client.command(name='cembed', pass_context=True)
@has_permissions(ban_members=True)
async def cembed(ctx, title, description, name, value):
embed = discord.Embed(
title = title,
description = description,
colour = discord.Colour.red()
)
#embed.set_footer(text='Euer Apocalyptic Serverteam', icon_url='https://cdn.discordapp.com/emojis/864438006953934849.png?size=128')
#embed.set_image(url='https://media.discordapp.net/attachments/901462338669019156/902961928014553088/oie_wgj4WZr22F9h.gif')
#embed.set_thumbnail(url='https://media.discordapp.net/attachments/901462338669019156/902933022477791333/0e863f0c17117e606fc1c35ac32276222b2dd96fd4aec223466a4917caefca31a0fe6a17a2b3309ada39a3ee5e6b4b0d3255bfef95601890afd80709e9453722f343b4a9c927610965eea19a.png')
#embed.set_author(name='Apocalyptic',
#icon_url='https://cdn.discordapp.com/emojis/864438006953934849.png?size=128')
embed.add_field(name = name , value = value , inline=False)
#embed.add_field(name='**§5 Fraktionen**', value='· ', inline=False)
#embed.add_field(name='**§6 Flaggen**', value='·', inline=False)
await ctx.send(embed=embed)
await ctx.message.delete()
@cembed.error
async def cembed_error(ctx, error):
if isinstance(error, MissingPermissions):
await ctx.send('Du hast keine Berechtigung diesen Command auszuführen! {0}'.format(ctx.author))
Thx for any help :==)
I've already tried this but the "amount" restarts anyway
Well you'll need to load the file on start and set amounts to it
if "my word" in message.content
thx
to "main.py"?
Yea
do I use the await delete_messages() the same way as await delete()?
i achieved! ty for the help and srry for this ping
It takes a list of messages
I assume you havent tried it
hi, how do you edit a past message with the id of the message?
bros i want create bot with python but i can that? or i need learn discord.py?
Or like await message.channel.deletr_messages()
Also its a method on a channel, so you need to call it on them
Was just curious if it would work
Just noticed that function
Fetch the message, then you can edit it
!d discord.TextChannel.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
thanks
.
Learn python first, then come learn dpy
Ima test if it works, brb
my question is " i will can that on python " bro
I will can that on python, can you rephrase this so it makes sense
okay thx
ummm it dont seem to like await fetch_message
huh
Its a method on a TextChannel... As shown in the docs
which means?
Object oriented programming, would recommend brushing up on it. Will help
It means you need to call that method on an instance of TextChannel
how would you go about doing that?
!d discord.Client.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
would you do it as
get_channel(id , /)
fetch_message(id, /)
message.edit(new text)
Yea
okay thanks
Hello anyone interested in helping me make vouch bot?
Can you help me out with that?
@client.command(name='cembed', pass_context=True)
@has_permissions(ban_members=True)
async def cembed(ctx, title, description, *name1, value1, name2, value2):
embed = discord.Embed(
title = title,
description = description,
colour = discord.Colour.red()
)
#embed.set_footer(text='Euer Apocalyptic Serverteam', icon_url='https://cdn.discordapp.com/emojis/864438006953934849.png?size=128')
#embed.set_image(url='https://media.discordapp.net/attachments/901462338669019156/902961928014553088/oie_wgj4WZr22F9h.gif')
#embed.set_thumbnail(url='https://media.discordapp.net/attachments/901462338669019156/902933022477791333/0e863f0c17117e606fc1c35ac32276222b2dd96fd4aec223466a4917caefca31a0fe6a17a2b3309ada39a3ee5e6b4b0d3255bfef95601890afd80709e9453722f343b4a9c927610965eea19a.png')
#embed.set_author(name='Apocalyptic',
#icon_url='https://cdn.discordapp.com/emojis/864438006953934849.png?size=128')
embed.add_field(name = name1, value = value1, inline=False)
embed.add_field(name = name2, value = value2, inline=False)
#embed.add_field(name='**§6 Flaggen**', value='·', inline=False)
await ctx.send(embed=embed)
await ctx.message.delete()
@cembed.error
async def cembed_error(ctx, error):
if isinstance(error, MissingPermissions):
await ctx.send('Du hast keine Berechtigung diesen Command auszuführen! {0}'.format(ctx.author))
I want to add these fields like name1, value1, name2, value2 as optional parameters so the person who invokes the command is able to create just one embed.add_field for e.G
You know how to do that?
I'm trying to make a command so I can set a certain command to send a message in a set channel
If you recognise time costs money lol
You will likely need to use some form of flag system
@bot.command()
async def announcement(ctx, announcement_text):
if announcement_channel != "":
await ctx.send(f"@everyone {announcement_text}")
else:
await announcement_channel.send(f"@everyone {announcement_text}")
@bot.command()
async def changeannouncementchannel(ctx, change):
announcement_channel = bot.get_channel(change)
await ctx.send(f"Announcement Channel Changed To #{announcement_channel}")```
I don't know why my announcement won't send to the channel I change it to
when I try changing it my bot says
"Announcement Channel Changed To #None"
where would I put that?
Google: "How to read a json file, python"
Alternately add the query how to set variable
async def announcement(ctx, announcement_text):
if announcement_channel != "":
await ctx.send(f"@everyone {announcement_text}")
else:
await announcement_channel.send(f"@everyone {announcement_text}")```
Why isn't it sending to the channel I set announcement_channel to?
ok, thank you
Okay holy cow i will try that
so the ```py
nextcord.ext.commands.flag(*, name=..., aliases=..., default=..., max_args=..., override=...)
"nextcord.ext.commands.flag()" is for example cembed.flag(...) ?
Im not sure. I've never used it before
import discord
from discord.ext import commands
TOKEN = 'My Token'
command_prefix = '='
bot = commands.Bot(command_prefix = command_prefix)
announcement_channel_set = ""
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
@bot.command()
async def announcement(announcement_channel_set, announcement_text):
if announcement_channel_set == "":
await bot.send(f"@everyone {announcement_text}")
else:
channel = announcement_channel_set
await channel.send(f"@everyone {announcement_text}")
@bot.command()
async def changeannouncementchannel(ctx, change: discord.TextChannel):
global announcement_channel_set
announcement_channel_set = bot.get_channel(change)
await ctx.send(f"Announcement Channel Changed To #{change}")
bot.run(TOKEN)```
This is my whole program, what I don't get is why when I change announcement_channel_set as a global variable, it doesn't change the channel I want the announcement to go into when I do =announcement {message}
Use bot var's, its way easier
idk what bot vars are
See the image I sent you before
async def announcement(ctx, announcement_text):
if bot.announcement_channel_set == "":
await ctx.send(f"@everyone {announcement_text}")
else:
channel = bot.announcement_channel_set
await channel.send(f"@everyone {announcement_text}")```
I have it set to the bot variable, now my only problem is that if I do ``await channel.send(f"@everyone {announcement_text}")`` it wou't work correctly because 'NoneType' object has no attribute 'send'
So get the channel object?
nvm... I fixed it
if bot.announcement_channel_set == "": -> if not bot.announcement_channel_set
Cogs have there own separate command error handler
You should just do them in there
!d discord.ext.commands.Cog.cog_command_error
await cog_command_error(ctx, error)```
A special method that is called whenever an error is dispatched inside this cog.
This is similar to [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") except only applying to the commands inside this cog.
This **must** be a coroutine.
You can use a global handler, but this will be every cogs errors
Sorry, I do not have the time right now
Maybe claim a help channel for the traceback module
As it's not directly related to discord bots
is there a fork of dpy that ppl have mostly jumped to?
People are starting to move to pycord/nextcord, though I've seen most people stay with DPY for now as it's fairly stable
yeah
discord is adding a few things tho that need support
uh, pycord?
oh, pycord/nextcord itself, gotcha
What else have they added recently btw?
besides slash commands
a few permission bits are coming to the platform
wait what is the difference between pycord/nextcord and nextcord/nextcord?
I can't find pycord...
.gh repo pycord/nextcord
Well there's a pycord/nextcord repo which is why it was confusing
Is Enhanced Discord.py any good? https://github.com/iDevision/enhanced-discord.py
I want to add it to my bot but I want to make sure that it's a good option.
Try out pycord, its the most similar to discord.py
https://github.com/Pycord-Development/pycord
GitHub
GitHub - Pycord-Development/pycord: Pycord, a maintained fork of di...
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - GitHub - Pycord-Development/pycord: Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API
Linux/macOS
python3 -m pip install -U py-cord
Windows
py -3 -m pip install -U py-cord
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - GitHub - Pycord-Development/pycord: Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API
!e ```py
def job(ctx):
print("gm")
schedule.every().day.at("01:24").do(job)
@junior terrace :warning: Your eval job has completed with return code 0.
[No output]
F
how do I get the bot to write to me after sending a command like another user sends a command and after that the bot writes to me that is by id
any is good
lol
on_guild_join?
@client.event
async def on_message_delete(message):
if message.guild:
b = DT.datetime.now().timestamp()
b = int(b)
with open("data.json") as f:
data = json.load(f)
if message.author.id == 503641822141349888:
return
if message.author.bot:
return
if len(message.content) < 1600:
time = datetime.now(tz=pytz.timezone('America/Tijuana'))
formatted = time.strftime("%I:%M %p")
msgtime = (time - message.created_at).total_seconds()
logchannel = client.get_channel(872911089258598421)
am = discord.AllowedMentions(
users=False,
roles=False,
everyone=False,
replied_user=False,
)
await logchannel.send(f'<t:{b}:t> Message by `{message.author}` `({message.author.id})` in {message.channel.mention} has been removed. ({round(msgtime, 2)} seconds after being sent) \n**Content**: {message.content}', allowed_mentions=am)
if len(message.content) > 1600:
time = datetime.now(tz=pytz.timezone('America/Tijuana'))
formatted = time.strftime("%I:%M %p")
msgtime = (time - message.created_at).total_seconds()
logchannel = client.get_channel(872911089258598421)
em = discord.Embed(
description=f'<t:{b}:t> Message by `{message.author}` `({message.author.id})` in {message.channel.mention} has been removed. ({round(msgtime, 2)} seconds after being sent) \n**Content**: {message.content}',
color=0x00a8ff)
await logchannel.send(embed=em)
else:
return``` How could I check if there was an image in the message that was deleted and how could I send the image?
it's just a regular coro decorated with either .event or .listen()
I want to interact with my server members using a bot so I made this command ```py
@client.event
async def on_ready():
print(f"Connected to {client.user}")
print("----------------------------------------------")
while True:
msg=input("Message: ")
await client.guilds[0].channels[-1].send(msg)
@client.event
async def on_message(message):
if message.channel.id==907782076219154474:
print(f"{message.author}: {message.content}")```
But since the loop is on, on_message event is not working. How can I make so that both the loop and on_message event work together
message.attachments
check the length, if it's bigger than 0, that means there was an image/video
It could also mean that any other attachement was attached, like a text file
So if message.attachments > 0?
yeah, and probably some others i can't think off the top of my head
no, you'll need to get the length of it using len()
message.attachments returns a list of attachment objects
or you can just do if message.attachments:
.
whichever makes more sense to you
if len(message.attachments) > 0 xD I think that'll work
okay, what's the problem?
this
it would, alternatively, you can also use if message.attachments:
oh my bad, didn't see the lil text at the bottom
:3
Ahh, okay! Thank you :)
asking for input() is blocking
yea
you'd have to do some messy stuff to make it not blocking, not really worth it
Then I just do ctx.send(f'{message.attachments}') to send it?
not necessarily, message.attachments is a list of discord.Attachment objects
not a string that you can send like normal
Isn't there a way so that I can put the input command in a function and run the function and on_message simultaneously
there are non-blocking ways to get console input, but you'd have to use some external libraries and i think it gets messy quite fast
😐
you could theoretically use threading for this
i tried but IDK how to put on_message in it
do you really need to send messages from console through your bot though?
I'm still super confused on how I can send the images even if it's a string :P
yes
iterate through message.attachments, you can send it that way
discord.Attachment objects have a url attribute, you might be able to do something with that
for m in message.attachments:
await ctx.send(f'{m.url}')``` Right?
you may also be interested in these 3 methods
yes, but m.url is already a string, no need to put it within an f-string
True okay, thank you!
My pleasure
What if I use requests to get the message
code: https://paste.pythondiscord.com/umizuquhux.py
full error: https://paste.pythondiscord.com/pawoqohudu.sql
not sure why i keep getting the error (using mongodb for the first time)
you could, but you'd need to have a server listening for it
perhaps running flask, or something else
hmm
Is it possible for someone to edit an attachment?
Just trying to figure out if I need the image thing for on_message_edit
How do people usually structure their discord bot projects? Specifically ones that use cogs would be good to see
can somone give me the right code for a client run token
@surreal current help this man
that was kinda rude
is that a thing?
bot.run("insert_client_token")
an attachment is an image/video/text file, you can't really edit it in the sense i assume you mean
i'm assuming that you're making a message logging system, where it logs deleted messages and edits?
Yeah
@slate swan It's not meant to be Rude @surreal current is the best man for the job
I would only send the best of the best
user.send('something')
member.send('something')
Basically whatever you define the member as.
you shouldn't define member/user yourself, you should be using other methods/attributes to getting it
perfect ty
on_guild_join(member):
await member.send('Welcome!')```
await it as send() is a coro
ye exactly

I need to do bot.event or bot.event() above it?
bot.event
ty
^^^
alt vibes
So I want to switch my current bot from discord.py to pycord, are there any significant things to be aware of like functions returning differently, different names, or stuff like that?
what?
This is no where near right?
Close enough, on_member_join(member): ig
He had the documents so he could've figured it out himself if he did try to yoink my code :D
You need to whitelist your IP.
i assume it's more psuedocode than anything
import requests
import json
import threading
channelid=907782076219154474
msgurl=f"https://discord.com/api/v8/channels/{channelid}/messages"
headers={'Authorization':'Bot TOKENHERE'}
r=requests.get(msgurl, headers=headers)
msg=json.loads(r.text)
print(msg['content'])```
gives error `list indices must be integers or slices not 'str'`
msg is a list
hmm
not a dict
:3
it's like doing
msg = [1, 2, 3, 4]
print(msg['content'])
so how can I call the value of content
Well you need to whitelist all of them.
all?
Yep.
access it like you would a list, i.e with integers between the []
allow access from anywhere?
it has text too
Yes.
wouldnt that make the db easy to hack 
you're getting the history of a channel, obviously it would be a list
No?
understood but instead, is there a way to convert list to dict??
Get the JSON instead of loading it
it really depends
ook
in your case you wouldn't want to do that
Done I just didpy print(msg[1]['content'])
Why are you trying to index a list by using a string
You only do that with dictionaries
can someone share me tutorial about classes?
w3school is doing some rocket explanation
thanks
I mean everyone learns differently, for me this guide helps but ik it's very literal https://www.tutorialspoint.com/python/python_classes_objects.htm
I would also recommend these
https://www.youtube.com/watch?v=8yjkWGRlUmY (pt1)
https://www.youtube.com/watch?v=wfcWRAxRVBA (pt 2)
just give me something that they explain a lot
instead of covering __init__ in one sentence
the pt1 is assuming you don't know what a class is in the first place
alright
helped me at least ¯_(ツ)_/¯
thank you
ah this helped me 4 months ago https://realpython.com/python3-object-oriented-programming/
I just pasted the same link oop
u all like realpython
¯_(ツ)_/¯
is there a way to take a message and generate a ctx for it?
like, a message the bot sent?
!d discord.ext.commands.Bot.get_context
await get_context(message, *, cls=<class 'discord.ext.commands.context.Context'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Returns the invocation context from the message.
This is a more low-level counter-part for [`process_commands()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.process_commands "discord.ext.commands.Bot.process_commands") to allow users more fine grained control over the processing.
The returned context is not guaranteed to be a valid invocation context, [`Context.valid`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context.valid "discord.ext.commands.Context.valid") must be checked to make sure it is. If the context is not valid then it is not a valid candidate to be invoked under [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
kk ty
How do I create a command for my bot the if i type =kill [target] it will send [author] killed [target].? with discord.Client()
Use the commands extension for discord.py for commands, dont use the discord.Client() and if you really wanted to do that you could use discord.Message.mentions cause it returns a list of mentions
!d discord.Message.mentions
A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.
Warning
The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.
How does one switch from discord.py to pycord? I have it installed with pip and that's about it.
pip install -U modulename

ye I already did that but what's after that? How do I change my code from d.py to pycord? All the imports and syntax looks identical.
import pycord as discord
is introduceSelf() also an object? or is it a method
you dont
https://github.com/Pycord-Development/pycord
GitHub
GitHub - Pycord-Development/pycord: Pycord, a maintained fork of di...
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - GitHub - Pycord-Development/pycord: Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API
Linux/macOS
python3 -m pip install -U py-cord
Windows
py -3 -m pip install -U py-cord
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - GitHub - Pycord-Development/pycord: Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API
It is a method that belongs to the class, robot.
what the
oo thanks
everything in python is an object
a method
idk i just found it
both I guess
method is a kind of object?
yes
with your current image it could be a method, or a class, or a function
you cant call classes
you can
;-;
if you have __call__ magic method
im getting more confused
How
object and method
thanks for the knowledge
object is variable and method is function?
what dont you understand
method is a function within a class
method is a function which belongs to an object, introduceSelf seems to be a class
class methods yes
introduceself is a method
classes are objects
method are functions of the object
alright im fked with this method and object thing
I method is a function which belongs to an object
what is an object
classes = object?
in python, everything is an object
discord.Member is an object
discord.Member.edit is a method
why am i here
hope it's quite clear now
oo
u do something to do object
Bruh
then its a method?
yeah kindof
hmmm ok
it's a function inside the object
Pain imagine not learning this before using dpy
function is a bunch of code that u dontn wanna repeat right?
!e
class Foo:
def hi():
pass
print(Foo.hi)
@visual island :white_check_mark: Your eval job has completed with return code 0.
<function Foo.hi at 0x7fcea9b74c10>
40% ppl asking for help here
99% 🤣
i guess you could put it that way but a function is a function
function is a function alright i get what u mean
but why is everything in python an object
=.=
its an object oriented language
everything is based on object base class
class Foo:
...
eqivalent to
class Foo(object):
...
also applied with every other classes
property is variable within classes?
No, a property is a method inside a class
it isnt a variable
it isnt a variable
I mean I guess you could call it that but it isn't
attributes are class methods but we call them attributes
hey I sent that
Python - Object Oriented, Python has been an object-oriented language since it existed. Because of this, creating and using classes and objects are downright easy. This chapter helps you
im reading this
but why htm
anyways it covers literally the basics of classes
where is the l
its file type
LOL ok
yeah but atleast try to learn the most basic things
im trying
You're Cool
objects may be confusing at start
imma learn basic first
before i continue to build bot
if not u guys gonna suffer
🤣 🤣 🤣
ok
Would anyone who has a bot with pycord using cogs help me through the process? I already have one in discord.py but I can't seem to get it right for some reason.
Sure
What seems to be the problem?
I mean my first issue is just my imports. This is what I had, and I tried a bunch of different methods of trying to import slash commands and it doesn't work, even the ones in the examples
I installed it already though
Ah pycord has slash commands but iirc theres a separate import for it im not sure
Might wanna ask in the support server for more questions.
Yeah these are my current imports
import discord
from discord import partial_emoji, reaction, user, emoji, Intents
from discord import Color as c
from discord.ext import tasks, commands
from discord.ext.commands import has_permissions, cooldown, BucketType, MissingPermissions
from discord.ext.commands import slash_command
from discord.ext.commands.core import check
from discord.ext.commands.errors import *
Okie
hm
can't you just do from discord import *
That’s actually terrible. Also pep8 no like wild card importing. Id recommend avoiding those as often as possible. Unless your doing init files.
Task exception was never retrieved
future: <Task finished name='Task-13' coro=<Music.start_nodes() done, defined at /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dismusic/music.py:22> exception=AttributeError("'Bot' object has no attribute 'lava_nodes'")>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dismusic/music.py", line 25, in start_nodes
for node in self.bot.lava_nodes:
AttributeError: 'Bot' object has no attribute 'lava_nodes'```
client.event
async def on_ready():
print("Successfully logged in as {0.user}".format(client))
game = discord.Game("better type >help")
await client.change_presence(status=discord.Status.idle, activity=game)
client.load_extension('dismusic')
bot.lava_nodes=[
{
'host':'lava.link',
'port':80,
'rest_uri':f'http://lava.link:80',
'identifier':'MAIN',
'password':'123456',
'region':'singapore'
}
]```
But it worked
working on a discord bot type of shit
so i want it to try and except indexerror
but im not making it a function so after except indexerror: do i write return? then it will rerun the process and try again
@ me when u reply thx
what
help me pls
with what
this
if you answer you get a lot of stack reputation because I knew user
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
anyone knows this error code
so you basically want to assign new value to a variable when the event is triggered
or what
Well the user has change there description I am just using an api
So i can't change it for them
but i wanna see if they changed it to res
im confused asf
could you explain what you're doing and whats not working
Yes sry
import robloxpy
import discord
from discord.ext import commands
@bot.command()
async def verify(message, user):
num = 10 # define the length of the string
res = ''.join(secrets.choice(string.ascii_letters + string.digits) for x in range(num))
user_id = robloxpy.User.External.GetID(str(user))
user_description = robloxpy.User.External.GetDescription(user_id)
if user_id == "User not found":
embed = discord.Embed(title="Verification", description=f"Could not find user {user} input a valid account")
await message.channel.send(embed=embed)
else:
photo = robloxpy.User.External.GetBust(user_id)
ver_embed = discord.Embed(title="Verification", description=f"Set {user}'s about me to `{str(res)}`")
ver_embed.set_thumbnail(url=photo)
await message.channel.send(embed=ver_embed)
print(user_description, res)
# The part that is not working
if user_description == str(res):
comp_embed = discord.Embed(title="Verified",
description=f"You have been verified with the Roblox user {user}")
comp_embed.set_thumbnail(url=photo)
await message.channel.send(embed=comp_embed)
The if user_description == str(res): is the part that's not working because user_descripition is not getting updated. How would I update it? The Pyblox library documentation: https://github.com/KristanSmout/RobloxPyOfficial
what I am trying to do is check if user_description == str(res)
guys can y'all help me in #help-potato its related to reactions
but I am getting the user description that from when command was ran but I want to see if they change to res
what do you want that variable to be updated with
have you made sure str(res) and user_description is same
looks like im still confused so i will just not waste more time and head out
Another person lost
explain what you're doing, what the function does before asking for help. it helps to direct you to the right way
#help-potato pls
a little help here how can i mute and unmute a player?
Well ok then.
Unmute a player?
I think you have to assign different roles
To the ones you wanna mute
A role that doesnt have perms to chatting
Not sure about the timing tho...
then how do i assign a role to a member? with my bot
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
get the member instance > add the role
ok
When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.
Instead of writing
def update_score():
global score, roll
score = score + roll
update_score()
do this instead
def update_score(score, roll):
return score + roll
score = update_score(score, roll)
For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.
read the command
read it
the issue is with your variable scope
if the if message.mentions[0]: block didn't run then user will be undefined
(a question to disnake)
with the documentation i cant find how to do it
how do i get the sender ?
i want to define the name of the sender in a string
first ill check if a specific word is in the message (if "word" in message.content)
and after i want to get the sender of the message
and the message id
how do i do this?
The documentation is on the github.
Whos the sender?
disnake.Message.author
!d discord.Message.author
use that then?
Ok
but how do i use it that i get the author who matches the if message.content?
!d discord.Message.author this
!d discord.Member message.author returns an instance of this
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").
x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
hash(x) Returns the member’s hash.
str(x) Returns the member’s name with the discriminator.
!d discord.User or this
class discord.User```
Represents a Discord user.
x == y Checks if two users are equal.
x != y Checks if two users are not equal.
hash(x) Return the user’s hash.
str(x) Returns the user’s name with discriminator.
why user
DMs 😐
what
🤨
I meant
i think hes taking about member
yeah
talking*
I know what you meant
if a members sends send a specific sentance or word the bot should get the author
and "sender" = this.message.author doesnt work
why dont it
idk
This ain't JS lol
its python
yea
Why do u have this.message 🤨
sry this.Message
this isnt JS OOP its python
nope disnake.Message
what
W H A T
this.Message.author
😐
burh
I won't say anything
u said this
I meant.... why did u say this.message
yes
what was that for
bc i want the author of the if
It's message.author, not this.message.author
But
dude
One problem guys
Just make nested if statement....?
first ill check if a specific word is in the message (if "word" in message.content)
and after i want to get the sender of the message
I also have a problem...
What is it
So
That u ain't sending your problem
Do multiple if statements like hunter said
!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.
Instead it is showing that there is an error there
U need members intent
Hm? Can I know what's the error?
?
what do u mean
with multiple statment
The bot doesn't has permissions to send messages
Bot needs permissions
Wrong message 😐
I mean that check the message content for something then use disnake.Message.author to get the author of the message
Pain
my bad
I feel your pain
It has perms
But I am the server owner
It's just sending messages on member joining
maybe the user joined some other server
lol yea , user -> joined a server -> member!
Not saying anything to u @night seal
Also please use the commands extension if you wanna make commands, dont use events for making commands
thanks
What's the railway thing 🤨 @ornate lichen
railway is a free hosting platform
Ah, okay
how can i do this with the bot? (the person type the command and the bot click on reply and type the code
don't explain yourself very well.... that's basically it
ctx.reply
is it possible to add inbuilt checks as global checks?
Wym
like adding bot_has_permissions as a global check
if i try that the code runs without any error , but the check does not get implemented
U tried bot.check?
Can I see how u did that?
yea , if i try making a custom check instead it works
Did you import those classes/functions from commands namespace or something?
nah py from disnake.ext.commands import Bot , when_mentioned_or , bot_has_permissions
Yea that's what I meant lol
BTW, why do u even wanna do it a bot check?
Its gonna raise a CheckFaliure error anyways
oh , not a BotMissingPermissions error?
mhm BotMissingPermissions comes under CheckFailture
!pypi disnake , a fork of discord.py
Nice
is https://discordpy.readthedocs.io/en/stable/api.html only for discord bots?
you can actually use it for your account
but almost everything about it is deprecated
and breaks the tos
Anything that you dont understand in dpy I guess
i mean for the basics
scoping, functions, asynchronous programming (asyncio), decorators, subclassing/inheritance (OOP), type-hinting
alright thanks
static void UpdatePresence()
{
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = "In an ender dragon fight";
discordPresence.details = "Where is my water bucket???";
discordPresence.largeImageText = "RPMinecraft";
discordPresence.smallImageText = "Rogue - Level 100";
discordPresence.partyId = "1";
discordPresence.partySize = 69;
discordPresence.partyMax = 420;
Discord_UpdatePresence(&discordPresence);
}
```how do i change this to python
this is javascript right?
It's either Java or CPP I can't tell.
since thats for games
def UpdatePresence():
DiscordRichPresence discordPresence
memset(&discordPresence, 0, sizeof(discordPresence))
discordPresence.state = "In an ender dragon fight"
discordPresence.details = "Where is my water bucket???"
discordPresence.largeImageText = "RPMinecraft"
discordPresence.smallImageText = "Rogue - Level 100"
discordPresence.partyId = "1"
discordPresence.partySize = 69
discordPresence.partyMax = 420
Discord_UpdatePresence(&discordPresence)
is this how i do it?
or nah
no wtf
idk how to change it
you dont just change stuff and expect it to work
What are you looking for
And you do realize some of this are gonna have syntax errors
RTD.
static void means function or what
Whats the error
Well if the interaction says that theres probably gonna be an error.
Do you have an error handler?
👍
Hm
A third party lib
Yea
I could, but I don't really know much about thirdy party libraries
async for guild in self.bot.fetch_guilds(limit=100):
guildmsg += f"**{counter}:** **Name:** {guild.name}\n **ID:** {guild.id}\n **Created at:** {guild.created_at.strftime('%b %d, %Y')}\n **Owner:** {guild.owner.name}```
guild.owner.name gives nonetype error. how can i get the guild owner name here?
member intents enabled?
Also you generally shouldn't use fetch_guilds
Assuming you have the guilds intent enabled (which is on by default) and this is after the bot is ready, use the guilds attribute of your bot
!d discord.Client.guilds
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
In cogs.
In main.
just use heroku or replit there are 100% free
Heroku and replit should not be used as bot hosts
It doesn't overuse resources depending most of the time
Depends on how much ram and memory your server has too
hey i need some help with mongodb ```py
@commands.command()
async def auc(self, ctx):
guildid = ctx.guild.id
userid = ctx.author.id
if collection.count_documents({"guildid": guildid}) == 0:
collection.insert_one({"guildid": guildid, "userid": userid, "points": 0})
points_count = collection.find_one({"guildid": guildid, "userid": userid, "points": 1})
for x in points_count:
before_points = points_count["points"]
new_points = before_points + 1
old_data = {"guildid": guildid, "userid": userid}
new_data = {"$set": {"points" : new_points}}
collection.update_one(old_data, new_data)
embed = discord.Embed(
description=f"**Thanks {ctx.author.mention} for conducting the auction!** \nYou are awarded with an extra point, your total auction point is: {new_points}"
)
await ctx.send(embed=embed)
await ctx.message.delete()
what is the best way to sync a github linked heroku repo to its original github repo?
Why does this not set a slowmode to channel? There is no any error messages and last ctx.send is sent but nothing channe in the channel```py
@commands.command(aliases=["sm", "smode", "slow"])
async def slowmode(self, ctx, *, duration: int):
"""Sets slowmode to current channel the commands is invoked, arguments taked as in seconds"""
await ctx.channel.edit(slowmode=duration)
await ctx.send(f"Slowmode set to {duration} second(s)")
Heroku is the worst way to host a Discord bot, and so is repl.it. Just use a hosting service. There are many free hosting services.
there are free ones?
which ones are free
Yes. I suggest https://somehost.xyz , it's really good.
Free and paid hosting
Self promotion lol
🤣😂
I repeat.
No doubt it's really good but it's really expensive
Tf's happening here 🤨
not even free 
Why does this not set a slowmode to channel? There is no any error messages and last ctx.send is sent but nothing change in the channel```py
@commands.command(aliases=["sm", "smode", "slow"])
async def slowmode(self, ctx, *, duration: int):
"""Sets slowmode to current channel the commands is invoked, arguments taked as in seconds"""
await ctx.channel.edit(slowmode=duration)
await ctx.send(f"Slowmode set to {duration} second(s)")
await ctx.channel.edit(slowmode_delay=duration)```
I see
It's slowmode_delay
Who said so?
its not free 
It is free
He asked if there are free ones, and I replied with that. Might be a Your English probelm.
Just that you will have to pay higher electricity bills
"Free and Paid"
😂
yeah i know u advertise it as free but when you click free hosting you are prompted to donate in your discord server
BRUH
You can donate.
or gain “points”
Yup gaining points is hard asf
it isnt free
That's why I left
Let's either continue that either in DMs, or just close the case.
lol
points.generate()
I give points for free, lmao.
no lmao
Gimme 70k
Yeah that's my point xD
nice scam boilerplate website @dapper cobalt 
🥺
someone saying heroku sucks
thats gonna trigger sherlock
heroku is good
LOL
It sucks fr but it doesn't suck more than repl lol
well it doesn't suck
true WHAHAHAHAHAHAHA
not for discord bots atleast
Heroku sucks a lot
for discord bots, it does
heroku better than this guys scam hosting service
But it's good cuz it's free

