#discord-bots
1 messages · Page 548 of 1
oh really?
haven't used dpy in months, closing an year
i've forgotten that tbh
.split("#")
pretty sure member returns it as username#discriminator
you're doing split before the for loop, so you're splitting a list
not a single member's name
also not sure why you're trying to use name#discriminator
that's like a very inefficient way of going about it
just check the member ID
i reccomend to not use username/discriminator at all
so your typehinting will get the list of users, enter the for loop, for every user get their ID and look it up in the guild.bans
or not even guild.bans, use guild.fetch_ban(id)
^
name and discriminator are subject to change at anytime
the id never changes
use the id instead 👍
@bot.command()
async def unban(ctx, user: discord.User):
ban_entry = await ctx.guild.fetch_ban(user.id)
await ctx.guild.unban(ban_entry.user)
now you want to work with a list of members to unban, so you'll have to work around that using commands.Greedy and a for loop
and probably also want a bit of error handling, in case the user is not banned
This is kinda just useless, you can just pass the users ID to unban
property mention: str```
Returns a string that allows you to mention the given user.
but it's gonna look like an id
what is this supposed to be?
discord thing
You can mention the user, most of the time and cases the user is still cached
your client most likely doesn't have the user cached and it will not be a proper mention no
Unless you want to ban someone before they even join the server
weird
or unban them after a long time
@valid niche You do a lot of PR reviews on disthon right?
i mean i'm one of the contributors so it's one of my tasks yes
If you have time would you mind taking a look at my most recent merge on my wrapper, the commands impl
Blanket is on vacation rn
why
the issue is, i have no clue about your wrapper and how it works and your visions, so i cannot write a proper review
...?
The commands impl, is completely different from the rest of the wrapper, not counting internals such as WS
they were saying mention won't work properly because it will most likely just look like @glossy relic in your client
because the user won't be cached
I just need someone to take a quick look at my string parser, my plugins metaclass and command client itself
@slate swan
yes
yes casually using eval so how i make allowed list
@bot.command()
async def math(ctx, *, expression:str):
allowedlist = "1", "2", "3", "4", "5", "6", "7" ,"8", "9","0", "+", "*", "-", "/"
if expression not in allowedlist:
await ctx.reply("Invalid input.")
else:
calculation = eval(expression)
await ctx.send('Math: {}\nAnswer: {}'.format(expression, calculation))```
ctrl+c > ctrl+v moment
You are checking if the string is in the list
You have instead to check if each words of the string are in the list
so what i have to do
This check would be so easy to bypass as you are using in
so?
Isn't there some kind of online API you can use for this
solution?
It would be safer then allowing eval on your local machine
still not exactly something i can properly review due to me not being in on the project and how it works/is set up. Tho i did spot one thing. You forgot to do from .exts import * in your top level __init__.py
That was done on purpose
to allow for from lefi.exts import ...
rather then from lefi import commands
ah you want it to be an extra import like discord has
as commands is an extension
what i have to do so its only 12367869 +-*/ allowed
if you did import .exts it would auto import, but one would still address it as lefi.ext
cuz as u said in is ez to bypass
That is true but I'm sure you know what I mean
you need to make a loop that checks each individual character in your allowedlist, and make sure that if something is NOT in this list, that the command stops execution in the form of a raised error, or a return
because you weren't properly paying attention when i explained it
make a loop
@bot.command()
async def unban(ctx, user: discord.User):
await ctx.guild.unban(user)
``` this is how you do a simple single user
"while True:"...
Its un-needed to fetch a ban
Thats just a useless API call
verify the user is actually banned i guess
You can pass in an ID that isn't banned and it won't unban them
there edited it
A simple single user unban
@bot.command()
async def unban(ctx, user: discord.User):
await ctx.guild.unban(user)
If you want it to get multiple members, make your typehint like this
async def unban(ctx, users: commands.Greedy[discord.User])
And add a for loop to iterate over users and do the unbanning
@slate swan
I already told ya
U're checking if the given string is in the list
Basically you are comparing a complete sentense into a list of words
You have tho compare a word into the list of words
So check if the words in the string are in the list of words
i can do you one better. Compare it with a regex, except it checks if there is anything that is NOT in the allowed list :p
and check if there are any results
Well if he founds this complicated Imagine use regex lol
Wouldn't this be still be bypasable if you do smthg like os.remove("/");print("2+3")
You would need to actually validate afterwards
uh?
You might be able to use ast.literal_eval actually, as that is very limited with what it can evaluate
!d ast.literal_eval
ast.literal_eval(node_or_string)```
Safely evaluate an expression node or a string containing a Python literal or container display. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, `None` and `Ellipsis`.
This can be used for safely evaluating strings containing Python values from untrusted sources without the need to parse the values oneself. It is not capable of evaluating arbitrarily complex expressions, for example involving operators or indexing.
how would this bypass?
matches = re.findall(r"(?![\d\+\-\/\*])")
if matches:
await ctx.send("Invalid input")
return
Yea, and it would find 2+3
And your saying invalid inputs if it found a correct one?
it matches anything that does NOT fit the regex
Ah I see
Anyways, I think that would, and should be used in conjunction with ast.literal_eval
Still imo, not safe to do this at all and rather you should go online and search for a math eval API
fair enough
or just use buttons and make a button calculator 😂
it’s just better than disthon
i don't think you have enough buttons for a nice calculator, unless i'm mistaken
you know what, i want to try making a buttons calculator for the funs of it lmao
ah it was 5, thought it was 3
¯_(ツ)_/¯
remind me this weekend to make that calculator so that i actually have time or so
@valid niche why aren’t you guys using |= and &= https://github.com/AA1999/Disthon/blob/master/discord/api/intents.py#L31
discord/api/intents.py line 31
self.value = self.value + (1 << self.VALID_INTENTS[arg]) if kwargs[arg] else self.value```
lets see how would bitwise AND and bitwise OR work here?
self.value |= flag value if the input is true else self.value &= ~flag value
the VALID_INTENT is just the bit position and not the actual bit value
a members intent would be 000000000000010, but we have it stored as 1, since it's a bit shift of 1
i mean, this works for my impl of flags in andy’s wrapper
i assume that will work if you store your valid intents as the actual binary representation
we stored it as the bit shift
wait let me just open your intents code i'll see
👁️ 👄 👁️
yeah you store all your intents as their binary representation
we store it as
VALID_INTENTS: ClassVar[Dict[str, int]] = {
'guilds': 0,
'members': 1,
'bans': 2,
'emojis': 3,
'integrations': 4,
'webhooks': 5,
'invites': 6,
'voice': 7,
'presence': 8,
'message': 9,
'reaction': 10,
'typing': 11,
'dm_message': 12,
'dm_reaction': 13,
'dm_typing': 14,
}
how to make square root aka ** ignore question2?
@bot.command()
async def math(ctx, question1:int, symbol:str, question2:int):
if symbol == "+":
embed = discord. Embed (title="Correct answer:", description=question1+question2, color=0x9208ea)
await ctx.send(embed=embed)
elif symbol == "-":
embed = discord. Embed (title="Correct answer:", description=question1-question2, color=0x9208ea)
await ctx.send(embed=embed)
elif symbol == "*":
embed = discord. Embed (title="Correct answer:", description=question1*question2, color=0x9208ea)
await ctx.send(embed=embed)
elif symbol == "/":
embed = discord. Embed (title="Correct answer:", description=question1/question2, color=0x9208ea)
await ctx.send(embed=embed)
elif symbol == "**" and question1 == question2:
square_root = question1 ** 0.5
embed = discord.Embed (title="Correct answer:", description=square_root, color=0x9208ea)
await ctx.send(embed=embed)```
you store it as
guilds = 1
members = 2
bans = 4
emojis = 8
integrations = 16
``` etc.
well i just copied whatever was in the docs
which is the binary representation, and that way you can do binary operations to flip individual bits
1 << 0 = 0001 = 1
1 << 1 = 0010 = 2
1 << 2 = 0100 = 4
1 << 3 = 1000 = 8
etc.
it should still work, the bitwise and and or
since intents is just a long binary number where each bit is an intent
what you did is create the binary representation of the intent beforehand, we do it as the intents are made
so you store the actual binary representation of each intent, we just store the shift
yours is probably faster for cpu time, but less memory efficient. Our method is probably slower but more memory efficient. But it's so marginally small it doesn't matter in the context of python
it's literally a few cpu cycles/bytes of memory difference
am i missing something here or what, because 1 << 0 is just 1 which means bitwise operations can be done on 1
you can do a bitwise operation on any integer
i can do a bitwise operation on 4 and 8
im getting confused at this point
it will just convert these to 0100 and 1000 and then do the bitwise operation
!e
a = 4
b = 8
print(a | b)
``` will print 12
@valid niche :white_check_mark: Your eval job has completed with return code 0.
12
a = 4 = 0100
b = 8 = 1000
a | b = 1100 = 12
i totally missed your point about how you store the intents
yeah i just got that now
but the performance differences are so minimal, at only a few cpu cycles and a few bytes of memory, it matters nothing
if you were to do something similar in C, i wouldn't be surprised that the compiler would run so many optimizations it would turn out to be the same :p
blanket write the C bindings for StringParser alr
I can't stand the 1 micro second it takes to parse tuple prefixes
fine
switch whole lib to cython rn
Lmao
it's CPython sir
There exists cython and CPython
ah i see
Sms
wut?
i'm not sharing my phone number with you
DMs*
this channel exists to do support here. Not in DMs
Ok
bruh
We’ve
?
I hate mobile
why are you programming on mobile?
Weeb
ok lmao
Is there anything stopping me?
because i've seen many people try it and they run into super weird errors due to how phones work. Also phones are just straight up annoying to work with and not a good development environment
Ik
"but it works"
but it works
!e
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
!e
x = 0
while x == 0:
print("Hello world")
@hollow mortar :x: Your eval job has completed with return code 143 (SIGTERM).
001 | Hello world
002 | Hello world
003 | Hello world
004 | Hello world
005 | Hello world
006 | Hello world
007 | Hello world
008 | Hello world
009 | Hello world
010 | Hello world
011 | Hello world
... (truncated - too many lines)
Full output: too long to upload
.
Is there a way to give roles from 1 server in another server
@client.command(name = "server", aliases=["aliase"])
async def server(ctx):
mainguild = client.get_guild(892718771242926132)
staffguild = client.get_guild(900459740063207464)
member = ctx.message.author
var = discord.utils.get(staffguild.member.roles, id=900461033477533696)
await member.add_roles(var)
wdym
Get the member in the other guild using the get_member method in discord.Guild object.
!d discord.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
What should i change
okay
And it's add_cog(ClassName(bot))
And of course replace ClassName with your actual class name 
self is not defined
Copying code won't make you improve 
Hi, I am trying to make a dictionary bot, why does this not work
import json
import requests
token = '*******'
app_id = "******"
app_key = "***************"
endpoint = "entries"
language_code = "en-gb"
word_id = input('What word would you like to search up in the Oxford Dictionary?\n')
url = "https://od-api.oxforddictionaries.com/api/v2/" + endpoint + "/" + language_code + "/" + word_id.lower() + "?fields=definitions&strictMatch=false "
r = requests.get(url, headers={"app_id": app_id, "app_key": app_key})
if not r:
print("that word doesn't exist lol")
else:
print("text \n" + r.text)
r = r.json()
print("Definition:\n" + r.results[0].lexicalEntries[0].entries[0].senses[0].definitions[0])
client.run(TOKEN)

