#discord-bots
1 messages · Page 850 of 1
How is the id 'wrong'
oh yeah snake_casing
?
didnt see that
wdym?
i have that
no you dont
you dont see it in the ss
I'm starting to think he's not trolling
bro
Now it returns this
so it has an channel
and it has the right name
@slate swan
ow sorry
we got no code
you have
please send it again then
not not the same var
imagine ghostpinging
i got pinged
hey i got question how can i make smth like this? did research but its no help
i have smth
which part do you not know of that?
just make a title and description with that text
can you help further
add_field(*, name, value, inline=True)```
Adds a field to the embed object.
This function returns the class instance to allow for fluent-style chaining.
the name is a mention there, and values are just texts
set_thumbnail(*, url)```
Sets the thumbnail for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
takes a url
thanks
read the traceback
and this doesn't seem like the whole error
what's the following exception?
okay
it says that there is no key called 1 in seq
nitrogen | legit
so, you tried to pick a key from this json { "hey": 1, "bye": 1 }?
send a more detailed json structure, what part specifically you want to take
@slate swan , do you want to pick a random key, or random value from this? { "hey": 1, "bye": 1 }
or are the keys member_ids?
A few hikari questions bc I've had a look at the docs but I found the layout a bit confusing
- does hikari have something similar to
discord.abc? if so what is it and if not what would be hikari's equivalent - hikari has a
guildtextchannel, is this a sub thing ofhikari.channel(i.e.hikari.channel.guildtextchannel) is is it just a subset of hikari (i.e.hikari.guildtextchannel) - hikari doesn't have something like
discord.ext.commandsso is it justhikari.commands? Looking for hikari's equivalentofBot,AutoShardedBotandContext - is
discord.errorsjusthikari.errorsin hikari - is
discord.rolejusthikari.rolein hikari - whats the thing to import for
buttonstyle, creation of a action row, creation of a button, creation of a select option and the waiting for components in hikari
so, from json { "hey": 1, "bye": 1 } you want to take either hey or bye?
"hey" and "bye" are keys here
the ones are values
so in order to be able to random.choice, you might wanna make a list out of the keys
so then why are you using a dict there? use smth like json { "944912530298527765": ("hey", "bye") }
so use .keys() on this object, which returns a list of these
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
No?
try it
random_key = random.choice(guilds_dict[str(ctx.guild.id)].keys()) should work idk
Imagine using random.randint and simply using indexes
no, he wants to get it only from that id
oh alr
can anyone help me with my issue pls?
import discord
from discord.ext import commands
import random
import asyncio
TOKEN = 'ur token'
client = commands.Bot(command_prefix = '$')
client.remove_command('help') #removes original help command from python file so u can make a costume help command
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
#ur code commands goes here
@client.event run(TOKE)
Ok
yes
Syntax error.
wrong^
Bot.run(“token”)
the run is at the end
@client.listen("on_message")
@commands.has_permissions(kick_members=True, ban_members=True, manage_roles=True)
async def ban_listener (ctx, member = discord.Member, reason=None):
if msg.startswith('Ban'):
# if member.guild_permissions.administrator():
# await ctx.channel.send('Err: User is administrator')
print(member)
print(ctx)
# else:
if reason is None:
await member.send(f'Hello {member.name} , you have been banned from {await discord.guild.get_channel()}. There was no specified reason for this ban.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} for no specified reason.')
await member.ban()
else:
await member.send(f'Hello {member.name} , you have been banned from {await discord.guild.get_channel()}. The reason specified for this was {reason}.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} the reason specified was {reason}.')
await member.ban()
here da code
after all the code is done
Not.
maybe thats what is cuasing my issue
but the bot is still working with what i said
you have the context object there. Do ctx.guild.name
Im so stupid
why not
I fixed code.
could u give a bit of a help in sum
no worries. Having a look through the docs when you're looking for something often helps
new errors lol
Ok bot is online.
Imma add commands.
But I need the basic respond command.
Ok.
No.
@slate swan Check dm
We all are (:
that doesnt make me feel any better lol
Okay then feel bad stupido /s
Error : ImportError: cannot import name 'Enum' from 'discord' (unknown location)
What are you trying to do?
i can't run a extension
A cog or an actual extension?
a cog
How can I make roblox discord commands
Extension 'cogs.Musik' raised an error: ImportError: cannot import name 'Enum' from 'discord' (unknown location)
Wdym?
why do you want to import Enum
and it doesnt seem like you're using discord.py
I dont even think enum is a discord import 🤔
it is a part of discord.py
Ah, i thought it was part of the numpy or base lib of python
discord/enums.py lines 165 to 171
class Enum(metaclass=EnumMeta):
@classmethod
def try_value(cls, value):
try:
return cls._enum_value_map_[value]
except (KeyError, TypeError):
return value```
tho there's no reason someone would import it
im stuck again, please help.
so I have nearly the exact same code and I am getting issues with 'str' not being callable and I have no clue why
I should explain to everybody else
send the code please and the traceback
@client.listen("on_message")
@commands.has_permissions(kick_members=True, ban_members=True, manage_roles=True)
async def ban_listener (ctx, member = discord.Member, reason=None):
if msg.startswith('Ban'):
# if member.guild_permissions.administrator():
# await ctx.channel.send('Err: User is administrator')
print(member)
print(ctx)
print(ctx.guild.name())
# else:
if reason is None:
await member.send(f'Hello, you have been banned from {ctx.guild.name}. There was no specified reason for this ban.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} for no specified reason.')
await member.ban()
else:
await member.send(f'Hello {member.name} , you have been banned from {ctx.guild.name()}. The reason specified for this was {reason}.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} the reason specified was {reason}.')
await member.ban()
with line 104
which is the print, though it is the same with every line
name()
I'm confused
why you call it with ()
why are you doing @client.listen("on_message")
ye, it's also a question
rather than a command
about error you need to delete brackets after ctx.guild.name
- why command with on_message events
- you cannot use checks in an event/listener
- on_message takes only 1 argument
there's no way a Context would pop up in an event
He is waiting for a command such as “!ban” in this case he was attempting to make a ban command by using the start function.
Idk how I know that.
so how am I supposed to listen with a command? (sorry if Im stupid Im new to quite a lot of this)
;-;
Same.
as long as you use the right decorator, discord.py will take care of that for you
I want to make a ban command but I am afraid it will mess up the whole code lol.
best library for slash commands?
so "on_message"?
....
I guess not
Disnake & hikari-lightbulb is something I prefer
Pycord by far. Full integration
there's no "best" library
its in one package right?
can u give me the docs as its kinda confusing with there being v1 and v2
I have a bot that is written in Node.js it has some errors but the bot is abandon.
it's not a replacement of discord.py , is just a fork like 10+ others
join the discord.js server
Ok.
isnt it by some guys that made discord py
No
i currently use disnake
discord py was developed by Danny as the sole core maintainer
Where.
Do you face any issue with it?
but i really need these slash commands
Disnake has slash commands
It always did
it's not like only pycord and dislash can have slash commands
xd
And fyi, Disnake is developed by the developer of dislash.py
thanks !
So if you every used dislash you can just shift it easily to disnake
The syntax is same
and i dont need to change to another library
here is my current channel creator. I want it to also ping the person that created the chat inside that new chat, is that possible?
@bot.command(name="contact")
async def contact(ctx):
guild = ctx.guild
admin_role = guild.get_role(945325312533729311)
overwrites = {
guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True),
admin_role: discord.PermissionOverwrite(view_channel=True),
guild.me: discord.PermissionOverwrite(view_channel=True)
}
await guild.create_text_channel("private-channel", overwrites=overwrites)
thats a huge advantage lmao
await channel.send(ctx.author.mention)
channel = await guild.create_text_channel("private-channel", overwrites=overwrites)
but the bot created the channell, would that ping the bot
ctx.author is author of the command
ohhh
Im still really confused
first create than send
@buoyant quail like this?
@bot.command(name="contact")
async def contact(ctx):
guild = ctx.guild
admin_role = guild.get_role(945325312533729311)
overwrites = {
guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True),
admin_role: discord.PermissionOverwrite(view_channel=True),
guild.me: discord.PermissionOverwrite(view_channel=True)
}
await channel.send(ctx.author.mention)
channel = await guild.create_text_channel("private-channel", overwrites=overwrites)
channel = await guild.create_text_channel("private-channel", overwrites=overwrites)
await channel.send(ctx.author.mention)
gotcha
so like this?
bot.command(name="contact")
async def contact(ctx):
guild = ctx.guild
admin_role = guild.get_role(945325312533729311)
overwrites = {
guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True),
admin_role: discord.PermissionOverwrite(view_channel=True),
guild.me: discord.PermissionOverwrite(view_channel=True)
}
channel = await guild.create_text_channel("private-channel", overwrites=overwrites)
await channel.send(ctx.author.mention)
wait no isidle the loop
ye. but remember about indentation
please help, I dont know what you mean by the correct decorator and the docs dont really explain it to me very well, help?
@client.command()
@commands.has_permissions(kick_members=True, ban_members=True, manage_roles=True)
async def ban_listener (ctx, member = discord.Member, reason=None):
if msg.startswith('Ban'):
# if member.guild_permissions.administrator():
# await ctx.channel.send('Err: User is administrator')
print(member)
print(ctx)
print(ctx.guild.name())
# else:
if reason is None:
await member.send(f'Hello, you have been banned from {ctx.guild.name}. There was no specified reason for this ban.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} for no specified reason.')
await member.ban()
else:
await member.send(f'Hello {member.name} , you have been banned from {ctx.guild.name()}. The reason specified for this was {reason}.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} the reason specified was {reason}.')
await member.ban()
you don't need check message. command will be used like the name of function
async def ban_listener mean that you call it like !ban_listener
@vestal mist Can I have a kick code.
with the command prefix being ?, it should be ?ban, right? I am still not getting anything
uhhh
await kick(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.kick "discord.Guild.kick").
ye
( I changed it to ban)
i did not import it is was a bug
final code?
@client.command()
@commands.has_permissions(kick_members=True, ban_members=True, manage_roles=True)
async def ban (ctx, member = discord.Member, reason=None):
print(member)
print(ctx)
print(ctx.guild.name)
if reason is None:
await member.send(f'Hello, you have been banned from {await ctx.guild.name}. There was no specified reason for this ban.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} for no specified reason.')
await member.ban()
else:
await member.send(f'Hello {member.name} , you have been banned from {ctx.guild.name()}. The reason specified for this was {reason}.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} the reason specified was {reason}.')
await member.ban()
@bot.event
async def on_message(message):
with open("banwords.json") as f:
banwords = json.load(f)
with open("banwords.json", "w") as f:
json.dump(banwords , f)
if {i.lower().translate(str.maketrans('','', string.punctuation)) for i in message.content.split(' ')}\
.intersection(set(json.load(open('banwords.json')))) != set():
await message.channel.send(f'{message.author.mention} по губам отшлепать??')
await message.delete()
await bot.process_commands(message)
banwords.json
banwords = ["тупой", "дуб"]
erorr
await coro(*args, **kwargs)
2022-02-22T20:51:10.865809+00:00 app[worker.1]: File "/app/main.py", line 51, in on_message
2022-02-22T20:51:10.865809+00:00 app[worker.1]: banwords = json.load(f)
2022-02-22T20:51:10.865824+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/json/init.py", line 293, in load
2022-02-22T20:51:10.865824+00:00 app[worker.1]: return loads(fp.read(),
2022-02-22T20:51:10.865838+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/json/init.py", line 346, in loads
2022-02-22T20:51:10.865839+00:00 app[worker.1]: return _default_decoder.decode(s)
2022-02-22T20:51:10.865853+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/json/decoder.py", line 337, in decode
2022-02-22T20:51:10.865854+00:00 app[worker.1]: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2022-02-22T20:51:10.865867+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/json/decoder.py", line 355, in raw_decode
2022-02-22T20:51:10.865868+00:00 app[worker.1]: raise JSONDecodeError("Expecting value", s, err.value) from None
2022-02-22T20:51:10.865894+00:00 app[worker.1]: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Help me
!json
When using JSON, you might run into the following error:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
This error could have appeared because you just created the JSON file and there is nothing in it at the moment.
Whilst having empty data is no problem, the file itself may never be completely empty.
You most likely wanted to structure your JSON as a dictionary. To do this, edit your empty JSON file so that it instead contains {}.
Different data types are also supported. If you wish to read more on these, please refer to this article.
you can even use a text file instead of json
why do i get this error help Command raised an exception: AttributeError: 'generator' object has no attribute 'to_dict'
I dont think its being called as the print functions dont display anything
🤔
@buoyant quail any ideas?
Is it possible to do it so that if you run a command in one server, it unbans in another
Do not understands
Don't recommend that
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., reason=None)
i launched this code by me. it workes. but with errors ofc
i didnt recommended it i just said its available
Why would you want to do that?
Which is recommending it
but if you do ?ban does anything happen?
what is happening
Nothing
so if someone was banned and they are appealing that ban in another server, you unban them from the main server in the appeal
yes
<class 'discord.member.Member'>
<discord.ext.commands.context.Context object at 0x0000015D7FA81FD0>
Bot tester serv
and then errors
well youre trying to print an obj
by doing ?ban ?
!e
print(str)
yes. !ban by me, but does not matter
@slate swan :white_check_mark: Your eval job has completed with return code 0.
<class 'str'>
same thing lol
Code?
@final iron
how does that work
just work)
bot.command(name="order")
async def order(ctx):
guild = ctx.guild
admin_role = guild.get_role(945325312533729311)
overwrites = {
guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True),
admin_role: discord.PermissionOverwrite(view_channel=True),
guild.me: discord.PermissionOverwrite(view_channel=True)
}
channel = await guild.create_text_channel("private-channel", overwrites=overwrites)
await channel.send(ctx.author.mention)
CommandNotFound: Command "order" is not found. I AM STUPID
where is @ before bot.command
its a deco
You're making member default to discord.Member
You sure you didnt mean to type hint?
he said command even doesn't run
😭 🔫
allot of flaws in that code
Could someone help me with this
Does anyone know how to make a command where the bot changes your name like the !afk command.
yeah just get the guild and unban the member
!d discord.Member.edit
que?
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
!d discord.Guild.unban
await unban(user, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unbans a user from the guild.
The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
why not. just get server by id
@final iron it runs but if I do ?ban nothing happens
wut
Do you have an error handler?
no
That is in lamens terms
I do not understand…
- do you have members intents
- you cant ban a member higher than the bots role
- can your bot ban members?
If you don't know what a decorator is you're not ready for discord.py
Which part
what are member intents
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
dude ive known this library for 32 hours please stop dude
!intents
lol
I do not know how to create the command.
chat is moving fast :p
Not experienced in PY.
Decorators are not just for discord.py
fr
no do I need them?
Decorators are used in python code all the time
which sucks
ik i tought i was something else for dis.py
Which is very bad
so basic yet no one knows about it
Mhm
How do I create the command.
do I need intents?
check examples https://github.com/Rapptz/discord.py
Check this out:
https://vcokltfre.dev
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.

ok I have enabled intents and stuff, it is still not working
show code
!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.
why do i get this error? Command raised an exception: AttributeError: 'generator' object has no attribute 'to_dict'
@client.command()
@commands.has_permissions(kick_members=True, ban_members=True, manage_roles=True)
async def ban (ctx, member = discord.Member, reason=None):
print(member)
print(ctx)
print(ctx.guild.name)
if reason is None:
await member.send(f'Hello, you have been banned from {await ctx.guild.name}. There was no specified reason for this ban.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} for no specified reason.')
await member.ban()
else:
await member.send(f'Hello {member.name} , you have been banned from {ctx.guild.name()}. The reason specified for this was {reason}.')
await ctx.channel.send(f'user {member.name} has been banned by {ctx.author.name} the reason specified was {reason}.')
await member.ban()
well a generator doesnt have that attr
Im looking for a api or docs, so I can create roblox commands
i ment everything
await ctx.guild.name wth
how do i put a dictionary into a embed then
cos that wat i found on docs
make it str
btw thats now how you typehint
I have no clue what Im doing ok
well its like that but you arent setting a dict
my script is longer than 2000 characters
what is the pasting service
can someone tell me an api to code roblox commands on discord
^
check if roblox has an api
google...
there are multiple i dont know which one is good
Robloxpy for example
how do you feel about this caching mechanism 🤔
lol don't u think someone knows
Hmm
should be in a class
just for organisation or?
no
what the heck is bob
a class that has all the attrs
i use bob for user id
xd
my cache class if you want an example
from typing import Any
__all__ = ("Cache",)
class Cache:
def __init__(self):
self.cache: dict[Any, dict[Any, Any]] = {}
def __dict__(self) -> dict[Any, Any]:
return self.cache
def __len__(self) -> int:
return len(self.cache)
def _save(self, key: Any, value: dict[Any, Any]) -> None:
self.cache[key] = value
def _get(self, key: int) -> None | dict[Any, Any]:
try:
return self.cache[key]
except KeyError:
return None
@property
def all_cache_items(self) -> None | dict[Any, Any]:
return self.cache
def _get_index(self, key: int, index: str) -> None | str:
try:
return self.cache[key][index0][index1]
except KeyError:
return None
what would the await ctx... be for the unban if you are unbanning
hmm okay thanks
thats not how things work .unban is a method from the Member class
The typehint for all_cache_items is wrong
Also wouldn't it make sense to make the Key & Value generic types
how
For type-safety
Because it always returns a dict, your default is an empty dict etc
It never returns None
yeah ik i gotta fix that i think i did but i copypasted something old
i mean it can return str, int, bool and others
@slate swan have you any idea why this ^ script isnt working?
Yea, but you typehinted it as Any so you have no clue what the type is actually
yo I got the most strange problem:
I have a command to remove all of a users roles (+strip)
When I use the command, it doesn't remove all the roles, only some and provides no error.
code: ```py
@commands.command(name="strip")
async def strip(self, ctx, member: discord.User):
guild = bot.get_guild(915357451484790916)
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == member.id:
member = await bot.fetch_user(x)
member_real = guild.get_member(member.id)
print(Json_Items[i][x]['roles'])
for c in Json_Items[i][x]['roles']:
role_remove = get(guild.roles, name=c)
print("removed role: "+c)
await member_real.remove_roles(role_remove)
await ctx.send("User roles striped")```
gif of whats happening:https://gyazo.com/cf5a57ca721daf9e248486e6d64c564d
yeah because it can take multiple types
Then you should typehint it as so, otherwise it isn't really type-safe
wth indentation
typehint it with what union?
??
KeyT = TypeVar("KeyT")
ValueT = TypeVar("KeyT")
class Cache(Generic[KeyT, ValueT]):
def __init__(self) -> None:
self.root: dict[KeyT, ValueT] = {}
```For an example
So then you could do ```py
cache = Cachestr, int
reveal_type(cache.root) # dict[str, int]
yeah, I dont get why it doesnt even mention anything, help?
what the heck does TypeVar class do show the data type?
NOne
new type i see
Yea but do you understand what I'm saying here
Making it generic is better than using Any
And ensures type safety
im not even sure what Generics do lol
type safety as?
Think of the word "generic"
Means you know what the type is, instead of it being Any
i know what generic means im saying what action it does
I tried adding a 2 second timer on each role removal
It makes the class Generic
and it still doesn't remove all the roles
generic by?
i just odnt understand it
there is no error, its just not doing anything. what am i missing?
@client.event
async def on_member_join(member):
channel=client.get_channel(945789074663436318)
emb=discord.Embed(title="NEW MEMBER",description=f"Thanks {member.mention} for joining!")
await channel.send(embed=emb)
this is my fist try with embeds so idk if its right
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
The class has an arbitrary type or whatever along those lines
not sure what you mean
I used await asyncio.sleep(2)
by arbitrary
??
You should read up on it, if you're making your wrapper typehinted you should be typehinting correctly
do you have a example situation being used in rin?
ill check it out as well
What would the line of code be for the bot to unban a user with the given server ID?
I just need that one bit.
!d discord.Guild.unban
await unban(user, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unbans a user from the guild.
The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
also it bypasses other things rate limit,s like it just goes until it can when adding roles (and goes after the rate limit), I don't get why its different for removing roles
await unban(user, *, reason=None)?
await unban (ctx, member: discord.User, reason=None)
so where's the bit which unbans from the other server
await remove_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Removes [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s from this member.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
How, this is my code so far:
@commands.command(name="mainunban", aliases="mub")
@commands.has_guild_permissions(administrator=True)
async def mainunban(self, ctx, user: discord.User, reason:str=None):
"""Unbans the user from the main server."""
main = 929308819526414387
await unban (ctx, member: discord.User, reason=None)
ube = discord.Embed(title=f'{member.name} was unbanned!, description='')
ube.set_footer(name="Moderator ID:", value=f'{ctx.author})
ube.set_thumbnail(url=ctx.guild.icon_url)
ube.timestamp = datetime.datetime.utcnow()
await ctx.send(embed=ube)```
!d discord.Member
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").
x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
hash(x) Returns the member’s hash.
str(x) Returns the member’s name with the discriminator.
you lost ' here ube = discord.Embed(title=f'{member.name} was unbanned!, description='')
ok
what ya mean
ok
await fetch_guild(guild_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") from an ID.
Note
Using this, you will **not** receive [`Guild.channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.channels "discord.Guild.channels"), [`Guild.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.members "discord.Guild.members"), [`Member.activity`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.activity "discord.Member.activity") and [`Member.voice`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.voice "discord.Member.voice") per [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member").
Note
This method is an API call. For general usage, consider [`get_guild()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.get_guild "discord.Client.get_guild") instead.
depends on lib
No documentation found for the requested symbol.
which one is the easiest to use

then nop
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
hmmmm
i can't seem to install it
You gotta install discord.py through github in order to get them
oh ok
🗿
yeah but other features
Rin had buttons but I removed them for the refactor!
when it comes out in 50 years🏃
There are some minor changes like avatar_url to avatar.url
I have only action row and text modals right now
yes
Yes
I don't use C or Cython right now, no
it would be better regardless
But when I add voice I'll be writing bindings in either rust or C++
Rust🗿
That's if I ever get to voice 😔
andy
I gotta finish models first
you lesson to devs to make the wrapper better? so like you take the word from the community
yes I am part of it
so its kinda ran by the community or based off its ideas
same here
Weird how rin turned out
how so?
who is rin :
You know the whole reason why I wrote rin was out of spite since another wrapper dev tried to scout me for their wrapper
Then I looked at their source code which looked god awful
So I decided to flex on them with rin
now youre doing it to me🗿
And the previous wrapper I made before rin was also out of spite kek
For which?
lefi?
Yea
lol
chad move
🗿
andy has something wrong with him to flex on everyone
🙄
check if fortnite has an api
🗿 is there a way to sort member permissions to return a list with moderation perms instead of all of their perms even the generic ones
there's literally an API for nearly everything on python
it's a huge community
not an api for you
I found a dogecoin API
😦

and lots of other ones
weird and wacky
pycardano
why u....why u no API me 😦
cause no api for you🗿
!pypi backrooms
😳 ayo
🗿
{
banwords = ["тупой", "дуб"]
}
erorr
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 1 (char 2)
is it?
where
ah ic
thats nice
why
watch the bot get written in js💀
😭
They wouldn't do that
It would be very discouraging to learn python if the python bot was coded in javascript
it was a joke bro
Would've liked to see hikari be used or something
yeah but it would be hard to rewrite the whole bot
How advanced is hikari right now?
The main advantage of python based wrappers is the decorator syntax, rust is ok for discord bot's but the macros are just not it
In my opinion at least the main advantage is the decorator syntax
Other langauges you need to register via call, etc
Don't even get me started on cpp
Help
I cba
i genuinely cant tell what's wring with this, there is no error. it just doesn't work.(yes intents are there )
@client.event
async def on_member_join(member):
channel=client.get_channel(945789074663436318)
emb=discord.Embed(title="NEW MEMBER",description=f"Thanks {member.mention} for joining!")
await channel.send(embed=emb)```
how can i handle multiple selections with discord_components? like, if the person select something on menu and want to select other thing, don't show "this interaction failed"
its better than all those dpy-wannabe-forks
Theres nothing wrong with the forks?
The whole point was for forks to be made
have you even tried hikari as a library
Like what are we going to do? Use discord.py, miss out on every single new feature until the library just eventually breaks?
@commands.command(name="strip")
async def strip(self, ctx, member: discord.User):
roleslist = []
guild = bot.get_guild(915357451484790916)
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == member.id:
member = await bot.fetch_user(x)
member_real = guild.get_member(member.id)
print(Json_Items[i][x]['roles'])
for c in Json_Items[i][x]['roles']:
role_remove = get(guild.roles, name=c")
roleslist.append(role_remove)
await member_real.remove_roles(role_remove1, role_remove2)
await ctx.send("User roles striped")
``` yo anyone now how I would get the list "roleslist" in this format ``await member_real.remove_roles(role1, role2 etc)`` with the list?
What are its pros and cons compared to something like pycord
i dont know any way to do it
Where is this method located
all pros, no cons, there's so many I cannot possibly list all of them
some are:
- choice of command handlers
- easy to work with music libs
etc
sorry?
can anyone help me?
Can you give an example? Seems like everything in their samples folder, you can do with dpy
Relatively easily too
discord.ext.commands is not pushed on dpy users at all, in my opinion
Like, is it in a class, or is your bot just a single file
single file
Soo the modules are just disjoint from the project, and if one becomes the best in its field, then there’s no point in having this extensibility anyway…other projects would just end up merging it into the main repo, even
Grs are you like always talking here
But like, that’s not to say you can’t do this with discord.py either
Lol, definitely not, I see @slate swan more than anyone here
Alright lmao, just I was on here at like 2 am last night and you were talking and now it’s 5 pm and you’re still on
ah found it, stack overflow always coming in clutch, you gotta use ```py
member = await bot.fetch_user(x)
member_real = guild.get_member(member.id)
await member_real.edit(roles=[])```
the penguin gun man is here a lot too
Nah, just got back from class a few hours ago
. Slept at 3am cause discord arguments are pretty entertaining
strange bug tho
what needs to change if its a single file?
i think its a bug with discord.py,
if anythib
stack overflow is a lifesaver
is there a way to make a users name in chat appear blue like a ping without actually mentioning that person?
Nothing actually, I was suspicious that it was in some random class
Ah alright, I came to check the channel and saw you talking and was like wtf
literally 😄
Lol, deja vu
then what needs to change? no error it just doesnt work
That place is toxic af. Avoid at all costs, also that djs server
The dpy server is fine if you actually know python
Does your bot actually start
yes
Only if you're a beginner
They have it listed that a basic understanding of python is required
i'll try to filter them manually using a dict 
Yeah, actually, if you were to meet face to face with the people you argue with here, you’d probably get along as best friends 😄
Something about discord, man
bruh i dont get this, no error, bot starts, just silence. 😭
soo any other reason it wouldnt worek?
I’m stumped, but have you actually tried joining the server with an alt, or something while the bot is running
yes
Print something at the start of the method?
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.
kofc
@slate swan https://paste.pythondiscord.com/ohebikimon
and @alpine furnace if ur intrested
its around line 98
oh
All the commands are registered under bot, and you run bot, but not client
where?
what shouldi put there
and change line 98 to @ bot.event
Yeah
k'
And that on_ready too
laorght
@alpine furnace async def on_ready():
TypeError: Client.event() missing 1 required positional argument: 'coro'
thats the on ready
Did you put () after bot.event
Remove the ()
Hey
ayo
wow no arguing today
i cant get this to work and i really dont know why...
authorfoot = ctx.author + 'response time: ' + 'placeholder'
embed.set_footer(text=authorfoot)
await ctx.send(embed=embed)```
but this does work
```py
authorfoot = ctx.author
embed.set_footer(text=authorfoot)
await ctx.send(embed=embed)
TypeError: unsupported operand type(s) for +: 'Member' and 'str'
im super confused
you can’t add a member object to a string
str(ctx.author)
make it a str with str method
^
anyone wanna give an quick opinion on something in #databases? 
🗿
how do you put api's on a discord bot? or to be more specfic how does dank memer insert a meme whenever u type a command?
mostly use async api wrappers or just make the request yourself
alright. im still begineer in python so what should i go learn about before coding a discord bot?
well you will need to learn oop async programming and basic python
im pretty decent in basic python. but ill learn async coding
and do you know oop?
no
yeah i have a lot to learn lmao
and after that you can learn dpy https://vcokltfre.dev/
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.

and then you could migrate to a fork or just learn with a fork
cool ill bookmark that ty
yw
Quick Question (I know this is a python server) but would it be better to make a eco bot with js or py?
i think i lied. i dont really know all of basic python yet. im still learning functions
im on default arguments
depends on what youre comfortable with
I understand python more but I’ve heard js is overall faster and better for eco bots
then you have allot to learn!
help pls, How can I tag a member @member and make the bot get the id of the member I tagged?
yep! but im willing to commit to it.
Look up python tutorials and just sit back relax and watch
i mean js is fast but py isnt crazy slow and it wont make a difference tbh
Alright thanks
yeah. i also try to follow along with them. but i keep getting nervous because im not exactly memorizing it
use a member argument thats a member obj which you can use the id attr
yw
im trying to memorize it but its a lot
yes it will take months to master
It’s a weird tip but it actually helped me understand more go copy some code and rewrite it. It helped me memorize what and how to write stuff especially with discord bots
once im done with this full course ill start working on more projects
nice
its like 12 hours of videos. cause i bought this course from mosh hamedani for like 20 bucks. since i really liked his 1 hour course
interesting. thx for the tip.
i did whois dyno rip-off, i think it's decent, what u guys think
Directly stolen from dyno
🗿
The join time should be using discord timestamps
Same with account registration
Would look a lot better and more interactive
Also accounts for timezones
I wish discord allowed the end user to choose how the timestamps were formatted
Like maybe a drop down menu
i was sure someone will say this 🗿 tbh i don't quite understand how the discord timestamp works
It's simple
doesnt even have a timestamp
<t:1231231239>
<t:1231231239>
🗿
Theres something in dpy that can help you create it
🗿 then it's an absolute success, though there's one problem that makes no much sense
the roles are reversed like displayed from bot to top in hierarchy instead of the opposite
You could reverse the list
So it goes the other way
🗿
!e
your_role_list = ["a", "b", "c", "d"]
your_role_list.reverse()
print(your_role_list)

bro
@final iron :white_check_mark: Your eval job has completed with return code 0.
['d', 'c', 'b', 'a']
You saw nothing

You don't need to, just use the helper method for it
!d discord.utils.format_dt
discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.9)") for presentation within Discord.
This allows for a locale-independent way of presenting data using Discord specific Markdown...
allroles = [r.mention for r in member.roles if r != ctx.guild.default_role]
roles = ", ".join(allroles)
🗿 what can i reverse in this though
nvm
member.roles
🗿
can't do that 🗿
Expected type 'collections.Iterable', got 'None' instead
Oh yeah
isn't this like using datetime ?
.reverse() doesn't return the reversed list, it just reverses the list and returns None
Cause lists are mutable or smth
🗿

You just pass in member.created_at for an example to the function
Then it returns a discord formatted timestamp for you
oh
Just add a line in-between those reversing allroles
That should work
🗿
moai spreads
!e
print(["a", "b", "c", "d"].reverse())
@slate swan :white_check_mark: Your eval job has completed with return code 0.
None
🗿
🗿
🗿
not sure how that returns none
bor
thats what im saying
e
iirc when you use a method on a string it returns a new string because strings are immutable
!e
print([1, 2, 3, 4].reverse())
@slim ibex :white_check_mark: Your eval job has completed with return code 0.
None
thats so dumb
it doesnt return anything it just changes the state of the list
🗿
🗿
^
Well, sorted exists
I was about to say you were wrong at first cause you said lists were immutable
watch him
LMAO
yep
But then you fixed it
I'm running on 5 hours of sleep
I mean reversed
🗿
!e print(["a", "b", "c", "d"].reverse())
@slim ibex :white_check_mark: Your eval job has completed with return code 0.
None
!d reversed
reversed(seq)```
Return a reverse [iterator](https://docs.python.org/3/glossary.html#term-iterator). *seq* must be an object which has a `__reversed__()` method or supports the sequence protocol (the `__len__()` method and the `__getitem__()` method with integer arguments starting at `0`).
o lma
List methods generally edit the state of the list, instead of creating a new one
!e
print(list(reversed([1, 2, 3, 4, 5])))
@slim ibex :white_check_mark: Your eval job has completed with return code 0.
[5, 4, 3, 2, 1]
I've mistook list.reverse() to also return a reference to itself many times
A few days ago I fell into a trap of using a default mutable for my class constructor
unlike str methods that return a new string
no
💀
to be fair I've never had that happen to me until recently so
ok indeed this looks more clean than my strftime 🗿
can a lambda take in *args, **kwargs?
I'd assume so but like
wait imma stop before ashley ots me
||ik ur lurking ashley||
Yes
🗿 what do you even mean by that
allroles = [r.mention for r in member.roles if r != ctx.guild.default_role]
allroles.reverse()
roles = ", ".join(allroles)
🗿
i was trying to make it so when you do !clear, as long as you have the right role, it will delete the channel, but im getting the error: user is a required argument that is missing.
@bot.command(name="clear")
@commands.has_role(945325312533729311)
async def someCommand(ctx, user: discord.TextChannel):
user.roles
if role in user.roles:
await ctx.send("Confirmed! Deleting channel in 10 seconds, no turning back!"),time.sleep(10),await ctx.channel.delete()
else:
await ctx.send("Sorry, you cant do that D:")
this is from an old stack overflow so it might be outdated
ohh so like !clear #channel1
lemme try
user: discord.TextChanne lol
🗿
useless else lol
Not really
yes really
if role in user.roles:
return await ctx.send("Confirmed! Deleting channel in 10 seconds, no turning back!"),time.sleep(10),await ctx.channel.delete()
await ctx.send("Sorry, you cant do that D:")
it wouldnt continue
and time.sleep🏃
whats wrong with time.sleep?
Blocking
its sync it stops your whole code
ohh
use asyncio.sleep which only sleeps on the coro
i guess ive never had 2 codes that could be going at the same point
await asyncio.sleep(10)
hmm il look into that
do i need a library for that orr
no its only that code not 2
yes which is a built in
so i just cant do 2 !clears simultaneously
🗿🗿 i feel like resourcing myself rn, there's the fixed version anyway
better than dyno certified moment 
is there any way to make it so it doesnt need a channel mentioned
wait yeah
you can make it recognize the channel the cmd came from right?
that is async yes
alr that wont matter muich but thats good to know
!d discord.ext.commands.Context.channel
Returns the channel associated with this context’s command. Shorthand for Message.channel.
yeah
thats what i thought
i mean, im in test.
@bot.command(name='clear', help='delete a channel with the specified name')
async def clear(ctx, channel_name):
guild = bot.guilds[0]
existing_channel = discord.utils.get(guild.channels, name=channel_name)
# if the channel exists
if existing_channel is not None:
await existing_channel.delete()
# if the channel does not exist, inform the user
else:
await ctx.send(f'No channel named, "{channel_name}", was found')```
Use ctx.guild
Yes
i mean, im in test.
@bot.command(name='clear', help='delete a channel with the specified name')
async def clear(ctx, channel_name):
existing_channel = discord.utils.get(ctx.guild.channels, name=channel_name)
# if the channel exists
if existing_channel is not None:
await existing_channel.delete()
# if the channel does not exist, inform the user
else:
await ctx.send(f'No channel named, "{channel_name}", was found')
oh ok
Don't spoonfeed
You've been sold so many times
dude dont minimod
It's not mini-modding by any means, spoonfeeding is just not the way to help someone out
what is the best library for discord buttons
disnake has all that stuff
at least spoonfeed correctly 🗿
i find it really confusing :\
Any tbh I can’t use anything execpt the basic since I can’t get above 3.7 and buttons and slash commands work fine
You have examples on their repo
🗿
good point, i got a bit to aggressive there. sorry
sorry pep8
@bot.command(name="open")
async def open(ctx):
guild = ctx.guild
admin_role = guild.get_role(945847161596297277)
overwrites = {
guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True),
admin_role: discord.PermissionOverwrite(view_channel=True),
guild.me: discord.PermissionOverwrite(view_channel=True)
}
channel = await guild.create_text_channel(f"private-channel{ctx.author}", overwrites=overwrites)
await channel.send(ctx.author.mention, "Hi! for help on how to order, do !help")
await bot.delete_message(ctx.message)
``` any way this could be done? i keep getting the error takes from 1 to 2 positional arguments but 3 were given
which line raises error
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\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: TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given
its in the libraies somewhere
i assume its from await channel.send(...)
i think its from the delete
!d discord.abc.Messageable.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
bc i just added that, i need someway for it to make the channel, then delte the comd
it only takes one pos arg
send the part of the traceback before the part you just sent
Traceback (most recent call last):
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\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: TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given
Ignoring exception in command open:
Traceback (most recent call last):
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\trent\Desktop\DiscordBot\discordbot.py", line 100, in open
await channel.send(ctx.author.mention, "Hi! for help on how to order, do !help")
TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\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: TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given
await channel.send(ctx.author.mention, "Hi! for help on how to order, do !help"), look at that
yeah it is the send
mention_author is a kwd arg
that only started when i added the delete
put the string before ctx.author.mention
same error?
same thing
await channel.send("Hi! for help on how to order, do !help", ctx.author.mention)
do await channel.send("...", mention_author=True)
so it worked though
also prolly shouldn't name the function open
like every command?
Unhandled exception in internal background task 'time_check'.
Traceback (most recent call last):
File "C:\Users\jackr\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\tasks_init_.py", line 101, in _loop
await self.coro(*args, **kwargs)
File "taken.py", line 75, in time_check
await updateDate()
File "taken.py", line 93, in updateDate
date = datetime.now()
AttributeError: module 'datetime' has no attribute 'now'
datetime.datetime.now
@slim ibex ur always here
or utc.now
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.
2 instances of bot might be running
lemme check
you can end python processes in task manager
ok yeah phew
Unhandled exception in internal background task 'time_check'.
Traceback (most recent call last):
File "C:\Users\jackr\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\tasks_init_.py", line 101, in _loop
await self.coro(*args, **kwargs)
File "taken.py", line 75, in time_check
await updateDate()
File "taken.py", line 119, in updateDate
await channel.edit(name=f'﹕📋﹕daily﹕{month}-{date.day}')
AttributeError: 'NoneType' object has no attribute 'edit'
i though i was in trouble
what ever channel is, it is returning None
is it a variable?
show the rest of the code
y is a 14 year old smarter than me
💀
why? just wondering
because open() is a built in function
when your code runs, it checks variables/func in the order of local, enclosed, global, builtin
I'm curious how this didn't raised a warning in his ide
and since builtin is last, you override the open() function
lol
don't think vscode raises that stuff
pycharm def does
Yeah
its preference
what are the advantges
anyway, new error
Some saying pycharm is harder to work with but imo vsc is harder since lacking a lot of stuff kek
Vscode is lighter and has more extensions and very easy to use
Pycharm is meant specifically for python but is quite bit complex
^
Ares, What does vscode lack?
I find pycharm very easy to use
vsc is not even an ide to begin with

idk why people say pycharm is complex
It's quite simple
noone's saying it's an ide mate
Venvs scare people 
Pycharm is too heavy for me 🏃
😔
I would have bricked my python installation so many times if I didn't use venvs
as if pycharm is the only workspace using venvs
venvs*
No matter your development environment
It was a typo 🗿
alright 1 thing, i want to use await message.delete(), but that doesnt seem to work with my code
@bot.command(name="open")
async def open(ctx):
guild = ctx.guild
admin_role = guild.get_role(945847161596297277)
overwrites = {
guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True),
admin_role: discord.PermissionOverwrite(view_channel=True),
guild.me: discord.PermissionOverwrite(view_channel=True)
}
channel = await guild.create_text_channel(f"private-channel{ctx.author}", overwrites=overwrites)
await channel.send("Hi! for help on how to order, do !help", mention_author=True)
```
ctx.message.delete()?
msg not defined
what's the message variable?
nvm new error
c:\Users---\Desktop\DiscordBot\discordbot.py:101: RuntimeWarning: coroutine 'Message.delete' was never awaited
ctx.message.delete()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Await it
And its not an error, it's a warning
so ignore it
but you need to await it since it's a coro
wh
That's what the warning says.
If you don't await it will not work 
got that part 👍
@final iron I'm gonna ruin your whole career
I had 300 pep8 warnings before rewriting my code in one of my cogs 
you don't use the is statment with a class
I don't even know what to say
🗿
!d isinstance
isinstance(object, classinfo)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") exception is raised.
Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
I fixed them anyway, I feel like my soul ascended
Because it gets triggered on every on_message...
you'd have to cache what user is using the modmail already so a new modmail doesnt start
🫂
And check if the author is in the cache before proceeding
@final iron it worked ily man thanks
🗿
+1


