#discord-bots
1 messages ยท Page 1060 of 1
Well ```py
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
though maybe permanently later im not sure
Is the data user specific? Like would one player have a dif value than another?
I feel more like it's a list of objects
he needs all objects where the attribute matches something
at the moment the program can be restarted, resetting all values
Well 1, 2, 3 can be objects, it's just about the inventory size and order.
ideally later on i would have it save the info between "sessions" but i have no clue how to do so
If so, use a list of dicts like
[
id: value,
id2: vale,
. . .
]
Well i'd suggest a Item class instead of a dict.
Thats rlly expensive for storage
!e
class Item:
def __init__(self, name, is_active):
self.name = name
self.is_active = is_active
def __str__(self):
return f"<Item name=\"{self.name}\">"
items = [Item("e", True), Item("sus", False), Item("fungus", True)]
filtered_items = map(str, filter(lambda x: x.is_active, items))
print(", ".join(filtered_items))```
@vale wing :white_check_mark: Your eval job has completed with return code 0.
<Item name="e">, <Item name="fungus">
so far, ive got an inventory class which is simply a list of the different "items" all default set to false.
how do i add typehints or descriptions for the argument in a slash command?
Well it depends, obv you don't store the whole object long term.
as players interact with items during play, it will set the items they interact with to true
and i want a way to print only the trues from that class list
if im doing somethin wrong there feel free to correct me
Use this method but with dicts (you will only need to change the lambda)
im sure there is tons of ways to optimize my code; lack of knowledge means its a mix of shiz atm
Tho class is better
!d discord.app_commands.describe
@discord.app_commands.describe(**parameters)```
Describes the given parameters by their name using the key of the keyword argument
as the name.
Example...
i understand some of this; reckon u could go through it with me in dms?
filter(function, iterable)```
Construct an iterator from those elements of *iterable* for which *function* returns true. *iterable* may be either a sequence, a container which supports iteration, or an iterator. If *function* is `None`, the identity function is assumed, that is, all elements of *iterable* that are false are removed.
Note that `filter(function, iterable)` is equivalent to the generator expression `(item for item in iterable if function(item))` if function is not `None` and `(item for item in iterable if item)` if function is `None`.
See [`itertools.filterfalse()`](https://docs.python.org/3/library/itertools.html#itertools.filterfalse "itertools.filterfalse") for the complementary function that returns elements of *iterable* for which *function* returns false.
Cool function trust ๐
Be glad Exenifix typed it, i would've add scary typehints as well
lol
how sad
๐ฅฒ
It's probably better to use list comprehension instead of map+filter cause we will only do one full iteration instead of 2
anyone know how to get a member without pinging them (nextcord)? (?infouser iamamember/iam instead of ?infouser @iamamember)
ashley
use slash commands ease
and dont ping random members, please
which db do u prefer for sql
eh
didn't realize i pinged them
sqlite, i even use django's sqlite orm, so i prefer that
well, anyways, you cant mention a member without mentioning them
(unless slash cmds)
well
i searched in google and they said something like highlight
Well for bot you can revoke the AllowedMentions resulting in highlighting without ping.
It will be
'while running the command'
Now map+filter is faster
what does list comprehension actually mean
So yeah use builtins that are written on c
it is a way to iterate through list without using a loop
How do you have a @bot.command() only be callable in a certain channel?
Use a check for it
What does a "check" look like?
I don't remember correctly but I think it is this
@commands.check(lambda ctx: ctx.channel.id == 123456789012345678)```
!d discord.ext.commands.check
@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or its
subclasses. These checks could be accessed via [`Command.checks`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.checks "discord.ext.commands.Command.checks").
These checks should be predicates that take in a single parameter taking
a [`Context`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context"). If the check returns a `False`-like value then
during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure") exception is raised and sent to
the [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event...
without a loop?
i mean, without a classic loop
next()
WhiskeyBot [Beta] BOT
โ Today at 9:13 AM
This command is outdated, please try again in a few minutes
Only you can see this โข Dismiss message
OOF
like for _ in list: #do_something
iter()
Yes this happens
a loop is a loop
Wait a few minutes as it says
reloading fixes it for me though
interaction_check goes under button class or view class?
There's while loop
Or you want no loops at all
It's a list that generates itself. And it's a comprehension of ordinary methods.
hello
does any one know how i can handle this error: TypeError: Main.on_message() missing 1 required positional argument: 'message'
!e py nice_list = [0, 1, 2] it = iter(nice_list) print(next(it)) print(next(it)) print(next(it))
@vale wing :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 1
003 | 2
There you go no loops ๐ฉ
how can i respond to the slash. it keeps saying the application did not respond.
How does your on_message look like
async def on_message(message: discord.Message):
...
it takes an argument
Wrong ping
@client.event
async def on_message(self,message):
channel = str(message.channel)
if channel == '??':
if message.content == f"{self.sign}start":
client.loop.create_task(self.my_background_task())
if message.content == f"{self.sign}stop":
start = False
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
Is this a cog
apologies
no
Then why self
they are subclassing Bot
hmm... how do i remove all of a โ reaction?
im crying blood trying to fix it
The what
wait what
Check the methods of discord.Message in docs I don't remember the correct name
class discord.Message```
Represents a message from Discord...
!disnake message
Same for disnake
That's on views not buttons
Buttons are inside of views ๐
I recommend finding a tutorial about cogs (my apologies I don't know any modern guides) and implementing them in your code
its clear_reaction for a specific one and clear_reactions for all of them
np thanks for help
you subclass view to directly add buttons
Oh means button = Button(all stuff)
view = View(button)
await ctx.send(view)
Alright let me check the docs deeper
Nah do as in examples
It's not there for buttons
hmm... how do i add options to a button like :checkmark:, :furheart:, or both
thats what i was looking for lol. edit: i found what i was lookign for
not button i mean slash command
this is a button .......
Nice
See docs are easy
For python libs
For java libs most of them are as aids as java itself ๐
I'm coding in java rn
Me too
im gonna start learning rust๐ณ
I needed to convert a json response to an object, I've never been more scarred.
Did that too, starting java now.
Was trying to make doc to pdf converter and spent like a day trying to find a normal lib (I haven't found one yet)
lmaoo
Most of them have last commit in 2016 and depend on old artifacts
Bruh searching a java lib is like searching someone who know machine language
Ah yes
you will have to do it by your own 
how can i add options to a var in a slash command?
API working in java is cool (sarcasm)
package com.example.myapplication;
import java.util.List;
class Coords {
double lon;
double lat;
}
class Weather {
int id;
String main;
String description;
String icon;
}
class Main {
double temp;
double feels_like;
double temp_min;
double temp_max;
int pressure;
int humidity;
}
class Wind {
double speed;
int deg;
double gust;
}
class Clouds {
int all;
}
class Sys {
int type;
int id;
String country;
int sunrise;
int sunset;
}
public class WeatherData {
String base;
int visibility;
int dt;
int timezone;
int id;
String name;
int cod;
Coords coord;
List<Weather> weather;
Main main;
Wind wind;
Clouds clouds;
Sys sys;
}
``` this is what i needed to make in the end.
Lol
This is how you get json response in java ๐ ๐
app/src/main/java/com/exenifix/weatherapp/WeatherService.java lines 92 to 101
input = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = reader.read()) != -1) {
sb.append((char) cp);
}
input.close();
return new JSONObject(sb.toString());```
tbh at first i just wanted to handle everything inside the try/except since I was honestly too annoyed to also do this but I did it anyways.
Some libs provide easier requests management but imho everything just starts to look even more flooded
I used Volley
Still figuring out what the best libs are and syntax etc.
Took me a solid 20 min also to figure out the List<> bcs some idiot at the api decided to put the info in a list-dict with only one list item.
ok, so i heard there's no such thing as boost events, but there's ghetto workarouns, so how would i be able to detect when a member boosts 2 times?
The "golden standard" are apache http (or whatever it is named), OkHTTP, retrofit and I think Spring
Btw have you tried to build a discord bot with java ๐
@vale wing how can i pass client into a cog
How do I fix this?
for client event
Did you find a tutorial?
yess
Could you link me it
you serious?
In this video, we learn about cogs and how to implement them in a discord bot.
If you have any suggestions for future videos, leave it in the comments below.
GITHUB: https://github.com/Rapptz/discord.py
DOCUMENTATION: https://discordpy.readthedocs.io/en/latest/
OFFICIAL DISCORD.PY SERVER: https://discord.gg/r3sSKJJ
JOIN MY HELP SERVER: https:...
i cant use client.event
@commands.Cog.listener()
https://docs.disnake.dev/en/latest/api.html?highlight=slash#disnake.SlashCommand.add_option
how would that look in code?
oh thanks
would it be @thorny zodiacnake.SlashCommand.add_option()
what piece of code (and where) would i need to write to be able to generate a list of all Inventory items which are set as "Yes"(True)
OR
what code should i replace to get the same effect as im after above?
class Inventory:
Gold_Serpent_Ring = "No"
Bag_Gold_Coins = "No"
Start_Scroll = "No"
SJ_Sword = "No"
@bot.event
async def on_message(message):
global Location
global Inventory
if Location == Location.A1S1_OPEN_CHEST:
if message.content.upper() == "A":
Location = Locations.A1S1_START_ROOM
elif message.content.upper() == ["B", "C", "D", "E"]:
Location = Locations.A1S1_LOOTED_CHEST
CHEST_CONTAINS_ITEM = "No"
if message.content.upper() == "B":
Inventory.Gold_Serpent_Ring = "Yes"
elif message.content.upper() == "C":
Inventory.Bag_Gold_Coins = "Yes"
elif message.content.upper() == "D":
Inventory.Start_Scroll = "Yes"
elif message.content.upper() == "E":
Inventory.Gold_Serpent_Ring = "Yes"
Inventory.Bag_Gold_Coins = "Yes"
Inventory.Start_Scroll = "Yes"
else:
await message.channel.send("You can't do this. Try again.")
return
hello
hopefully an example helps more than before :l
hi
can someone help me fix this
Traceback (most recent call last):
File "main.py", line 1, in <module>
from discord.ext import commands
File "/home/runner/Trade-Message-Sender/venv/lib/python3.8/site-packages/discord/init.py", line 25, in <module>
from .client import Client
ImportError: cannot import name 'Client' from 'discord.client' (/home/runner/Trade-Message-Sender/venv/lib/python3.8/site-packages/discord/client.py)
huh import discord.client?
Are those classvars supposed to be static
u speak technical lol
u mean class variables?
Yes
static meaning what..
Cause it breaks the async principle
When changed for class changed for all instances of class
Seems like you don't use instances
probably not
And your class is sort of an enum but it is not constant
https://paste.pythondiscord.com/ofisopixun man it is not working no error
my code has lots of lengthy bits coz idk the terminology to shorten em
?
on_member_join only takes member as arg
also, you need members intents for the event to get invoked
I do but it wont work let me try again
make sure it's enabled in dev portal and the code as well
!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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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.
you dont have to import client just do this : client = commands.Bot(command_prefix = sign)
i didn't
did you copy paste code?
selfbots aren't supported my guy
It still wont work
what did you change?
enabled in dev portal as well?
and you changed the params of on_member_join too?
I'm wet
is it raining at your place too?
Yes
Calm down panda
explains a lot
๐
@jagged adder well maybe this is what you are looking for
class Inventory:
i_some_nice_item1 = False
i_another_nice_item1 = False
for i in dir(Inventory):
if i.startswith("i_"):
setattr(Inventory, i, True)```
You know how heavy my fur is now
Weird thing yeah
Just use an enum at this point
Yes enums are good but I never used them for setting
Then don't set a default value
i used an enum for my locations
class Locations(Enum):
A1S1_START_ROOM = auto()
A1S1_OPEN_CHEST = auto()
A1S1_LOOTED_CHEST = auto()
A1S1_LOOTED_CHEST_RNG = auto()
A1S2_TRAPPED = auto()
A1S2_TRAPPED_DIALOGUE = auto()
A1S2_TRAPPED_REMAINS = auto()
A1S2_TRAPPED_RUNES = auto()
A1S3_HALLWAY = auto()
DEATH = auto()
but i still dont know how to pull a list :l
As I said.
dataclasses be like
It's simple key-value
your structure is just wrong, rethink it
I'd make a dict + a class.
it's a List[Location] that you're most likely looking for
where Location is an Enum
Group them
though that's not very user friendly
class Inventory:
Gold_Serpent_Ring = "No"
Bag_Gold_Coins = "No"
Start_Scroll = "No"
SJ_Sword = "No"
is it still an enum if the word aint there
mhm, if you have subcommands, sure
but for 1 command, a space? just shorten it and explain in the help command I'd say
Use booleans for that pls
Can't link up doc rn I'm on phone
Nah it is a class with some static vars inside, enum adds some more functional
u mean true/false?
right
yeah i could do that but didnt see why tbh
any idea?
and i thought it would need more code for some reason
not true
just check out documentation of dataclasses, since that's most likely what you want
also, not related to this channel
would u just type it as
class Inventory:
Gold_Serpent_Ring = False
```
or somethin
that just looks wrong
umm when im adding a slash commands option via @thorny zodiacnake.SlashCommand.add_option() does it go before or after the async def
ye is that how it'd be typed out tho
ah
is this right
@commands.slash_command(name="remove reaction", guild_ids=config)
@disnake.SlashCommand.add_option()
async def
class disnake.Option```
Represents a slash command option.
^
It still wont work https://paste.pythondiscord.com/rayizikite
error?
!d discord.ButtonStyle.PRIMARY
No documentation found for the requested symbol.
no error but its not adding the role to the user
!d discord.ButtonStyle.primary
yeah its blurple
where are you even assigning it...
correct
Guys I coded a level system but I get one error can someone check code soon and correct it ? Iโll send code soon
Bruh not level system
warning system ๐
sure
and btw, dont follow glowstik for levelling ๐
What does he do?
Imagine not using uppercase for Enums
discord.py moment
- connects to the database in the on_ready event
- writes a lot of redundant code
- over-complicates simple stuff
I mean, imagine creating two tables, one for storing xp and one for level....
Yes. Wdym?
where*
Nope alright am done
where is timeout defined?
huh?
async def on_member_join(self, member, Role: discord.Role, ctx):
role = member.guild.get_role(832120561848156180)
guild = self.client.get_guild(730651046459998218)
channel = discord.utils.get(
member.guild.channels, id=885464532959526913)
if guild:
print("guild ok")
else:
print("guild not found")
if channel is not None:
Myembed = discord.Embed(title=f"Welcome",
description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
Myembed.add_field(name="Account Created at:",
value=f"<t:{int(member.created_at.timestamp())}:R>", inline=True)
await channel.send(embed=Myembed)
await member.add_roles(role)
else:
print("id channel wrong")``` Is that it?
whats the error.....
Why ctx
pffttt
no error just doesnt add the role
async def on_member_join(self, member, Role: discord.Role, ctx):
role = member.guild.get_role(832120561848156180)
guild = self.client.get_guild(730651046459998218)
channel = discord.utils.get(
member.guild.channels, id=885464532959526913)
if guild:
print("guild ok")
else:
print("guild not found")
if channel is not None:
Myembed = discord.Embed(title=f"Welcome",
description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
Myembed.add_field(name="Account Created at:",
value=f"<t:{int(member.created_at.timestamp())}:R>", inline=True)
await channel.send(embed=Myembed)
await member.add_roles(role)
else:
print("id channel wrong")```
ctx isnt valid.......in this event
I'mma go
!d discord.on_member_join as hunter said
discord.on_member_join(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") joins a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
And yea, role too
So is that right?
Thats what it has added
@commands.Cog.listener()
async def on_member_join(self, member):
role = member.guild.get_role(832120561848156180)
guild = self.client.get_guild(730651046459998218)
channel = discord.utils.get(
member.guild.channels, id=885464532959526913)
if guild:
print("guild ok")
else:
print("guild not found")
if channel is not None:
Myembed = discord.Embed(title=f"Welcome",
description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
Myembed.add_field(name="Account Created at:",
value=f"<t:{int(member.created_at.timestamp())}:R>", inline=True)
await channel.send(embed=Myembed)
await member.add_roles(role)
else:
print("id channel wrong")
yeah
async def on_member_join(self, member: discord.Member, ctx):
role = discord.utils.get(ctx.guild.roles, name="Unverified")
guild = self.client.get_guild(730651046459998218)
channel = discord.utils.get(
member.guild.channels, id=885464532959526913)
if guild:
print("guild ok")
else:
print("guild not found")
if channel is not None:
Myembed = discord.Embed(title=f"Welcome",
description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
Myembed.add_field(name="Account Created at:",
value=f"<t:{int(member.created_at.timestamp())}:R>", inline=True)
await channel.send(embed=Myembed)
await member.add_roles(role)
else:
print("id channel wrong")```
guys
?
I heard something about discord.py has been shut down since april 22?
what does that mean
and some dude told me to switch to nextcord
im confused
and you started again
ohh it only passed member var
it was shut down, it has now resumed back and under development and receives constant updates every monday
oof yes
is there a way to convert a discord time to a datetime?
mostly comment typo fixes :p
discord doesn't have a Time object, if you talk about the timestamp in embed or message creation date etc they're all datetime object
when you send a discord timestamp (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.10)") for presentation within Discord.
This allows for a locale-independent way of presenting data using Discord specific Markdown...
you find everything in the docs
yes, but, how do I make it a datetime?
wdym?
it's a string/int/float, how do I make it a datetime object? (sorry if this is a newbie question)
yo i can send my code now
!d datetime.datetime this is the datetime class
class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)```
The *year*, *month* and *day* arguments are required. *tzinfo* may be `None`, or an instance of a [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass. The remaining arguments must be integers in the following ranges...
btw , how can someone counterfeit ur bot?
you create a datetime object just like you create a class
https://paste.pythondiscord.com/lucugeyuju error : file is not defined
but... it takes the year, month so on, I want to turn the <t:timestamp:F> to a datetime object
I think I found another method though... strptime, I might try that...
If someone knows my error lemme know
how can u make a different cooldown for each role in same command?
I can only assume it's this```py
async with aiofiles.open(f"{guild.id}.txt", mode="a") as temp:
lines = await file.readlines()
and file isn't defined anywhere, you opened it as `temp` otherwise, you might wanna specify more info
how shall i fix it then'
simply change file to temp?
its a permission in 2.0
update using git
is message.reactions not updated?
do i have to refetch the message to see actual reaction count
you cant await create_task
i tryid both
you should await self.my_bg_task()
tho if its a repeated task, d.py has a special decorator for those
thanks!!๐
ok
!d discord.ext.tasks.loop
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with
optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
how can i make a ping command?
how to i make my discord bot active
File "C:\Users\Dom\Desktop\beta test\bot.py", line 37, in on_ready
lines = await file.readlines()
File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\aiofiles\threadpool\utils.py", line 45, in method
return (yield from self._loop.run_in_executor(self._executor, cb))
File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
io.UnsupportedOperation: not readable``` how can i fix this
๐คท
how to refetch a message
huh?
what are you opening?
I fixed it lol on my own i cant believe it xd
pls help
so my warns work , viewwarns work
i need help coding delete warns , can u help me with that?
.....uh
which database?
what is this response..
it cant read your file
aiofiles
what type of file are you reading
wdyem, which reactions, what
bro i already fixed it
oh
aiofiles is a library...
i needed to add the mode as = r
bro?
lmao
what
disnake is my database
i get a message object and then add a reaction to it. after 20 seconds i want to count users who reacted but instead i get no reactions at all in message.reactions
shall i send my code , u can see what i mean
well ofc, you will have to fetch the message again in that case
https://paste.pythondiscord.com/evazifulaq code if ur interested
you have to get the message again
which comes with the updated reaction count
you do know that client.warnings is temporary and all the data will be lost on restart
you will have to use a database. Period
youโre gonna lose everything on restart

I'm leaving if you're gonna repeat everything I say
use mongo
can i use a json database , i cba using aiosqlite its too much work
no mongo is under-powered
im on mobile ๐
typing is slow
should be fine for his use case though
so ill just do ctx.fetch_message(msg.id) or is there a special message method to refetch data?
...
json files might look easy at one hand, and sweet to use on the other, thats why you cut both of them off and use sqlite, because json is fine for config files and has slower reads and writes than a database and this may result in loss of data while reading writing, thats the reason why we tell you to use a database, sqlite, would be by far the easiest
what
can u help me with that?
ctx.channel.fetch_message(id)
bot.get_message(id)
imagine sql
!d discord.abc.Messageable.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") from the destination.
i guess its safe to assume its in cache
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
xd
oh that explains why Context has that too
assuming always doesnt work
the message would be in your cache, but the reactions that are being added to it won't be there
@slate swan I can create a table but rest I need help with tbf
yes, since the message that was sent is stored in the variable and the cache
I cant help you with that
so i cant use get_message?
May i know what library you are using
cause there's no get_x for message in discord.py
disnake
ah well that should be fine since they might be cacheing reactions as well, if it doesn't work then use fetch
In disnake u have one
https://github.com/Dark-Light007/Darker/blob/main/db/warn.py this is my implementation of a warnings database, I prefer using helper functions rather than writing SQL straight to the commands, as I told earlier
alright thanks love ya
everybody loves Sarthak โค๏ธ
but not the variable straightforward ```py
message = await send()
cached_with_reactions = bot.get_message(message.id)
Ok Iโll check it out
oh god
and dont copy it
even though its usable
but you shouldnt
Btw uknow when I created tables for my level system . Do I must create tables there or can I do it in a completely different file with different stuff eg like yours
Not copying tho
Iโll use my code
it totally depends on how you want your data structure to be, what items you want to store..
So I create tables in main.py
yeah sure
So itโs possible ?
it indeed is
Btw can u help me setup a cog rq or nah thatโs all Iโm asking for I guess
you can call it from anywhere, with proper args
Like the things it requires
sure
library?
huh
what library are you using to make the Bot
client
discord.py โฆโฆ. import discord
from discord.ext import commands โฆ. Good enough?
Ok
use bot !
@commands.slash_command(name="removereaction", guild_ids=config)
@disnake.SlashCommand.add_option(name='emoji',description="Which Emoji's Reaction should be cleared", required=True, choices=['Checkmark','furheart', 'both'])
async def rmreaction(self, ctx, amount: int = None):
but its returning the error
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: TypeError: SlashCommand.add_option() missing 1 required positional argument: 'self'
bot = commands.bot
omg i just sucessfully bypassed the proxy on the network :).
Clients better bro
No
Yes
Error says all
@bot.command just doesnโt look cool โฆ @client.command much better ngl
umm can you put where it goes lol since idk where it goes
or at least tell me what spot it goes XD
@commands.slash_command(name="removereaction", guild_ids=config)
@disnake.SlashCommand.add_option(self,name='emoji',description="Which Emoji's Reaction should be cleared", required=True, choices=['Checkmark','furheart', 'both'])
async def rmreaction(self, ctx, amount: int = None):โ
Maybe
i will try that and dispatch back here
Wait I just checked ur code @slate swan , so u do aiosqlite.connect(db) or whatever so for my level system it was level.db , do I just make a new db and call it warn.db like would that work .
Ok
A new file in other words
yeah it will work
Ok .
#Assuming this is example_cog.py
from discord.ext import commands
import discord
class ExampleCog(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot #self.bot will represent a Bot object inside a cog and you can use it for all options that are only available with Bot
@commands.command() # a Command decorator but in a cog
async def ping(self, ctx: commands.Context):
await ctx.send("pong")
@commands.Cog.listener("on_message") #an event but in a cog
async def on_message(self, message: discord.Message):
await message.reply("uwu")
def setup(bot: commands.Bot): #this method is async in 2.0
bot.add_cog(ExampleCog(bot)) #this method has to be awaited in 2.0
you can only use cogs if you are using Bot or subclassing Bot since you have to load cogs as extensions and load_extension is a method of the Bot class and not the Client class
I used client and it worked before tbf so Iโll try use that
dont know?
No
Btw @slate swan I donโt use 2.0 I think . Is there a way to check what v I have
can you show where you define it?
#use either of the below
import discord
print(discord.__version__)
#in a python script, you can also do it in the terminal
#or or or or or or
pip show discord.py #in the terminal
Ok ima check
Hi so, how do we store List in MySql database?
Well itโs in main.py and Iโll show u an example of my other bot how I use it if thatโs alright Iโll ping u when I back
sure
i tried "TEXT" but it says unsupported type something
Last question and @lavish micamands.command here do I just add the warning system code and stuff
SQL doesnt support lists or arrays
oh
yes, and dont ping random people
Does't sql have an array type?
It was by accident sos
it doesnt
:/ i wanted to store list of channel ids per guild in my db
Are u like very good with py , I see ur coding Js do u like know python very well and same with js or like how lol Iโm a bit curious How long did it take u to learn this stuff and if ur advance maybe some tips for people who wanna be better uknow
I can relate, but you may want to use LONGTEXT and separate channel ids using commas and then split them later after fetching the data
2020
I used it like last week
@slate swan should i move the option to after the definition?
But it's weird
I'm quite okay-ish with python, I main js though, it took me 4 years, and I have got a job
irdk never used add option
Time to get offtopic'd
So with js ur very good ?
lol
hmm any idea on how to add an option or something like that to my slash command
yeah quite decent, why'd you ask though
library?
disnake
Just curious lol sos for the question
fine
Hello everyone, can you tell me how to make an anti-raid system?
!d disnake.Option for ya
class disnake.Option```
Represents a slash command option.
i think thats teh same thing i was trying to use but kept getting it is missing self
just code your bot in a way that prevents raids, ease
@disnake.SlashCommand.add_option(name='emoji',description="Which Emoji's Reaction should be cleared", required=True, choices=['Checkmark','furheart', 'both'])
Sry we can't code for you we can help with ur code
If small we can
But it's big
Help me code a delete warn .. ๐ not so big
Jk
I can upload my current code
Sure I'll use JSON :shipit:
AIOSQLITE
Should you PM him?
Ye sure
@slash_command
@disnake.Option(name="option_name", description="the desc", type=whatever_type, required=bool)
I use JSON :)
sparky, stop
Since when did that become a thing?
thats a thing...?
Alr
reaction intents?
discord.py docs must give examples too
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: TypeError: 'Option' object is not callable
its totally your choice though, you could use a json-based cloud db such as mongodb (not recommended) or deta (https://www.deta.sh) (might recommend at some point)
hm weird
oh sowwy
its disnake.Option.add_option
at least that worked for me
Ye
otherwise im out
Can someone recommend me what other systems I can code after warning
!d disnake.Option.add_option
add_option(name, description=None, type=None, required=False, choices=None, options=None, channel_types=None, autocomplete=False, min_value=None, max_value=None)```
Adds an option to the current list of options, parameters are the same as for [`Option`](https://docs.disnake.dev/en/latest/api.html#disnake.Option "disnake.Option").
Or options
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: TypeError: Option.add_option() missing 1 required positional argument: 'self'
economy?
nu ;-;
you should try asking in the disnake server tbh, or nvm sarthak is here
dunno, havent used disnake in long
lol the issue is it wants self ;w;
๐
@bot.slash_command(name="name", options =[ disnake.Option(*args) ... ])
wtf
weird syntax ๐
hikari โค๏ธ ๐
i agree
thats the old Disnake syntax btw
old disnake
examples/slash_commands/param.py lines 42 to 55
# Options can also be added into the docstring
@bot.slash_command()
async def full_description(
inter: disnake.CommandInteraction,
user: disnake.User,
channel: disnake.TextChannel,
):
"""A random command
Parameters
----------
user: A random user
channel: A random channel
"""```
so i just ran the same discord bot script multiple times
once in my ide, and once in my terminal
and nothing errored
what the heck?
I've posted
Why would it error? Give reasons.
same token, i expected some sort of conflict
yea, months
but that old syntax comes from the time of dislash.py O.o
oh it just executes the same function 2 times lol
oh yeah, dislash was also created by the disnake community right?
thats common sense yeah it does
yep
weird
do anyone know any meme and nsfw apis
I have a discord username how can I get the user id;
its too good to change
how can i start cooldown for user if a condition is met ?
what the heck is a guild's welcome screen now
How do i make slash commands have arguments that arent required
argument= None
it does
then why is it not working
making it optional (arg=None) doesn't remove the argument when using the slash commands, the user can just skip that argument without inputting anything
Im using pycord, should i switch to discord.py 2.0
i legit just switched to pycord for easier slash commands
@bot.slash_command(guild_ids=[":troll:"], description="Meth command lol")
async def meth(ctx, user: discord.User = None):
#code!1!!
i suggest yes
okay
I hate it with a passion
dont
ever
say
that
again
Might be the only one here who comes regularly.
stop ๐ญ
!src d
Look up documentation for Python symbols.
The user or member that sent the interaction.
Why donโt they just make it easier
Like what is the actual point of putting user other than author
Why have them different
Weird but Danny's wish
!d
@slate swan i found this in the documentation
options (List[Option]) โ The list of sub options. Normally you donโt have to specify it directly, instead consider using @main_cmd.sub_command or @main_cmd.sub_command_group decorators.
Yo @slate swan do u know where the Python bot stores all doc urls?
!d source
source expression```
Try to get source code for the given object and display it.
New in version 3.2.
lmao not what i wanted
!src e ?
Run Python code and get the results.
!src !d
Unable to convert '!d' to valid command, tag, or Cog.
!source [source_item]
Can also use: src
Display information and a GitHub link to the source code of a command, tag, or cog.
!src docs
Look up documentation for Python symbols.
how do I turn on wordwrap for a file in pycharm
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Andy\PycharmProjects\WhiskeyBotMain\wb.py", line 45, in <module>
bot.load_extension('cogs.events')
File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 487, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 419, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='? (events.py, line 51)
code:
@commands.slash_command(name="removereaction", guild_ids=config, options=["option_name", choices=['checkmark','furheart','both'], required=True])
yeah. i think so
I mean that is the issue lol
I have a discord username how can I get the user id;
wait how am i supposed to put the options stuff in then? caus i think im going at it wrong
what is the alternative to not using a local error handler?
global error handler
@commands.slash_command(name="removereaction", guild_ids=config, options=["option_name"], choices=['checkmark','furheart','both'], required=True)
U were missing a bracket lol
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: SyntaxError: closing parenthesis ']' does not match opening parenthesis '(' (events.py, line 51)
those are supposed to be in the options lol. that is the stuff for the option
@client.command()
async def scratch(ctx):
users = await get_bank_data()
user = ctx.author
b1 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b2 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b3 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b4 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b5 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b6 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b7 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b8 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b9 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b10 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b11 = Button(style=discord.ButtonStyle.grey, label="Scratch")
b12 = Button(style=discord.ButtonStyle.grey, label="Scratch")
view = View()
view.add_item(b1)
view.add_item(b2)
view.add_item(b3)
view.add_item(b4)
view.add_item(b5)
view.add_item(b6)
view.add_item(b7)
view.add_item(b8)
view.add_item(b9)
view.add_item(b10)
view.add_item(b11)
view.add_item(b12)
await ctx.send("Scratch! Scratch! Scratch!", view=view)
Why isn't this showing the buttons when I run !scratch?
one action row can contain a max of 5 buttons
i need 12 tho
so i will do view2 view 3 or something?
idk for dpy
..
link?
@flint isle edited the msg
just use a loop
and get ready for getting ratelimited!
you can use a task or just a python loop
just normally call it?
why a task?
i want it to loop it every one minute runs
you can just use a task.loop
im using cogs and idk how
its probably the same
do u know how to do it on classes
well its probably all the same just with the self argument
What is the reason for this error?
discord.errors.ExtensionFailed: Extension 'cogs.economy' raised an error: ImportError: cannot import name 'cursor' from 'psycopg2' (C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\psycopg2\__init__.py)
@slate swan btw my version is 1.7.3
You have an import issue in one of your cogs
Specifically the psycopg2 one
whats psycopg2
Double check that import
ill ttyl, I dont want to die in a road accident
does it have a cursor function/file ?
Yeah
It should at least, would be a pretty bad orm if you couldnโt run raw sql as most allow you to
@pallid meadow and what to do ?
a cursor without an connection doesnt sound like a good idea
Are you using a database?
Because if not just get rid of the import
as it says, you create it with connection.cursor.
no, 1.7.3 is the standard discord.py version available on pypi, but if you want to use buttons and slash commands you would need 2.0 which is installable only thru git.
weird , i use slash commands on 1.7.3
or probs use newest version but on 1.7.3 idk
weird, you use a bad outdated third party library
ok
didn't you?
probs
why would you import a Cog in your main file?
...... so that the cog file works
await load_extension(name, *, package=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Loads an extension.
An extension is a python module that contains commands, cogs, or
listeners...
Ye u need that
so suppose you have a cog file named "test.py", you gotta do bot.load_extension("test") , thats it.
In main.py right ?
Or cog file
yea~
Ok does it matter where I place it
Hey,
Does anybody know if its necessary to add the guild_ids at the end of this?
Also can you have just a integer instead of a list?
@bot.slash_command(name="embed", description="Create a custom Embed!", guild_ids=[123456789])
i want to EXPORT all errors (red text) FROM my REPL CONSOLE to a discord channel as a .txt file
anyone knows how?
please keep it to yourself
cause they can be long as hell
Wdym ur asking with this error all the time , so I said be patient so till then check docs
whatever is fine, just a file in discord channel
Not reeally
how do i do it
I won't even look at the stupid documentation as it is disgustingly made!!!
The guild id adds slash commands only to the specified commands. If you don't add it, the command will be a global command and added to all guilds, which can take up to na hour. So for debugging purposes, we use guild id so the command is added quickly
U would have to do probs a if statement and add if error or smth then await channel.send(error)
@odd mango something like that
a two-year-old child will explain the law of thermodynamics better than this documentation can help
how exactly, i am a rookie about logging and try catching error stuff
Maybe check YouTube ?
got references?
lmao
never
Not really Iโm not the best here but I give advice to what I would do tbf
yt tutorials aren't exactly the best out there
yeah
Does it job for beginners
@odd mango you can use this to get the error
well, the python documentation is really stupid
i tried searching but all were over the head
If there is any doc that is bad โฆ.. then it will go to databases
no it says wrong stuff then u try to fix it it's too late for that coz u prolly followed the tutorial and ur code base is a bit too big
what are u looking to start with?
that just command error
i wanna get all the red text out
It will get the red text out
yeah so there are two ways since u are a beginner I recommend u use a try except block
try:
#your code
except Exception as e:
raise e
discord.errors.ExtensionFailed: Extension 'cogs.economy' raised an error: ImportError: cannot import name 'cursor' from 'psycopg2' (C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\psycopg2\__init__.py)
how can I fix this error ? I am using a sqllite3 database.
And I don't need to send a link to the python documentation. I don't understand this stupid documentation
Can i get the joinmsg.id from this?
joinmsg = await c.send("<@&958757033119744010>", embed=req_embed, view=join_ticket())
send ur code abt the cursor part and the whole traceback
i am not looking for command errors, i am trying to export errors such as
https://paste.pythondiscord.com/aqodusibey
and
https://paste.pythondiscord.com/ugopehozaz
But you'll need to add try and except block on every command. So it's better to use on_command_error
why are you trying to import psycopg2 when you are using sqlite3, explain?
@tough lance those are not command errors, those are rate limits and other stuff
yeah it's better have a error handler but for beginner its fine ti one is made
i dont need command error handlers, already have those
that's the problem I don't import it
replit right?
yea
but if I understood what the error was and how to correct it, I would not write here
show me your code in economy.py
kill 1 in shell, and rerun your repl
nothing much we can do abt too many requests error since that is returned response from the api u are calling
repl i am not too sure i use heroku to host
i already do that. i am not asking for a rate limit fix
i am asking for wanting to EXPORT all errors (red text) FROM my REPL CONSOLE to a discord channel as a .txt file
or any sort of readable file
what event are you using for that
nothing currently, starting from scratch cause idk how to
!d discord.on_error this is raised whenever an error happens
discord.on_error(event, *args, **kwargs)```
Usually when an event raises an uncaught exception, a traceback is
printed to stderr and the exception is ignored. If you want to
change this behaviour and handle the exception for whatever reason
yourself, this event can be overridden. Which, when done, will
suppress the default action of printing the traceback.
The information of the exception raised and the exception itself can
be retrieved with a standard call to [`sys.exc_info()`](https://docs.python.org/3/library/sys.html#sys.exc_info "(in Python v3.10)")...
save the error in your file..
you see, to go run kill 1 i need to know when the bot gets the error, so i need to upload it in a discord channel as a file with a ping so that i can go and re run the repl
thats what my guy thats what i am asking how do i do that
bruh, i want to see the imports not your listener
the on_error event gives you the error, see the "event" arg in the embed above, just save it...
how exactly do i put it in my code block
again thats the command error i think
not rate limit or whatever
you will never get ratelimit errors raised with an event ๐ถโโ๏ธ
use python logging module to save this
yes how
thats what ive been asking, how do i save NON COMMAND ERRORS
^^
^
I realized what the mistake was. A mistake in the birth of one stupid schoolboy who does stupid lessons on d.py . I'm thinking how to ban his channel for misleading people
h o w
you wrote cxt in the parameters of the function
๐ถโโ๏ธ its not a context tho, its an interaction
unless youre using something like pyc~
Heh
pls, keep unwanted comments to yourself, lets not start an argument!
yeah
I didn't insult someone from the server, but the left person
guys can someone help me make my code into a cog + aiosqlite file
im not saying you did, lets just keep comments that can be considered as threats out of this channel!
guys if i send my code can someone help convert it , it will be quite alot i guess but any help works
You should first try it on your own, and then come back if you have any specific questions regarding that.
oh wait i tried that logging, but it was A LOT OF TEXT, it had everything except the error itself so i gave up
i have the code but its aiofiles but someone said to use aiosqlite
https://discordpy.readthedocs.io/en/stable/logging.html just read this/
You mean you were saving data to files but you want to save it to sqlite instead?
@slate swan
you can configure what you want to log, but you would have to read the docs and put your own efforts on it.
so i currently save it as a .txt but everytime i restart bot it resets warns so i need to use database , so i suppose i must create a table and add the stuff tbf
i tried all 5 levels
none did the desired
You should learn some SQL first
To use sqlite you'll need to be familiar with SQL and with relational database concepts. So I suppose that would be the first thing for you to research before you start writing code/converting your code.
There is a #databases channel if you have specific questions about those topics
Don't worry SQL isn't that hard.
well i know some sql since i used it for my leveling system , should i look back at it and just remake it into a warn system i guess
async def setup_db():
client.db = await aiosqlite.connect("level.db")
await client.db.execute(
"CREATE TABLE IF NOT EXISTS levels (level INTEGER, xp INTEGER, user INTEGER, guild INTEGER)")
await client.db.execute(
"CREATE TABLE IF NOT EXISTS levelSettings (levelsys BOOL, role INTEGER, levelreq INTEGER, guild INTEGER)")
await client.db.commit()
``` like i know how to make this stuff
Yes but the schema isn't good
ik but it does the job for now
You should research on that
btw ```py
from discord.ext import commands
import discord
class warning(commands.Cog):
def init(self, client: commands.Bot):
self.client = client
@commands.command()
async def ping(self, ctx: commands.Context):
await ctx.send("pong")
@commands.Cog.listener("on_message")
async def on_message(self, message: discord.Message):
await message.reply("Yo")
def setup(client: commands.Bot):
client.add_cog(warning(client))``` i have this as a cog , what should i do in main.py to like import it or whatever
i havent used cogs in a while so im just getting used to it
You can add it by bot.add_extension("filename.py")
oh lmao i added a await thats why it didnt work
btw is there a certain location in the file i have to place it in or can it be anyone . like above client.event or whatever
okay so what i want is
if there is any red text in my console (not just command errors), i want my program to copy paste it in a discord channel as a FILE
h o w d o i d o t h a t
I saw that
Why doesn't this create a slash command on my discord
async def on_ready():
print(f'{bot.user} has booted up succesfully!')
class EmbedModal(nextcord.ui.Modal):
def __init__(self):
super().__init__(
"Embed Maker",
)
self.emTitle = nextcord.ui.TextInput(Label = "Embed Title", min_Length = 2, max_Length = 124, required = True, placeholder = "Enter Embed Title")
self.add_item(self.emTitle)
self.emDescription = nextcord.ui.TextInput(Label = "Embed Description", min_Length = 5, max_Length = 4000, required = True, placeholder = "Enter Embed Description", style = nextcord.TextInputStyle.paragraph)
self.add_item(self.emDescription)
async def callback(self, interaction: nextcord.Interaction) -> None:
title = self.emTitle.value
desc = self.emDesc.value
em = nextcord.embed(title=title, description=desc)
return await interaction.response.send_message(embed=em)
@bot.slash_command(name="embed", description="Create a custom Embed!", guild_ids=[This is the right ID])
async def embed(interaction: nextcord.Interaction):
await interaction.response.send_modal(EmbedModal())
you could use https://github.com/TwitchIO/TwitchIO (pubsub)
hello
does anyone know how i upscale this photo
Hello everyone
is this the actual size of the png?
not sure if this is up-to-date, but google can do great things
https://stackoverflow.com/questions/64492624/resizing-image-discord-py
Hi
though some image sizes are fixed in embed probably
Can someone give me an idea of what systems can u possibly do apart from economy level warn ticket systems
Ik u probs canโt help but are u free by any chance for quite a bit I guess
everyone in this channel is
if you don't know what to implement next, optimize your current code
I made a warning system , but it saves as a txt and I use aiofiles I want to convert this into a aiosqlite db and as a cog at the same time but I need help
you already have a db, why tf would you save it as a txt?
Ye but I need to create tables and that
But all that is in my main.py
I wanna make a table in a cog if itโs possible
just make an ainit
In theory yes
just check out an async init => when your cog gets loaded, it'll also make sure the tables for that cog are created
I created tables in main.py and my levelling system is in it aswell , but for my warning system I wanna make it in a cog so that itโs not messy or stuff
i have a weird issue which spotfiy just wont work anymore is there a way i can test a connection/diagnose a connection issue with spotipy
wrong channel
yea idk what channel i tried to ask what channel but no one responded
okay will do
bruh why not ping the category lel
with the developer mode enabled yes
!d discord.CategoryChannel.edit
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to
use this...
you will just have to do this <#category_channel_id>
you can do this with voice channel to
get the category channel, via get_channel, then just use the method above and and the correct args
how to remove command "help"?
try and see
Guys Iโll send my code and can someone help me make it into a sqlite in a cog or if not any ideas cuz I create tables in main py but I wanna make tables in cogs aswell and how to import it or whatever
Can you tell me how to turn off the user's microphone through the bot?
how to write member's roles in descending order?
!d discord.Member.voice
property voice```
Returns the memberโs current voice state.
Thanks
that's not it
Anyone know How I can make this code to say
if discord.username is โtest_accountโ:
return
Yo can u tell me how can I setup the table in a cog
Like Ik itโs not if discord.username
I just want the real one
like you did in main, you probably don't even have the tables ready you want to create in the cog
๐ฟ
Yes that what I think it is but I know Iโm wrong
What is the real code
how can you write all this code and not know how to get a member's username?
Me tryna understand
what you actually want to check is if it's not a specific member, the name doesn't matter
property name```
Equivalent to [`User.name`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.name "discord.User.name")
he must've copy pasted it from somewhere
What are you tryna do exactly
Just trying to make a twitch notification bot that is private
discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") updates their profile.
This is called when one or more of the following things change...
Idk what Iโm doing
before and after are Member objects of the member that was updated.And this is how you get their name
Cuz this has nothing to do with what you're asking
Do you recommend any other twitch notification bot tutorials?
before.name etc
Ye cuz idk how to set it up
I canโt find any
I've no idea how to make a twitch notification bot
then first learn to understand what you previously wrote
Just wait
๐ช
Twitch has a free api for those stuff
Just subscribe to the event for when ppl go live
and there must be a wrapper on pypi for the twitch api that you can integrate into your bot
it's unfortunately not that easy
More painful api's
Sayless
When things get tuff seek inspiration from an open source github repo 
Maybe someone here can help me out.
I'm using Pycord and want to add checks to a SlashCommandGroup. In order to do that I need to set the checks kwarg when creating the group. There is actually a quick explanation of how to do it in the docs but I just don't understand it. So can anyone explain to me how exactly I need to define the check kwarg?
Here is the link to the explanation in the docs: https://docs.pycord.dev/en/master/api.html?highlight=slashcommandgroup#discord.SlashCommandGroup.checks
I already tried checks=[commands.is_owner()] and checks=commands.is_owner() and it didn't work.
you're close
these are also decorators
@commands.is_owner()
oh
you should know that by now
I can do a list
so they need to be a string? Because if I just put an @ in front it's an unexpected expression
@commands.is_owner()
@commands.command()
async def shit(self, ctx):
await ctx.send("the owner shitted")```
I hope this clearifies
that's not what I want xD
I'm actually talking about command groups
like group = bot.create_group(args)
In the docs is this List[Callable[[ApplicationContext], bool]] defined as the type to give to the checks argument when creating the group.
And I just don't get what that means... I don't get where the context comes from and why there is a bool...
never used that, maybe try the pycord discord server
just get the len of bot.guilds, bot.members and bot.commands ๐ง
I tried xD
But it seems like nobody there has used this too xD
shouldn't be, there's literally helpers there that wrote that code...
maybe read through this first
https://discord.com/channels/881207955029110855/977021569257832448
could possibly contain some relevant info
https://paste.pythondiscord.com/kocuhamema guys in this is my warning system and just a bit of the code of how i make tables . i need to have them in main.py and also a cog file , how can i do this?
is it possible to have a command also be a listener
like i want to make a command to send a message and when the reaction is clicked it adds a role
can i do that in one command or does it have to be a command and an event
because you're doing it again, I'm out
!d discord.Client.wait_for
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way...
alright thank you
Ye but ainโt it meant to be