I recommend learning python first before going into discord bots
oh wait lol
You can't just put python code and turn it into a bot like that 
i did print
i just forgot i put print
uhm..??
you need to import the api wrapper too
i recommended going through the dpy docs
You need to recode everything anyways
async def on_raw_reaction_add(payload):
guild = bot.get_guild(payload.guild_id) # Get guild
member = get(guild.members, id=payload.user_id) # Get the member out of the guild
# The channel ID should be an integer:
if payload.channel_id == 870064115928948806: # Only channel where it will work
if str(payload.emoji) == ":white_check_mark:": # Your emoji
role = get(payload.member.guild.roles, id=869691107963990076) # Role ID
else:
role = get(guild.roles, name=payload.emoji)
if role is not None: # If role exists
await payload.member.add_roles(role)
print(f"Added {role}")```
Can someone remake this to when the reaction has been canceled then the role will be removed 🙂
or help 🙂
yes yes, this is the channel where we remake code 
..
It's the same thing but you have to use delete_roles i think
they dont want to delete it they want to remove it from the person ig
its remove_roles
use elif and check if they reacted to the ❌ emoji, if they did then use payload.member.remove_roles()
hello how can my bot when somone joins my discord server i want my bot to say Welcome to Python help!
!d discord.on_guild_join
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
!d discord.on_member_join i think?
discord.on_member_join(member)``````py
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
^
oh right
lul
i thought he said when the bot joins
on_raw_reaction_add what about this?
so i just copy paste that
ok, u totally didnt code that piece of code
?
what do you think?
its an event
i think i will
god
ur not supposed to say "god" ur supposed to help me thats ur job
do you know any basic python?
Nobody gets paid here
i do
damn got em, roasted
They're people volunteering
ofc
its an event, you need to listen to it using Client.event or Bot.listen
ok, well i dont think you do cuz you literally just said do i copy paste that
lol i was jk
Hey everyone -- has anyone ever gotten an error about the event loop is not currently running? Trying to create views but I keep getting the same error
ofc u were 
I don't know why discord isn't starting the event loop
classic move, "i was jk"
lmao ikr
traceback?
and code
sir-lancebot | File "/bot/bot/exts/events/trivianight/trivianight.py", line 19, in __init__
sir-lancebot | self.questions = Questions(self.scoreboard)
sir-lancebot | File "/bot/bot/exts/events/trivianight/_questions.py", line 97, in __init__
sir-lancebot | self.view = QuestionView()
sir-lancebot | File "/bot/bot/exts/events/trivianight/_questions.py", line 50, in __init__
sir-lancebot | super().__init__()
sir-lancebot | File "/usr/local/lib/python3.9/site-packages/discord/ui/view.py", line 166, in __init__
sir-lancebot | loop = asyncio.get_running_loop()
sir-lancebot | RuntimeError: no running event loop
code for the snippet would just be
class QuestionView(View):
"""View for the questions."""
def __init__(self):
super().__init__()
self.current_question = {}
self.buttons = [QuestionButton(label) for label in ("A", "B", "C", "D")]
for button in self.buttons:
self.add_item(button)
the view is getting initialized outside a command?
yes, since I'm trying to set up a modular structure
well that won’t work
that doesn't? dpy has examples of it working outside a command
!d discord.Message.reference
The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.
New in version 1.5.
I'm trying to get a users nickname from their user id. How would I do this?
you would need to do guild.get_member(id) to get the member instance of this user, from there you can do member.nick
!d discord.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
!d discord.Member.nick
The guild specific nickname of the user.
I'm getting module 'discord.guild' has no attribute 'get_member'.
send me your code
for person in data["members"]:
id = person["name"]
name = guild.get_member(id)
and how is guild defined?
This?
from discord import guild
that's not correct
it would first of all be from discord import Guild, but that still wouldn't be correct
you never create the guild instance yourself, you always get it from some other source
for instance from ctx.guild, or client.get_guild(id), or from message.guild, or whatever you want
Ok.
you need to specify WHAT guild you want
python doesn't magically know what you are referring to. It doesn't have telepathic powers. You need to explicitly state what you are referring to
in the case of a guild, you need to specify what guild
Thanks. I got it working.
help.
i am going to cry
i have been trying to do this
for the last hour
error after error
where did you get your code from?
my friend who got it from github
i hope you are aware that discord bots are generally a very tough topic, and not for the beginners. Whilst you can try going for it as a project, do know it will be a complete mess and it will be extremely difficult for you to get a basic grasp of what is going on
because it sounds like you are just starting out with python
yes thats very true
you said you copied code from github, but did you read their instructions on what you need to do? what is required to use it?
if u ddint thats why there is error btw i add ur discord bot to my server it doesnt even have a perfix @royal zenith
its x
oh
i dont want to put my bots token into a random config file
can u add me?
yes or the bot would raid ur discord server
ik they normally are for the bot but still
sounds like they have the understanding of the code, it might be better to ask them to properly set it up as they can see the code and knows what needs to be done
its risky
yes true
i still am
they dont know what to do neither do i
i mean idk what the code is, i haven't seen any of your code, i've only seen the error and you frantically trying to pip install with what seems to be no knowledge on python
most here can help you with specific questions, but they cannot help you get all knowledge from the ground up, that takes a long while
utils.json_loader seems like a local module
Perhaps you didn't clone the repo properly
utils is either a local module, or part of a bigger module yes
damn, can you stop saying i have no knowledge of python
its kinda annoying me
bro guys he doesnt know alot fo python leave him alone what happinse if somone did that to u
if u join my discord server u can learn python easily
bc i have smart devlopers that been coding for python for 7 years!
okay let me put it this way: You seem to be frantically trying things that you aren't sure about, you said you've been trying for hours. Have you read the instructions that the github page gives if there are any?
like i saidddddddd
my friend gave me the code
bruh
because i like the bot
dw i got em
Have you gotten all the files?
syskey hit dms breh, alrdy said i would help u
sent him the .rar with the utils file
he has everything he needs
no shit aint workign tho
local import
Righto, otherwise go yoink it from github
did u copy all the imports i told u to copy?
so what are u actually tynna do with the command
test shit
what kind?
idk
damn
due to the fact it says module not found, i am fairly certain they do not have everything. Either forgot to pip install something, or missing requires files
dude if u just copy somone random code its gonna give u a random error
i copied all the code it needed, and all the files
It's also possible you'll want a __init__.py in the utils folder, tis something that occurs with our utils folder sometime
dude u know thats risky people make a random code for u and leak ur bot and raid ur discord server so dont try that
i sent it to em, he aint got shit to worry abt
you can often copy paste small snippets of code. But copying over large chunks often means you'll have to change it to integrate it with your project. Have you done so already?
mh
doesnt need it
!d help bot
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
also did you install all the modules that are required?
you can see what it imports at the top, and see if you can work from there, keep in mind that in a lot of cases the import name and the pip install name can be different
can anyone tell me how to make a verifcation command for my discord bot and if u do pls send me the code
define "verification bot"
what does it need to verify?
also spoonfeeding generally isn't done here
those are generally made that when you complete the action, it gives a role, and all channels are set to private unless you have that role
i do have the role
i do have to say: those systems are very dated and not used anymore. It repels most users and doesn't help in any way
oh
it doesn't help against spammers, it doesn't help against self bots, it doesn't help against raids
oh
i mean you can still make it, but i speak from experience, these systems don't really work well
it just makes users like "why do i have to take all these extra steps, i just want to join the server"
Just use a Captcha module if you really want something secure
Unless those selfbots have an OCR it won't be able to bypass
wickbot is for instance a bot that does proper protection using a captcha
for await asyncio.sleep(x), does it cancel when the code stops?
like if you reload the code
oh and most of those security bots are closed source, otherwise attackers will look at the code and find the weak points/workarounds
if you restart the bot, everything is gone
sleep is your code still running, just not doing anything
need some help, anyone there
Lots of people
nope, i'm invisible
don’t get fooled, nobody is here
euhJHW
but @slate swan for anything like security or verification, anything that does a proper job is closed source and you'll need to find your own solution
k
I see.. so if I wanted to do like a tempmute or tempban, I would have to do something else then right?
databases :D
persist that data
sick ok
you store either the startdate and a duration, or you store the enddate, then regularly check if it expired and undo the infraction
**@commands.command(name="lock") @commands.has_permissions(manage_channels=True) async def lock(self, ctx, channel : discord.TextChannel=None): overwrite = ctx.channel.overwrites_for(ctx.guild.default_role) overwrite.send_messages = False await ctx.channel.set_permissions(ctx.guild.default_role, overwrite=overwrite) await ctx.send('Channel locked.')**
if u want a lock command
hmmm regularly check.. @task.loop?
sick
If your gonna use a database really suggest an SQL one
the language is amazing for this type of stuff
makes it easy to do mutes
I have no clue how to use one of them, let alone install it lol
~~***@commands.command(name="mute", description="Mutes the specified user.") @commands.has_permissions(manage_messages=True) async def mute(self, ctx, member: discord.Member, *, reason=None): guild = ctx.guild mutedRole = discord.utils.get(guild.roles, name="Muted")~~***
I mean, it doesn't mute anyone haha
BOB THE BUIDLERR
lmao
If you check out #databases theres a lot of tutorials, and information on sql
mostly from anand sql guy
@shrewd pasture evil guy
indeed
dont murder me
Is it possible to grab a discord.User object of a member that has no contact with the bot? Like if they aren't in any of the servers the bot is in?
Just curious
josh add me as a Frined in discord and we become murder clans boy
I mean dyno does it sure
i dont think dyno is python
quick question for you guys. Been stuck on this
I need to run through every member in a guild and check if the member is in the other guild. Here is the current code:
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
x = ctx.guild.members
for member in x:
print(f"{member} has been confirmed in {x}")
guild = self.bot.get_guild(ocm)
check = int(member.id)
if guild.get_member(check) is not None: #error here i added check thinking it needed to be an id and int
await self.bot.add_roles(member, role)
else:
return;
Error:
if guild.get_member(check) is not None:
AttributeError: 'NoneType' object has no attribute 'get_member'
no idea
@commands.command(name="mute", description="Mutes the specified user.")
@commands.has_permissions(manage_messages=True)
async def mute(self, ctx, member: discord.Member, *, reason=None):
guild = ctx.guild
mutedRole = discord.utils.get(guild.roles, name="Muted")
stop
`~~***@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")if role is None: # Doesn't exist, create the role here role = await ctx.guild.create_role(name="Owners / Managers") ocm = self.bot.get_guild(891928045236154388) x = ctx.guild.members for member in x: print(f"{member} has been confirmed in {x}") guild = self.bot.get_guild(ocm) check = int(member.id) if guild.get_member(check) is not None: #error here i added check thinking it needed to be an id and int await self.bot.add_roles(member, role) else: return;`~~***
isnt it guild.get_member?
lemme check
dont listen to my advice lmao
dont think so though
get_guild is returning None, perhaps you passed in the wrong id, or it isn't cached
its bot.get_member
wrong but okay
🗿
ez
!d discord.Client.get_user
get_user(id, /)```
Returns a user with the given ID.
!d discord.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
it isnt members because im not checking the whole member list of the server
^
Maybe fetch the guild/member instead of getting it
well he prob has his reason for why its not using guild obv
like for instance, if its a paramter that want's an ID or smth
get_guild would return the Guild obj
The part I really see wrong about this code is the self.bot.add_roles
Since the rewrite that has been changed to Member.add_roles
no i mean if they aren't on the same guild as the author
which was about like 6 years ago iirc
They are checking if a member of the context invocation guild is inside of the other guild
Which is what they are doing
no clue
i thought they were doing client.get_user?
why would i do that
when im attempting to fetch the check of a user in a server or not
Actually, ocm is already assigned as get_guild is there any reason why you are passing a Guild obj to get_guild again?
i see
oh i thoguht u were using self.bot to get the member @shrewd pasture
mb thats on me
im blind i should read better
Remove the guild = part and just use ocm as that is already the get_guild return
yes
Then change self.bot.add_roles
let me test
why would i write that
its o l d c o d e
Because bot.add_roles doesn't exist
...
im not sure i understand
Are you trying to give the bot a role?
no
Ok, so its Member.add_roles
if it was the bot u'd use bot.user btw
no, Guild.me
huh?

property me: discord.member.Member```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
wait w u t
got the error unfdefined name Member
ohhh wait nvm i get it now
you can add roles to this?
member being the Member instance
theres no member instance in my code
same thing then
? bot.user is a ClientUser instance
Traceback (most recent call last):
File "main.py", line 100, in <module>
bot.load_extension(f'cogs.{filename[:-3]}')
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 615, in _load_from_module_spec
raise errors.NoEntryPointError(key)
discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.giveaway' has no 'setup' function.```
Which is what you need to get, if you want to add the roles
see the part where you did guild.get_member
Change that to ocm.get_member pass the ID of the member, and assign this to a variable
I have never worked with cogs until recently
check if it isn't None, then use add_roles
you need a setup function at the end of your cogs.giveaway cog
I know its something like this: py def setup(bot): bot.add_cog(Cog(bot))
I didnt make it a cog tho
yes
what do I name it??
how do i add the Member instance
my file name is giveaway.py
kinda slow right now
whats the class name?

