#discord-bots
1 messages · Page 865 of 1
get works on bot's cache try fetch instead
client.fetch_channel?
yes
intents? both on dev portal and in your code ( inside commands.Bot too)
@bot.command()
async def help(ctx):
embed = discord.Embed(title = "📚 **Listes des commandes**", description = "Je suis un bot discord polyvalent qui fait de la modération et d'autres choses amusantes et utiles.\n\n **Modération : ** \n +ban , +unban, +mute, +unmute, +clear\n **Fun : **\n +meme, +blague, +poids, +disquette", color = 0x636161)
embed.set_author(name = "Maboulax", icon_url = "https://i.pinimg.com/236x/9b/09/5d/9b095de9260c33d3debdcb14d00c3b98--funny-monkey-pictures-funny-images.jpg", )
await ctx.send(embed = embed) ``` Hello, i want my embed look like the left embed, but he looks like the right embed, how can i fix this ? (in my code i remove ``` this ``` bc discord don't know this is code)
enable them
im an idiot
@vale sierra try doing `this` instead of ```this```. It'll look like:
this
this
ok
oh ok thx
👍
so i have to update it?
yeah install a new version at https://python.org/
i have 3.10.2 installed i think
oh
you need a second application then xD
once crashed then you need to do everything manually
check errors
it shows no errors
it randomly goes offline and automatically comes back online while my other bots doesnt
where are you hosting
i have a command profile
When ever i run it , this error comes up
Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'```
My code:
```py
@commands.command()
async def profile(self, ctx, member: nextcord.Member=None):
if member is None:
await ctx.send(f"{ctx.author.mention}, your profile picture is: {ctx.author.avatar_url}. \n\nLink: `{ctx.author.avatar_url}`")
else:
await ctx.send(f"{ctx.author.mention}, {member.name}'s profile is: {member.avatar_url}.")
Why does this happen ._. it also happens when i do ctx.guild.icon_url
winternode, and then tried to run it locally
use display_avatar.url
member.avatar.url in 2.0
both crashes every once in a while so it's not connection related
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.avatar "discord.User.avatar")
property icon: Optional[discord.asset.Asset]```
Returns the guild’s icon asset, if available.
oh ok so member.avatar.url
yea
and guild.icon.url
yessir
tysm
my check function doesnt seem to be working, its not printing anything in the console when i react, i cant seem to get it to work, any ideas why?
Idrk at this point. Try making an issue @ https://github.com/discord-py-ui/discord-ui/issues or you can join the support server and then ping them here https://github.com/discord-py-ui/discord-ui#contact
it just times out
show the whole error
code?
no, error, there should be more stuff below the ^
did you import asyncio?
no problem
show code
oke
async def info(ctx):
embed = discord.Embed(title=f"{ctx.guild.name}", description="more", timestamp=datetime.datetime.utcnow(), color=discord.Color.blue())
embed.add_field(name="Server created at", value=f"27.01.2022")
embed.add_field(name="Server Owner", value=f"NekoNeBitan")
embed.add_field(name="Server Region", value=f"USA")
await ctx.send(embed=embed)```
Error?
.
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.
ou
@bot.command()
async def info(ctx):
embed = discord.Embed(title=f"{ctx.guild.name}", description="more", timestamp=datetime.datetime.utcnow(), color=discord.Color.blue())
embed.add_field(name="Server created at", value=f"27.01.2022")
embed.add_field(name="Server Owner", value=f"NekoNeBitan")
embed.add_field(name="Server Region", value=f"USA")
await ctx.send(embed=embed)
now?
No
here
yes
or as the bot said
paste it here and send the link: https://paste.pythondiscord.com/
Hey @proper tartan!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
my Discord Bot has a glitchted image how can i fix this ?
what do you mean
it is completely green but that is not how it is supost to look like ( a piced a random image from my hard drive)
i dont know
hmmmm
remove the help command in your bot constructor
How can I do this in py? basically is if not 15+ members the bot leaves the guild
Ne radi se tako
bravooo srbin
just check the members inna guild and leave it lol
hvala kurcu
!rule 4
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
guys use english only
Pa vidim jebu te a i sami glupi
thats the problem lol
Thats ma brother
de reci kako da fiksam
Doesn't matter
Dm
!d discord.Guild.members
property members: List[discord.member.Member]```
A list of members that belong to this guild.
!d discord.Guild.leave
await leave()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Leaves the guild.
Note
You cannot leave the guild that you own, you must delete it instead via [`delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.delete "discord.Guild.delete").
there you go
thanks
np
Are you using replit?
no vsc
Strange
the problem?
/
you need to add pip to path so pls refer to the channels given
okay
Can someone point me to where in the python bot repo the bot parses and executes code passed with the !e command?
you want the source code?
!src eval
Run Python code and get the results.
nvm i read that wrong
that's what I was looking for. Thanks!
anyone out to help me ?
thats what this channel is for : )
just post a question and someone will help you out
okay so : )
my problem is i try to make a bot with custom gif and custom name and custom number and custom amount, and it does not work
what do you mean by custom gif, number and amount?
Guys i forgor python have something like "wait() (lua)"?
SWE
!d discord.ext.commands.Bot.wait_for | this?
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
Ye thanks
sweden
its not a python thing its a method of the bot object in the discord package
ok..
wut if i want to make all my guilds id in guild_ids is it going to work?(500+ guilds)
Ik
the global takes 1h :/
so
I don't know what difference like discord.py / nextcord.
Nextcord just changed name
pardon?
:l yk wut i mean, dont u?
not really
basically i want to append the client.guilds ids to guild_ids (slash command)
Ok
thats just inefficient
disnake
no
why add all your guilds ids in the kwarg when you can just wait 1h for global?
I'm a little confused, how did you-
spill the beans
👍
ah
Nextcord sounds cool
Is it able that the embeds edites itself and change the timestamp?
Like a clock
You know what I mean? It changes the time
u misunderstood me :P i want to do that cuz the "global" takes 1h
why append all the ids your bot can see to the kwarg? just wait an 1h?
just wait for 1 hour?
its not even 1h its an estimate
then alr
yeah that smh
oh didnt know dat 
?
he ment put all the ids of the guilds the bot can see to that kwarg so he doesnt need to wait
just wait 1h lol
No

It just shows the time when you runned the command
how do you get the guilds while defining test guilds....
It doesnt update it every minute
bad
yeah but thats not the case hes just trying to avoid the global time
I like nextcord and python
🗿
I used to use nextcord
but I’m using disnake for my final discord bot that I’ll ever make
I don't know why but my friend says that python slow s###
im new to disnake
i used to discord.py 1.7 v
its slower than most land because it was made with c but its probably a few micro seconds it doesnt even matter
compared to other languages, yes
doesnt really even matter
but it’s not that much slower
if you want speed then don’t use Python in the first place
a human can barely see the difference
hm
depends on what youre doing
Agreed, btw they use node js
👁️ 👁️
node?
idk maybe ms im not sure it depends on allot of things
bro ofc C is faster
C is like the base language lol
Python is not slow because it's made in C, it's slow because it's interpreted
You have many operating systems made in C, they aren't slow
yeah
btw andy wdym exactly by interpreted
and python is mostly used becaude its object oriented and a general language
hello
Yea, but where as C compiles to ASM or machine code python compiles to bytecode which is then read by the VM
if i have value inside a def how i call it out side
yeah
global it, and #python-discussion for such questions
hi, can someone help me on how I can run multiple bot tokens? I wanted to loop through a .txt file and every Bot does a certain task. Is that possible?
I tried a few things but they don't seem to work..
dont ever suggest global 😩
cloudfare would ratelimit your ip easily
I dont see any other options except classes
then classes it shall be

well you could.....but
depends on how and which value needs to be used from the function
@slate swan i fixed yesterday issue finally i will sleeeeeeeeeeeep
goodnight
Well yea, sort of. They gonna remove the GIL iirc
That's gonna speed up the programs which use CPU more (threading and multiprocessing)
They are getting rid of the GIL?
the what?
Is python 3.11 still gonna be thread safe if they get rid of the GIL?
whats the GIL
Idk it was something related to GIL, idk if they totally removing it or bringing huge changes to it
not thread safe python👁️ 👁️
I'm assuming they would be changing some stuff of the GIL
https://github.com/colesbury/nogil @pliant gulch
Removing it would make python not thread safe
Or unless they add another safe-guard
This is what they are doing iirc
Yea they doing this iirc
is there a way we can get the ids of all users in a specific role?
i.e if members have "police" role, bot will write these users id.
other python implementations don't have gil
Oh
!d discord.Role.members
property members: List[Member]```
Returns all the members with this role.
use list comp to get ids
why are you putting it in a list?, wait nvm
Because that's how I love it
dont change your status every 10 seconds have you not read the rate limits on changing presence?
no..
its a one time declared variable and Bot.guilds is 0 before the runtime
you gotta use some format shit
just put the list inside the function
its a dynamic ratelimit and you should change the presence every 3m or more
3 minute?
yeah that would probably be enough
but that much
yes
Gateway ratelimits are not dynamic its always 2/1s
then what ratelimits are dynamic im not quite sure what you refer by the gateways ratelimits, like whats the difference exactly?
HTTP requests have dynamic ratelimits; gateway commands, E.g change presence don't
you can send 120 commands to the gateway within a 60 second timeframe
That simplifies down to 2/1s for the gateway
Can you send text on top and below embed?
as a regular message?
yes
await ctx.send("top message")
await ctx.send(embed=embed)
await ctx.send("bottom message")```
make sure to make the embed!
("text", embed = embed, "text")
or you could do that way
That doesnt work
wdym
which?
the okimii
ok
how wouldnt that work
huh
Exactly
just send another msg lol
ah so the http request go to the gateway but they get compiled to the gateway? cant reallt understand what you said may i get a example of some sort?
HTTP Request => POST channels/id/messages Gateway command => {"op": 8, "d": {...}} (sent to the gateway via a connection)
ahhh makes sense thank you
andy 😳
binds .
moai binds🗿
lol
i finally fixed my database connectioj problem too
I kind of have an urge to make an SQL database with rust
Would unrust my rust skills
I've made a lexer and parser in C++ for my own programming lang before, just gotta port that to rust and make it follow SQL rules
then figure out storage
i have this idea for an app that i've had for a while
just never really started it.
i am thinking of doing it with c# or rust
How do I get the icon url of a user in discord.py
very funny🗿
its in the fucking docs you dumbass bot
lmao
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.avatar "discord.User.avatar")
😔
embed.set_author(name=bm, icon_url=str({member.avatar_url}))
I'm using it here and it doesn't work
Thats some... weird syntax you're writing there
icon_url=member.avatar_url
^ lmao
I mean, it's valid, but odd
yea ik im not good at all
@pliant gulch ||would you be interested in making this app idea with me eventually?||
I'll open my DMs send me your idea
shows this still
File "C:\Users\llVll\Desktop\TMG SB\main.py", line 126, in <module>
bot.load_extension(f'cogs.{filename[:-3]}')
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.commands' raised an error: TypeError: decorator() got an unexpected keyword argument 'name'
PS C:\Users\llVll\Desktop\TMG SB> ``` ```py
@commands.command()
async def help(self, ctx):
await ctx.message.delete()
await ctx.send("``ini\n[utils] utilities\n[fun] fun stuff\n\n[TMG - MIDVITE]``", delete_after=8)```
Code?
can someone tell me why this doesn't work
Can you send your whole cogs/commands.py?
@sotw.command()
@commands.has_permissions(administrator=True)
async def kick(ctx, member : discord.Member, *, reason=None):
id = member.id
bm = sotw.get_user(id)
if reason == None:
reason = 'Unspecified'
embed = discord.Embed(
description = 'Reason: **'+reason+"**",
footer = f'Moderator: {ctx.author}',
colour = discord.Colour.red()
)
embed.set_author(name=bm, icon_url={member.avatar_url})
how do I install an older version of dpy?
Use avatar.url
What dpy version are you using?
Also those { are useless
import discord, pyfiglet, requests, io, aiohttp, warnings, colorama
from discord.ext import commands as commands
import random
import sys
from colorama import Fore
from pyfiglet import Figlet
import os
import requests
from http.client import HTTPException
class commands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def help(self, ctx):
await ctx.message.delete()
await ctx.send("``ini\n[utils] utilities\n[fun] fun stuff\n[nsfw] self explanitory\n\n[TMG - MIDVITE]``", delete_after=8)
@commands.command()
async def utils(self, ctx):
await ctx.message.delete()
await ctx.send("``ini\n[cl] clears messages\n[ascii] (message)\n\n[TMG - MIDVITE]``", delete_after=8)
def setup(bot):
bot.add_cog(commands(bot))
```
not even sure, how do I check
how do I install an old version of dpy???
that doesn't work
First remove the squiggly brackets
pip install discord.py==<version>
Then do print(discord.__version__)
done
i sent my cogs
Class names should be written in PascalCase
1.7.3
Also you cannot name your cog commands
Commands?
Sure
Can you run it again and send the full traceback?
what's traceback? 
!traceback
Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.
A full traceback could look like:
Traceback (most recent call last):
File "my_file.py", line 5, in <module>
add_three("6")
File "my_file.py", line 2, in add_three
a = num + 3
TypeError: can only concatenate str (not "int") to str
If the traceback is long, use our pastebin.
@bot.command()
async def check(ctx,guildid = None):
mmembers = []
chars = [" ","Q","q","W","w","E","e","R","r","T","t","Y","y","U","u","I","i","O","o","P","p","A","a","S","s","D","d","F","f","G","g","H","h","J","j","K","k","L","l","Z","z","X","x","C","c","V","v","B","b","N","n","M","m","1","2","3","4","5","6","7","8","9","0","-","/",":",";","(",")","$","&","@","«",",",".",",","?","!","’","[","]","{","}","#","%","^","*","+","=","_","|","~","<",">","€","£","¥","•",".",",","?","!","’"]
if guildid is None:
guild = ctx.guild
else:
guild = bot.get_guild(int(guildid))
for member in guild.members:
for letter in member.display_name:
if letter not in chars:
if str(member.id) not in mmembers:
mmembers.append(str(member.id))
print(mmembers)
if len(mmembers) > 100:
channel = bot.get_channel(943252762584547331)
new_list = (",".join(mmembers))
await channel.send(f'``{new_list}``')
mmembers.clear()
if len(mmembers) > 0:
channel = bot.get_channel(943252762584547331)
new_list2 = ("\n".join(mmembers))
await channel.send(f'``{new_list2}``')
mmembers.clear()``` this doesnt work for some chars tho, is there a way to just get all normal chars, punctionary and lowercase/uppercase and numbers?
You know string exists right?
!d string
Source code: Lib/string.py
thats what im here for
class Commands(commands.Cog):
def __init__(self, bot):
self.bot = bot```
so like that?
@final iron how would I check the name for chars?
🤷♂️
Yeah
do i got to change anything else?
Shouldn't
for some reason I can't copy it so ss will have to do
Take 1 screenshot
This is impossible to read
its on replit it appears in small blocks like that 😭
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\llVll\Desktop\TMG SB\main.py", line 119, in on_ready
bot.load_extension("cogs.commands")
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.commands' raised an error: TypeError: decorator() got an unexpected keyword argument 'name'
still errored with that
these arent errors
You're still loading commands
they are flask logging
there are no errors
So is everything working?
at least not when I run it
oooh
yes, there are none
there are when I use the command
Send the traceback
when you use the command what happens?
Traceback (most recent call last):
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\llVll\Desktop\TMG SB\main.py", line 119, in on_ready
bot.load_extension("cogs.Commands")
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 676, in load_extension
raise errors.ExtensionNotFound(name)
discord.ext.commands.errors.ExtensionNotFound: Extension 'cogs.Commands' could not be loaded.```
@bot.command()
async def check1(ctx,guildid = None):
mmembers = []
if guildid is None:
guild = ctx.guild
else:
guild = bot.get_guild(int(guildid))
for member in guild.members:
for letter in member.display_name:
if letter not in string.ascii_letters or string.digits or string.punctuation:
if str(member.id) not in mmembers:
mmembers.append(str(member.id))
print(mmembers)
if len(mmembers) > 100:
channel = bot.get_channel(943252762584547331)
new_list = (",".join(mmembers))
await channel.send(f'``{new_list}``')
mmembers.clear()
if len(mmembers) > 0:
channel = bot.get_channel(943252762584547331)
new_list2 = ("\n".join(mmembers))
await channel.send(f'``{new_list2}``')
mmembers.clear()```
so I tried this, but it doesnt seem to work. It returns all members...
@final iron any idea?
why is this still erroring?
idk what I did but it worked tysm all of you lmao
this isnt updating the db https://paste.pythondiscord.com/ojulowizuh
Can I see your file structure?
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\llVll\Desktop\TMG SB\main.py", line 119, in on_ready
bot.load_extension("cogs.commands")
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.commands' raised an error: TypeError: decorator() got an unexpected keyword argument 'name'
Is your filename commands?
Yeah change that
to?
Whatever you want
i want to make a give command and it removes the money from the first person, but doesnt add it to the second person
thanks man
Is it working?
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\llVll\Desktop\TMG SB\main.py", line 119, in on_ready
bot.load_extension("cogs.maincommands")
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.maincommands' raised an error: TypeError: decorator() got an unexpected keyword argument 'name'
Can you send your entire maincommandsfile?
import discord, pyfiglet, requests, io, aiohttp, warnings, colorama
from discord.ext import commands as commands
import random
import sys
from colorama import Fore
from pyfiglet import Figlet
import os
import requests
from http.client import HTTPException
#<--------------Commands Start-------------->
class Commands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def help(self, ctx):
await ctx.message.delete()
await ctx.send("``ini\n[utils] utilities\n[fun] fun stuff\n[nsfw] self explanitory\n\n[TMG - MIDVITE]``", delete_after=8)
@commands.command()
async def utils(self, ctx):
await ctx.message.delete()
await ctx.send("``ini\n[cl] clears messages\n[ascii] (message)\n\n[TMG - MIDVITE]``", delete_after=8)
#<--------------Commands End-------------->
def setup(bot):
bot.add_cog(commands(bot))
```
i think the problem has to do with the str(user.id), but im not sure exactly what it is
from discord.ext import commands as commands
wut
You're still adding commands
ok i removed as commands
def setup(bot):
bot.add_cog(commands(bot))
can someone help me with this tho? there is no traceback
It should be your class name
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\llVll\Desktop\TMG SB\main.py", line 119, in on_ready
bot.load_extension("cogs.maincommands")
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.maincommands' raised an error: TypeError: decorator() got an unexpected keyword argument 'name'
i put it as my class name but this error is still here
When you sent your entire file did you send absolutely all of it?
Don't leave anything out
maincommands
import discord, pyfiglet, requests, io, aiohttp, warnings, colorama
from discord.ext import commands
import random
import sys
from colorama import Fore
from pyfiglet import Figlet
import os
import requests
from http.client import HTTPException
#<--------------Commands Start-------------->
class Commands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def help(self, ctx):
await ctx.message.delete()
await ctx.send("``ini\n[utils] utilities\n[fun] fun stuff\n[nsfw] self explanitory\n\n[TMG - MIDVITE]``", delete_after=8)
@commands.command()
async def utils(self, ctx):
await ctx.message.delete()
await ctx.send("``ini\n[cl] clears messages\n[ascii] (message)\n\n[TMG - MIDVITE]``", delete_after=8)
def setup(bot):
bot.add_cog(Commands(bot))
```
3
tbh idk them
that's everything apart from just a few commands left out
No
Send everything
Absolutely everything
Leaving shit out is wasting both of our time
ill dm u a pastebin of it?
No
since its too big
!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.
@commands.command()(name="id")
See how much quicker this would have been if you just sent the entire file?
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\llVll\Desktop\TMG SB\main.py", line 119, in on_ready
bot.load_extension("cogs.maincommands")
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.maincommands' raised an error: TypeError: decorator() got an unexpected keyword argument 'aliases'
``` changed it but same error
@commands.command()(aliases=["clear"])
oh ok
mhm
could anyone help me with buttons i am using discord.py
Don't ask to ask, just ask
Most people will be more inclined to help if they know what your question is immediately
what is the most efficient and easiest way to make it so if a user clicks a button it's disabled for only them
using discord.py
I don't think that's a thing you can do
You could try doing stuff with ephemeral messages
unlike some people think, python code is compiled. __pycache__ is where those compiled bytecodes go
oh ok
its compiled but the compiler doesn't check for code validity
as long as you have correct syntax, the code will compile and will run through the interpreter
so you can do some weird ass shit with python
#esoteric-python 👁️ 👁️
0_0
bro🗿
Hey is anyone around I'm trying command my bot to a specific message channel and It's not working in my current code
mongo
can't click anymore
Need a pro's help over here DM me when your able
Here fine as well
@bot.command()
@commands.has_permissions(administrator=True)
async def flood(ctx, number, amount):
channel = bot.get_channel(946972661001650278)

Its to send an announcement to another room
Weird name and args just to send an announcement
i have the other part of the code disclosed
ye i sent it there too, wasnt sure where the problem is 😂
@bot.command()
@commands.bot_has_permissions(administrator=True)
async def green(ctx):
await ctx.message.delete()
await asyncio.sleep(1)
embed=discord.Embed(description="Condition Green Server Status", color=0x339933, timestamp=datetime.utcnow())
embed.set_footer(text=f"{ctx.author.name}#{ctx.author.discriminator}",icon_url=ctx.author.avatar_url )
await ctx.send(embed=embed)
say i want this to go to a certain channel how would i make it possible
Syntax errors
`
ignore my bottem part
thats just after i pruned out that shitty code
Its a scammer research bot
mhm
yo, how do I get member with on_raw_reaction_remove, payload.member returns None
Fetch the member
discord.on_raw_reaction_remove(payload)```
Called when a message has a reaction removed. Unlike [`on_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_remove "discord.on_reaction_remove"), this is called regardless of the state of the internal message cache.
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
Its to warn people when we're sending out calls
Yeah sure
what do I fetch off it tho,
iirc it gives you a guild id and a user id
mhm
with what
We call flood scammers
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
@bot.command()
@commands.bot_has_permissions(administrator=True)
async def green(ctx):
await ctx.message.delete()
await asyncio.sleep(1)
embed=discord.Embed(description="Condition Green Server Status", color=0x339933, timestamp=datetime.utcnow())
embed.set_footer(text=f"{ctx.author.name}#{ctx.author.discriminator}",icon_url=ctx.author.avatar_url )
await ctx.send(embed=embed)
!d discord.ext.commands.Bot.get_guild
get_guild(id, /)```
Returns a guild with the given ID.
This isnt malious also we do it to scammers
Then you can
Still malicious
How to send a normal file to another folder then commanded in
Dude i shut down scammers
fetch_member(payload)? like
bot.get_guild(payload.guild_id).fetch_member(payload.user_id)
🥄
Not even a scam baiter saving people
Message @novel apex if you disagree with our conclusion
Believe me i'm no hacker I just program pbx clouds and tech
No i respect it
No worry's guys
T-dos scammers
wow nothing wrong with that
The issue with writing code that floods scammers server is that it can easily be used against anyone
Not flooding servers
Theres no way of knowing what/who the code will be used against
😭
guild = bot.get_guild(payload.guild_id)
user = await guild.fetch_member(payload.user_id)
```
all I needed was the payload.user_id
why do you take it all out of context
My method does the same thing as yours except in 1 line
THats to steal ppls info
i dont want that shit
I dont do illegal or malicous stuff to anyone but scammers off discord. I was just apart of this group asking to make a simple announcement bot
Hope ya'll get scammed
Suggest more topics here!
yeah I knopw, you can write code like that? tf
I don't see why you can't
bot.get_guild returns a guild object
So you can use all the methods on it
How can i set the channel Announcement to true / false
what do yall think the best and the worst forks of dpy are?
DISNAKE BEST
In my opinion Disnake is the best and pycord is the worst
pycord worst
best disnake worst nextcord
but the non forks are better than the forks
non fork is discontinued sadly
?
he means non forks like rin and hikari
hikari, pincer, rin
ohh
i never used them
i like discord.py api so i went with disnake
sir 💀
I'm trying to make the current time appear there in the footer but epoch time isn't working and I'm out of options
!d datetime.datetime.utcnow
classmethod datetime.utcnow()```
Return the current UTC date and time, with [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.datetime.tzinfo "datetime.datetime.tzinfo") `None`.
This is like [`now()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.now "datetime.datetime.now"), but returns the current UTC date and time, as a naive [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") object. An aware current UTC datetime can be obtained by calling `datetime.now(timezone.utc)`. See also [`now()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.now "datetime.datetime.now").
Warning
Because naive `datetime` objects are treated by many `datetime` methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the current time in UTC is by calling `datetime.now(timezone.utc)`.
have you tried https://www.google.com
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
(joking)
can i see the code @swift acorn
Hey @swift acorn!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com

Lol
@sotw.command()
@commands.has_permissions(administrator=True)
async def kick(ctx, member : discord.Member, *, reason=None):
bid = member.id
mid = ctx.author.id
bm = sotw.get_user(bid)
mod = sotw.get_user(mid)
if reason == None:
reason = 'Unspecified'
embed = discord.Embed(
description = '**Reason: **'+reason+f"""**
Moderator:** {ctx.author.mention}""",
colour = discord.Colour.red()
)
embed.set_author(name=str(bm)+' has been kicked', icon_url=member.avatar_url)
cet = ctime()
embed.set_footer(text='User ID: '+str(bid)+' • Time: '+str(cet)+' UTC')
try:
await member.send('Goodbye, thanks for participating in the SOTW. 👋')
except:
print("Couldn't dm user, command executed with exception.")
await ctx.send(embed=embed)
await member.kick(reason=reason)
not working
<Code>AccessDenied</Code>
<Message>Access denied.</Message>
<Details>Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object.</Details>
</Error>```
send it in codescript
you still need help?
No
You're not allowed to give help per rule 5
We've gone over this
Wait you're using a message logger lmao
🗿
You currently are lmao
but i dont use betterdiscord anymore lol
what is malicious?
Flooding
ah
Why does the bot show the wrong member status? (there are intents)
What do you mean?
how would i customize this error command to say that the bot is missing permissions?
the bot shows the wrong status of the participants, like it is online, but it shows offline
@final iron
!d discord.Member.status
property status: discord.enums.Status```
The member’s overall status. If the value is unknown, then it will be a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") instead.
timestamp = ctx.message.created_at
add it in discord.Embed()
That'll come in footer?
ye
Oh damn it was that simple
you can use that or use the timestamp kwarg and use a datetime obj
@slate swan HELP ME
what are you trying to do?
Does the bot have access and send message permissions in the channel you are sending to?
Also, that is a long python file
use cogs lol
ik
im too lazy to rewite the bot :/
no it doesnt
weirdchamp
¯\_(ツ)_/¯
it took the id from database :P
when i tryd to pip install wavelink:
error: all wavelink ': The system does not find the specified file.
im not sure why it would raise an error by your intellisense
Can you show the full error output?
Fatal error in launcher: Unable to create process using '"C:\Users\AppData\Local\Programs\Python\Python39\python.exe" "C:\Users\AppData\Local\Programs\Python\Python39\Scripts\ pip.exe" install wavelink': The system does not find the specified file.
can you easily use a postgres database from a cog?
does it get updated everytime something happens there?
meaning of the question:
does the main file pass database updates to the cog if the database is saved into a bot variable?
wait lemme give you some code if you can answer it then
import disnake
from disnake.ext import commands
import os
import asyncpg
bot = commands.Bot(command_prefix="!", intents=disnake.Intents.all(), help_command=None)
DB_SETTINGS = {
#yeah no
}
bot.db = bot.loop.run_until_complete(asyncpg.create_pool(**DB_SETTINGS, ssl='require'))
for extension in os.listdir("cogs"):
if extension.startswith("cog"):
bot.load_extension(f"cogs.{extension[:-3]}")
print(f"Loaded {extension[:-3]}")
bot.run("yeah no")
I don't think so
it's not about the database rn
why not subclass the bot class🗿
don't like to complicate it
smh
Understandable
now how do I compare postgres date to datetime.date.today() 
Use timestamp
no
🗿
I don't want no hours
wdym
I just need a day
and everyone in the server is Hungarian
no different timezones
<Record birthday=datetime.date(2004, 2, 27)>
I have to get the date out of this and turn it to
2022-02-27
-years
this will be weird
wait I'm dumb, it's because of the years
"SELECT id FROM users WHERE birthday = $1", datetime.date.today() this no work cuz of the years
I'm gonna go back to #databases before someone yells at me
<t:1644901200:d>
This good or are you just completely opposed to timestamps?
completely opposed to timestamps
aight I guess
Don't use json
It's not a database
ik is a file lol
but how can i return 2 prefixes? + my bot doesn't load that much data
json should be fine for now
It's still json
pretty sure json is fine in a small amount of data
anyways how can i return 2 diff prefixes?
No
JSON is just simply not a database
Doesn't matter the amount of data, it just isn't a database
It's meant for formatting data
can i just get some help returning 2 diff prefixes?
Not with json
i gotchu but pls 
can i make another def for self prefix?
and load it like
command_prefix=get_prefix, self_get_prefix
Don't think so
then how am i able to return 2 prefixes
🤷♂️
Google it , check the vid with channel called swas.py or code with swas
why would you need two prefixes?
Class names should be in PascalCase and function names should be in snake_case
camelCase should never be used in python
I dont care thats all you mention
prefix + self prefix per author
your object is None
It doesnt help
what??
variable names should also be written in snake_case
like the bot can have a certain prefix per the bot
How
He wants each guild to have a different prefix
but authors can have a different one
yeah use a database
let's say the guild has . but the member wants ,
Just use a database
then both should work
no that’s not how it works
BRO MY ISSUE IS LOADING THE PREFIX
Oh
^
Don't use json 🤷♂️
Accept frq and I’ll help
Finally something you said that is helpful
Json gets corrupted so easily
What I said to you was also helpful
And is not considered a db

Just a suggestion
Use a database, in your prefix function use a query that fetches the prefix for that guild and you can used when_mentioned_or I believe it is
such as:
def get_prefix(self, bot, message) -> str:
prefix = self.db.field('''SELECT prefix FROM guilds WHERE guild_id = $1''', message.guild.id)
return when_mentioned_or(prefix)(bot, message)
@final iron can you really help with my problem though
I will when you fix your naming
Is there a reason to save data to a database vs a file?
databases are better than txt files
Thatll take hours so no
You mean a txt file?
Then have fun
Ye
Why’s that?
databases can specify relationships between data
Ok anyways dont need help from a guy who acts like a child for something that doesnt affect the code
txt files are simply not databases. They don't have all the features databases have to offer and they are a lot harder to get data from
and its more organized
??
😆
your python code should follow pep8.
Not even gonna ask what his problem is lol
It doesnt affect outcome
it doesn't matter. thats how python is supposed to be written
But it affects readability
Dont care
what is your issue anyways?
How does it affect readability
Sounds like pretty much everyone if u ask me lol
How do people who code in other languages like dart, read dart?
what the fuck is this code
Because people follow the dart code style
Will say tho, sometimes smth like black is more applicable
there is a lot wrong with this code
__init__ doesn't take ctx
interactions use Interaction not ctx iirc
I passed ctx myself for a reason
interaction replaces ctx
This code is completely unreadable smh
legit
class HelpView(nextcord.ui.View):
def __init__(self, help_cmd: "HelpCommand", options: list[nextcord.SelectOption], *, timeout: Optional[float] = 120.0):
super().__init__(timeout=timeout)
self.add_item(HelpDropdown(help_cmd, options))
self._help_cmd = help_cmd
async def on_timeout(self):
self.clear_items()
await self._help_cmd.response.edit(view=self)
async def interaction_check(self, interaction: nextcord.Interaction) -> bool:
return self._help_cmd.context.author == interaction.user
compare this old view of mine, to that
idk whats the point of self.children[0], etc
Can't you just use | instead of optional?
i would try to refactor this code
There is a difference between pycord and nextcord
self.children[0].style = discord.ButtonStyle.green
self.children[1].style = discord.ButtonStyle.green
self.children[2].style = discord.ButtonStyle.green
self.children[0].disabled = True
self.children[1].disabled = True
self.children[2].disabled = True
this was a while ago, before you could do some_type | other_type
When was | released?
plus Optional[some_type] is the same as Union[some_type, None]
3.10?
Oh I gotta talk to okimii then
He changed Optional[] to | so it will break our package's backward compatibility
just say "txt files do not have cross platform support and are hard to transport from one device to another"
i might be wrong though
I give up you guys judging my code instead of helping
!pep 604
chief 😂
yeah it was 3.10
Yeah I got to talk to okimii
Nice
Refactor your file to follow pep8 and I'll help
Fix the class/function/variable naming at least
!pep 69
PEP 69 does not exist.
pep8 🙏
21 years ago 😭
Okie
@final iron
I finished
Class names should be in PascalCase not snake_case and there should be 1 new line after each function
Okay
Your indentation is also completely out of wack but I'll let it slide
Thats cause I copy and pasted
Im done tho
self.first_user = firstUser
self.second_user = secondUser
self.first_choice = firstChoice
Still using camelCase here
You can just do find and replace
How
Alright send your full traceback then
But im on mobile replit
It doesnt allow copy
Bad quality
async def get_prefix(bot, message):
author = message.author.id
guild = message.guild.id
try:
with open(prefix_path, "r")as f:
prefixes = json.load(f)
except FileNotFoundError:
prefixes = {}
try:
with open(self_prefix_path, "r")as f:
self_prefixes = json.load(f)
except FileNotFoundError:
self_prefixes = {}
if str(guild) not in prefixes:
return commands.when_mentioned_or(".")(bot, message)
elif str(guild) in prefixes:
return commands.when_mentioned_or(*prefixes.get(str(message.guild.id)))(bot, message)
elif str(author) in self_prefixes:
return commands.when_mentioned_or(*prefixes.get(str(message.author.id)))(bot, message)
else:
return commands.when_mentioned_or(".")(bot, message)
angel = slash_util.Bot(
command_prefix=get_prefix,
intents=discord.Intents.all(),
case_insensitive = True,
help_command=None
)
wait
@final iron how should I send traceback
ik the issue nvm
async def get_prefix(bot, message):
author = message.author.id
guild = message.guild.id
try:
with open(prefix_path, "r")as f:
prefixes = json.load(f)
except FileNotFoundError:
prefixes = {}
try:
with open(self_prefix_path, "r")as f:
self_prefixes = json.load(f)
except FileNotFoundError:
self_prefixes = {}
if str(guild) not in prefixes:
return commands.when_mentioned_or(".")(bot, message)
elif str(guild) in prefixes:
return commands.when_mentioned_or(*prefixes.get(str(message.guild.id)))(bot, message)
if str(author) in self_prefixes:
return commands.when_mentioned_or(*self_prefixes.get(str(message.author.id)))(bot, message)
else:
return commands.when_mentioned_or(".")(bot, message)
angel = slash_util.Bot(
command_prefix=get_prefix,
intents=discord.Intents.all(),
case_insensitive = True,
help_command=None
)
why the self prefix still not loading?
about?
^
ok
Why are you on an alt?
that's not my question
But it's my question
imma join with main acc
such a huge difference
what is slash_util.Bot
right?
@final iron
is like normal bot commands but better
pascalCase*
You never answered my question
u can include / commands
No
you mean slash commands?
thats camelCasing
i thought they were the same
normal commands work too
oh well
you're getting me really damn confused
camelCase
PascalCase
snake_case
his name says it all
where do you use camelCase
enum
so what in python should be camelCase then
why the heck
^
In python? Never
so why tf is the self prefix not loaaadinggg????
camelCase should never be using in python
@final iron why you not helping
Wdym
^
Cause pep8 is my main priority
!e
a = None
print(a.strip(" "))
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | AttributeError: 'NoneType' object has no attribute 'strip'
@slate swan how is it none
!e
from __future__ import braces
@final iron :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | SyntaxError: not a chance
@slate swan 
idk i cant see the code
Let me type
what is that syntax error
🗿
💀
await interaction.followup.send("nothing", embed = embed, view = None)
Thats where error is
no it wasnt lol
Wdym
it raised an error on a is_finished attr
Also this
async def get_prefix(bot, message):
author = message.author.id
guild = message.guild.id
try:
with open(prefix_path, "r")as f:
prefixes = json.load(f)
except FileNotFoundError:
prefixes = {}
try:
with open(self_prefix_path, "r")as f:
self_prefixes = json.load(f)
except FileNotFoundError:
self_prefixes = {}
if str(guild) not in prefixes:
return commands.when_mentioned_or(".")(bot, message)
elif str(guild) in prefixes:
return commands.when_mentioned_or(*prefixes.get(str(guild)))(bot, message)
if str(author) not in self_prefixes:
return commands.when_mentioned_or(".")(bot, message)
elif str(author) in self_prefixes:
return commands.when_mentioned_or(*self_prefixes.get(str(author)))(bot, message)
angel = slash_util.Bot(
command_prefix=get_prefix,
intents=discord.Intents.all(),
case_insensitive = True,
help_command=None
)
Wdym
bro the attr error says it
Help ^^ self prefixes not loading
Don't use json, it's simply not a database
this man
dont start again
"why are u using json"
this has happened before.
"why are u on a alt"
guys
dont start this shit again
bro that's none of your business so STOP
3ban can you stop?
my question was pretty simple.. why the self prefix won't load
Well pep8 got a point
ok jeez ignore
Json is dumb
im not doing anything
You sure you want to start again? You were banned last time this happened
Json should be deleted
No
ok everyone arguing about the stupid shit about json, shut up.
JSON is incredibly useful for formatting
none of ur business
All youtube videos that use json as storage should be deleted
this is not the channel for arguing and rather a channel for discord bots
both of you stop or ill call a a moderator.
im just trying to load my self prefix lol
Alright guys calm it down
async def get_prefix(bot, message):
author = message.author.id
guild = message.guild.id
try:
with open(prefix_path, "r")as f:
prefixes = json.load(f)
except FileNotFoundError:
prefixes = {}
try:
with open(self_prefix_path, "r")as f:
self_prefixes = json.load(f)
except FileNotFoundError:
self_prefixes = {}
if str(guild) not in prefixes:
return commands.when_mentioned_or(".")(bot, message)
elif str(guild) in prefixes:
return commands.when_mentioned_or(*prefixes.get(str(guild)))(bot, message)
if str(author) not in self_prefixes:
return commands.when_mentioned_or(".")(bot, message)
elif str(author) in self_prefixes:
return commands.when_mentioned_or(*self_prefixes.get(str(author)))(bot, message)
angel = slash_util.Bot(
command_prefix=get_prefix,
intents=discord.Intents.all(),
case_insensitive = True,
help_command=None
)
self prefix won't load
I'm guessing it's getting a FileNotFoundError
the path for prefix file work
Also open() is blocking, use aiofiles instead
what's the difference between prefix_path and self_prefix_path?
yeah, but I'm not sure what the difference is between those 2 files
I believe prefixes is the servers prefix and self prefixes is just a separate user prefix
- {author id : prefix}
Yeah I thought so
thanks god
came in clutch
i honestly don't know how you will pull off prefixes for a certain user
It’s hard but it’s possible
i just can't load the 2nd prefix
You just have to return it on get_prefix
pulling a custom prefix for each user in a db
^
Yeah ik
They're using JSON so i don't think they're worried about stability or performance
there is really no point to do so. what benefit does it bring?
lmao frrr
No benefit I don’t think I just think it’s easier for some people yk
im not sure how lol
at one point you're going to have to make up some insane prefixes because it's gonna be taken by others
but its extra work that isn't needed
Robin i don't wanna start this gain and i don't wanna get banned again BUT
- My bot already replies faster than many bots around discord (including antinuke)
- pretty sure json is fine for a small amount of data
I don't think it's the most user intuitive thing but if you really want to go ahead
just use a prefix with 2 elements lol
like how do you deal with two users having the same prefix
Maybe some people don’t have that key for the server prefix so they use a custom user prefix like damn how y’all so brain dead?
bro what? 😂
fr
oh shit i said something controversial
wtf is happening
@dry kelp to answer your original question, add a print statement to the except that way we can narrow it down to a pathing issue
really cant compare bots to yours lol
Bro ur not a programmer get it out ur bio if u don’t know what the reason is for a user prefix
depends on internet cache and much else
pretty sure i can girl
JSON is never fine for storing any data no matter the size
nope
do u know what my bot does?
???
TELL ME DO U KNOW WHAT IT DOES
Use json as a database?
fucking dumbass talking shit
guys please
?
ok this turned around quick;y
“14 year old programmer”
keep it down
bro what
small amount of data... does it look like i load a lot of data?
some of y'all are just a pain bruh
now bros attacking me for wondering about user prefixes💀