I did make it a class lol
get_member will return the Member instance if its found
whats the name of it
should i use try?
I am trying to convert all of my code
I mean I didnt make a class
must I??
I did make it a class lol
what
try:
check = ocm.get_member(member.id)
except:
return
No you just need to use ocm.get_member, pass the ID of the member then assign this to a variable. Then check if the variable is not None
nevermind i gtg
try-except won't work as this won't raise an error
Nice.
Show your code
check = ocm.get_member(member.id)
if check:
await Member.add_roles(member, role)
else:
return;
sorry im self taught and wasnt able to learn well?
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
x = ctx.guild.members
for member in x:
print(f"{member} has been confirmed in {x}")
check = ocm.get_member(member.id)
if check:
await Member.add_roles(member, role)
else:
return;
Member???
im self taught too, your point doesn’t make sense
Your Member isn't is assigned to check
you do check.add_roles and you don't pass member to this
isnt everyone here self taught lol?
You only pass role
like huh
@hasty iron are we gonna do stubs
uh
type stubs?
we can but idk
just add overloads to the files? no need for stubs
there are already dpy type stubs for 1.7.x by bryanforbes
that takes up to much space blanket
who cares
We aren't talking about dpy
ah
If you stub one file you gotta stub the rest
@pliant gulch it just gave me a Missing Access error
that’s pain
Is the member you are trying to add the roles to above your bots highest role?
yes
i can do stubgen but it’s not the best, ill have to do some changes to the generated stubs
Ok sure I would use a try-except here
its supposed to be shuffling through all members
As this is a hierarchy issue
in 1 servers
and checking if its in another
wait it might be giving it in the wrong server
Either try-except or you can check the members highest role and compare its position to your member's highest role
top_role iirc, but imo its a lot easier just to try-except for missing access
!d discord.Member.top_role
property top_role: Role```
Returns the member’s highest role.
This is useful for figuring where a member stands in the role hierarchy chain.
i think i see
its giving the role in ocm and not the ctx.guild
how would i fix that cause i tried just doing ctx.guild instead of Member and it gave an error
So you want to assign the roles in ctx.guild?
yes
ik why it gave an error
do member then
i just dont know how to fix it
As you iterate through ctx.guild.members
ohh
gotcha
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'member'
members?
oh im dumb
lemme try this
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'list' object has no attribute 'add_roles'
Don't do ctx.guild.member
gave that error
You already ARE ITERATING over ctx.guild.members
for member in ctx.guild.members:
member is the Member instance
how do i make sure that only one person is answering
i was testing and came across the problem of multiple tests running at once and more than one person answering
@pliant gulch kinda worked?
it spamed the fuck out of my console though
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
x = ctx.guild.members
for member in x:
Member = ocm.get_member(member.id)
for member in ctx.guild.members:
member.add_roles(role)
print(f"{member} has been confirmed in {ctx.guild}")
like every member was in console
i dont know why the check didnt work
TBH I would just scrap this, as mutual_guilds exists
is it supposed to be if
it does already check for the author in the wait_for so you should be fine. it would just be confusing
ok
!d discord.User.mutual_guilds
property mutual_guilds: List[Guild]```
The guilds that the user shares with the client.
Note
This will only return mutual guilds within the client’s internal cache.
New in version 1.7.
This returns a list of Guild objects,
can i make so one user cant use more than one test at a time?
not sure. maybe look in guild cooldown or dedicate a variable to check if the command is in progress
can u quickly give an example if you dont mind
im so tired and its been 5 hours of working on this
wait how do i check if its in progress
if a command is entered, set the variable to false, after it ended, set it to true
if the variable is false, command would not work
Iterate through ctx.guild.members as you are now, for the member instance Ex: for member in ctx.guild.members: ... Next check if ocm, the Guild instance which returned from get_guild is inside of member.mutual_guilds and if it does do member.add_roles
i dont comprehend
how do i write that
how do i check the mutual guilds to ocm
?
Use in
!e ```py
guild = 1
guilds = [1, 2]
if guild in guilds:
print("yes its in")
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
yes its in
depends
got it
on what.
on you
You do know how to make a variable right?
yes
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'ClientUser' object has no attribute 'mutual_guilds'
Can you show your code
as somehow you are getting bot.user
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
guilds = [891928045236154388, 2]
x = ctx.guild.members
for member in x:
for member in member.mutual_guilds:
if member.mutual_guilds in guilds:
member.add_roles(role)
huh??? Why are you checking if a list of Guild objects is inside of a list of ints?
This is an example, not meant to be taken literally
oh
You check if ocm is in mutual_guilds
And somehow here, somewhere in the loop you are getting the bots user
You don't iterate through mutual guilds at all, and esp not for member
this is it now:
You simply, after for member in x: check if ocm is in mutual_guilds of the member
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
x = ctx.guild.members
for member in x:
for member in member.mutual_guilds:
if ocm in member.mutual_guilds:
member.add_roles(role)
then add the roles to member
ohh
Don't iterate member.mutual_guilds
Just delete that part, and use if ocm in member.mutual_guilds
same error
this line
if ocm in member.mutual_guilds:
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
x = ctx.guild.members
for member in x:
if ocm in member.mutual_guilds:
member.add_roles(role)
same error
Error is clientuser add_roles?
no mutual_guilds
Ah, clientuser has no attr mutual_guilds
Idk why you are getting the bots client user makes no sense to me
Try checking if the member is not the bot's client user
if member is self.bot.user: continue
with that line
it doesnt even run the code
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
x = ctx.guild.members
for member in x:
if member is self.bot.user:
print("dummy")
if ocm in member.mutual_guilds:
member.add_roles(role)
It doens't print dummy?
OK just do ```py
for member in ctx.guild.members:
if isinstance(member, discord.ClientUser):
continue
if ocm in member.mutual_guilds:
await member.add_roles(role)
Replace the bottom part with this
File "/home/runner/Zyfe-Reps/cogs/connect_handlerv2.py", line 33, in run
if ocm in member.mutual_guilds:
AttributeError: 'ClientUser' object has no attribute 'mutual_guilds'
@pliant gulch
Show your code now that you replaced it
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
for member in ctx.guild.members:
if isinstance(member, discord.ClientUser):
continue
if ocm in member.mutual_guilds:
await member.add_roles(role)
Ok, so for some reason the clientuser is passing the isinstance which should be continuing the loop so it doesn't add its roles
And in the first place I am absolutely confused as to why members contains a user in there
Do you have member intents and everything?
yes thats added
Can you print ctx.guild.members
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents, owner_id=348694166710124547)
client = bot
uhmmm
<Member id=815379168644300891 name='hiro035' discriminator='8033' bot=False nick=None guild=<Guild id=897214863342981121 name='Sypher | DOOM' shard_id=None chunked=True member_count=616>>, <Member id=545423545774112788 name='zerok1' discriminator='4539' bot=False nick=None guild=<Guild id=897214863342981121 name='Sypher | DOOM' shard_id=None chunked=True member_count=616>>, <Member id=169610583883251713 name='>Alam' discriminator='0001' bot=False nick=None guild=<Guild id=897214863342981121 name='Sypher | DOOM' shard_id=None chunked=True member_count=616>>, <Member id=884515295375552563 name='syn' discriminator='0562' bot=False nick=None guild=<Guild id=897214863342981121 name='Sypher | DOOM' shard_id=None chunked=True member_count=616>>]
maybe thats why?
wait
idek anymore
im so lost
Still confused as why somehow self.bot.user is in this list
agreed
Maybe swap out the isinstance with, if member is self.bot.user
And actually can you print self.bot.user as well?
thats it
Zyfe#2912
Ignoring exception in command run:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/Zyfe-Reps/cogs/connect_handlerv2.py", line 34, in run
if ocm in member.mutual_guilds:
AttributeError: 'ClientUser' object has no attribute 'mutual_guilds'
The above exception was the direct cause of the following exception:
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: 'ClientUser' object has no attribute 'mutual_guilds'
thats a list of member objects
then it hits the error statement
this got removed in 1.7 iirc
property mutual_guilds: List[Guild]```
The guilds that the user shares with the client.
Note
This will only return mutual guilds within the client’s internal cache.
New in version 1.7.
hm
doesn’t seem removed to me
Ok, where member.mutual_guilds is use a try except block where you handle attribute error
As I have no clue why a client user is inside a list of members
At this point just suppress it via try except
@commands.command()
async def run(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Owners / Managers")
if role is None:
# Doesn't exist, create the role here
role = await ctx.guild.create_role(name="Owners / Managers")
ocm = self.bot.get_guild(891928045236154388)
for member in ctx.guild.members:
if isinstance(member, discord.ClientUser):
continue
try:
if ocm in member.mutual_guilds:
await member.add_roles(role)
except:
print("fuck")
@pliant gulch
it printed "fuck" once
WAIT
And did it add roles ?
it worked
Ok nice
oh my god
The try except is only there to shut up the client user error
Cus idk why a client user is in a list of members
mind adding me for just a minute
anybody has a idea for a command?im out of ideas
currency system
has gambling and shop
idk kinda generic
make a leaderboard
good idea
yeah'
depends what's you bot? It's kinda weird to make a give me a random number command on a moderation bot
Dont forget to make anti spam in it
i can do that too
number guessing game @slate swan
i meant that as a question
oh
thinked about it to
Number guessing game what
i think it was a hot and cold game
use wait_for
yehp
ill do learderboard and the number guessing game thanks allot
connect 4
Really good idea ngl
@commands.command(name = 'userinfo', help = 'Shows discord info about user', aliases=["whois"])
async def userinfo(self, ctx, member: discord.Member = None):
if member == None:
member = ctx.author
roles = [role for role in member.roles][1:]
em = discord.Embed(
description = f'**User Infomation - **{member.mention}',
colour=member.color,
timestamp=ctx.message.created_at
)
em.set_thumbnail(url = member.avatar_url)
em.set_footer(text=f'Requested by {ctx.author}', icon_url=ctx.author.avatar_url)
em.add_field(name='ID:', value=f'`{member.id}`')
em.add_field(name='Nickname:', value=member.display_name)
em.add_field(name='Created at:', value=member.created_at.astimezone(timezone('US/Pacific'))
em.add_field(name='Joined at:', value=member.joined_at.astimezone(timezone('US/Pacific'))
em.add_field(name=f'Roles ({len(roles)})', value="\n".join([role.mention for role in roles]))
em.add_field(name='Top Role:', value=member.top_role.mention)
em.add_field(name = 'Bot:', value = member.bot)
await ctx.send(embed=embed)
its saying that i have an syntax error at em.add_field(name='Joined at:', value=member.joined_at.astimezone(timezone('US/Pacific')). why is that
missing )
add a ) to the end of that line
oh lmao ty
Np
its the same error
im blind got it
yeah lmao
How can I run
@bot.command()
And
@bot.event
And both should still work?
just run them?
How can you count the overall seconds of datetime.now().timestamp() - a datetime.now().timestamp() i did earlier
It restarts at 60 which makes sense
I need to check if it reaches a certain number to unmute someone
And its higher than 59
Hey, i am trying to make a muted role when a command is given but it is saying self is not defined. and when I don't give self, it says missing argument "self"
Here is my code
if found_muted_role == True:
await ctx.reply("I found a muted role!")
else:
await ctx.send("I didn't find any mute role so I am creating one!")
await Guild.create_role(self,
name = "Muted",
permissions = Permissions.none,
hoist = True,
mentionable = True,
reason = "A user tried to mute someone!"
)
await ctx.send("I have created the muted role")
send traceback
ok
@slate swan ```
Ignoring exception in command mute:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/ext/commands/core.py", line 168, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 112, in mute
await Guild.create_role(self,
NameError: name 'self' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/ext/commands/bot.py", line 995, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/ext/commands/core.py", line 895, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/ext/commands/core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'self' is not defined
it is talking about self in 5th line
but 5th line is import statement
also it is saying File "main.py", line 112, in mute await Guild.create_role(self, NameError: name 'self' is not defined
i said; 5th line of WHAT U SENT
this ^^
you're using cogs or not?
yes i am using cogs but i test with the main file at first
the code that u just sent, is in cogs or in main file?
main
so imma just switch to cogs
alright
Anyone?
Read the error @slate swan
i did i jut dont understand can u send me the real code and ill copy paste it
First of all no i dont have your code and thats spoonfeeding
is it a good idea to move all my helper functions into a seperate cog and then import them into the other cogs?
Second of all please learn basic python before diving into creating discord bots
go show off
it needs to be in an async function
omg tysm ty for helping me unlick this idiot right @supple thorn
he just asked you to learn python first. dont get triggered on others for no reason
bru-
??
can you suggest me a python discord library ?
or should i keep them in the specific cog?
discord.py, nextcord, py-cord, disnake, hikari, enhanced-dpy & more
theres pycord, nextcord, hikari, disnake
thanks I will go with pycord
pycord is early in development so there are a lot of bugs in it
i think disnake is more stable atm
I have used discord.py previously and pycord is pretty much the same
Anyone?
disnake is literally the same as dpy. i advice you use that for temporary stuff until pycord or libs you want is stable
you can literally just replace the word discord with disnake and it would still work
the only difference is with interaction as most forks are
Lmao says the idiot who got himself into discord bots because he's stupid enough to not learn python first
same. i only used disnake because hunter recommended it to me and it's almost as if there wasn't any changes
Disnake implemented slashes in the best way possible and usually adds stable features before any other lib or fork
¯\_(ツ)_/¯
Hey I am getting this error
Ignoring exception in command mute:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/ext/commands/core.py", line 168, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/Efendo-Bot-SRC/modules/mod/cog.py", line 114, in mute
await Guild.create_role(self,
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/guild.py", line 2495, in create_role
fields['permissions'] = str(permissions.value)
AttributeError: 'function' object has no attribute 'value'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
``` on this code
```py
if found_muted_role == True:
await ctx.reply("I found a muted role!")
else:
await ctx.send("I didn't find any mute role so I am creating one!")
await Guild.create_role(self,
name = "Muted",
permissions = Permissions.none,
hoist = True,
mentionable = True,
reason = "A user tried to mute someone!"
)
await ctx.send("I have created the muted role")
There is something wrong with the permss
You need a guild instance not the class
ummmmmmmmmmmmmmm
Also self isn't a param so remove that too
stfh kid go fuck off u ugly ass idiot
???
he's literally stating facts
your supposed to learn python first not make a bot then learn python
some people man...
That's not how it works lol
it is?
just write the command & event and run it?
you can have multiple commands and events in the same file
is there an error?
Man im glad i didnt help you
Oh
Like
@bot.command()
async def stuffHere(ctx):
Djduejjfsi
@bot.event
async def jxis(ctx):
Difnieend
Only the @bot.command() works
yes
You really don't deserve to be helped lmao
you cant name an event whatever you want. it needs to be specific
An asshole like you should be ignored 😂
- you didn't even enter a valid event
2.only certain events need ctx
Anyone?
is it for a temp mute command?
Well technically thats what it is
Its a fight command that mutes the loser between 1-120 seconds
Ok nvm there isn't
Well damn
Use relativedelta and add 120 seconds
Why would i need to add 120 seconds
so its similar to the normal mute command, you just have to include a time conversion thing like this and then at the end do asyncio.sleep(tempmute)
time convert will look like this:
time_convert = {"s":1, "m":60, "h":3600,"d":86400}
tempmute = int(time[0]) * time_convert[time[-1]]```
Oh right
then after the sleep, remove the role
I do regret using asyncio.sleep for unmuting rather than learning how to use tasks back then
Im not using sleep
its better to use it, actually. harder method would be using a db, and storing the time info there and then unmuting
Im using tasks that pretty much counts the seconds between the timestamp of when they were muted and the timestamp rn
That is what im doing
Using mongodb to store data
i havent used tasks so idrk
I subtract them
Using a db isn't that hard and it's recommended to do it that way because your bot may close or crash and the member remains muted until you unmute them manually
atm i only use a db for an afk command im making and per server prefixes
¯\_(ツ)_/¯
I just dont know how to make it count further than 59
It goes back to 0
I can just make it
Subtract 1 every second on the mute time
And check if its 0
If so
Unmute them
That would work right?
New problem
How do i check if they are the same user in the same guild
Save the guild he was muted it and check if he's in that guild
Okay thanks
so uhh i made the afk command, but theres a problem:
it immediately removes the afk when the command is run
hello i need help abt discord flags ( badges)
i already know that premium_type is nitro but for hypesquad houses idk
idt there is one for that
@valid galleonah :(
so i wanna fetch user badges but for houses i dont know their thing
!d discord.Member.public_flags
property public_flags```
Equivalent to [`User.public_flags`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.public_flags "discord.User.public_flags")
thx gonna check it
You copypasta hahhahaha!
try printing r.text and see what it prints
import googletrans
from googletrans import Translator
translator= Translator()
translation = translator.translate("hi", dest= "bn")
print(translation.text)```
Is that google_trans_new?
Move to google trans new since this one is outdated.
@boreal ravinedoes it work when sent via webhook ?
meaning?
!pypi google-trans-new
like if i want it to send the message to a webhook
doest it show the flags
the flags for a user?
yes
ig yes
doesnt work for me
well in repl it the googletrans 3.0.0 automatically gets installed
but it works on a bot
even after pip
do you know how to connect a webhook to a bot ?
you can create a webhook though
what for
i dont understand
How do you start working on discord.py on Github
Im switching to a new editor so idk
you cant work on github?
can u help me
ok for exeample if i want to fetch someones badge, if they have the badge it will say true if they dont have it will say false @boreal ravine
the main error is 'None type' object has no attribute "group"
Kk
Wait d.py doesn't work on GitHub?
if something is nonetype then that means something before it is none idk
