#discord-bots
1 messages ยท Page 679 of 1
when you typt your id its it the server one? ore my
to get the role, u type the role id not server
i kinda hate it when ppl pay for discord nitro-
Depends the everyone role iirc has the guild id
Honestly I didnโt like it at first either. But I learned it can be extremely powerful. So yeah
oh so i need the role id in bouh
Yeah its just the start its confusing
?
Discord gave it to me for free so idm lol
is this the role name ``` await member.add_roles(role)
wait wut C:
rip

Throw money at Discord for slightly cooler conversations 
lol 2 days dude
Hey here is my code
@commands.Cog.listener()
async def on_guild_channel_update(self,before,after):
disabled = await self.coll.find_one({"Enabled": "False"})
if disabled:
return
else:
if before.position == after.position:
print("Position didnt change")
return
else:
print(before.position)
print(after.position)
await after.edit(position = before.position, reason = "Channel moved when lock was enabled")
I know for a fact that channels arent really moving but my console is being spammed with position prints (Suprisingly looks like before.position and after.position is same) however looks like the return and print("position didnt change") isnt firing
ok, ig imma vote for add NQN bot
You can still keep this in a one liner. Just swap in this
for r in bot.get_guild(id).get_member(id).roles
I think???
no, role is the role itself. if you want to change the role id you do it in this line of code where you define the variable 'role':
role = member.guild.get_role(919970184545058897)
the number there is the role id which should be an int
if message.content.startswith('Dadjoke!'):
dadjoke = Dadjoke()
await message.channel.send(dadjoke)
have i got like no brains or wat
๐
ok looks like im a dumb fuck
if message.content.startswith('Dadjoke!'):
await message.channel.send(Dadjoke())
adios moment
u think im that much of a dumb fuck
i tried that
Still the same?
At this point if you'd maken your own you would've been done already ๐
k lemme try this other thing'
dadjoke = Dadjoke()
if message.content.startswith('Dadjoke!'):
await message.channel.send(datajoke.joke)``` thank me later
like this
@client.event
async def on_member_join(member):
role = member.guild.get_role(736200407293886525)
await member.add_roles()
the pypi page :
still doesnt work
.
put role in the function.
<dadjokes.dadjokes.Dadjoke object at ithinkthisisIP>
If someone could help please
thats not an IP lol , its just an integer
either way doesnt work
your current code?
@client.event
async def on_message(message):
if message.content.startswith('Dadjoke!'):
await message.channel.send(Dadjoke())
yes
this is no way similar to what i sent
read this again
oh sorry didnt see this
burh is pip install is so long or what
so, is it possible to fetch a user, then using that member object to check who they receive dm's from?
where tf did datajoke come from btw
like, i fetch a member object, and can i check if they receive dm's from everyone, only friends, or people from their servers
How would I make the bot delete a command after it was sent?
ye pretty sure u mean dadjoke.joke but tysm, apparently all I had to do was put the var inside of the thing
im stoopid
thanks for clarifying
yw , and the jokes are fetched from https://icanhazdadjoke.com/
iirc
await ctx.message.delete()
After the command is invoked
Ty
You can use the delete_after=int kwarg if you want as well
that deletes the message sent by bot
and the first one deletes the user's message
Yeah is that what he wanted?
nah , i just meant both of your answers are different lol
Hey here is my code
@commands.Cog.listener()
async def on_guild_channel_update(self,before,after):
disabled = await self.coll.find_one({"Enabled": "False"})
if disabled:
return
else:
if before.position == after.position:
print("Position didnt change")
return
else:
print(before.position)
print(after.position)
await after.edit(position = before.position, reason = "Channel moved when lock was enabled")
I know for a fact that channels arent really moving but my console is being spammed with position prints (Suprisingly looks like before.position and after.position is same) however looks like the return and print("position didnt change") isnt firing
How?
await ctx.message.delete() will delete user's message
delete_after=int delete's the bot's message
Yeah ik๐ถ 
breh why my pip install dotenv taking so longggg
os.getenv(key, default=None)```
Return the value of the environment variable *key* if it exists, or *default* if it doesnโt. *key*, *default* and the result are str.
On Unix, keys and values are decoded with [`sys.getfilesystemencoding()`](https://docs.python.org/3/library/sys.html#sys.getfilesystemencoding "sys.getfilesystemencoding") and `'surrogateescape'` error handler. Use [`os.getenvb()`](https://docs.python.org/3/library/os.html#os.getenvb "os.getenvb") if you would like to use a different encoding.
[Availability](https://docs.python.org/3/library/intro.html#availability): most flavors of Unix, Windows.
How can I remove a user's reaction to a message?
Current code:
@bot.event
async def on_raw_reaction_add(payload):
reaction = str(payload.emoji)
msg_id = payload.message_id
ch_id = payload.channel_id
user_id = payload.user_id
guild_id = payload.guild_id
server = bot.get_guild(guild_id)
member = server.get_member(user_id)
await msg_id.remove_reaction("โ๏ธ")```
Error:
```diff
-AttributeError: 'int' object has no attribute 'clear_reaction```
because it's python-dotenv not dotenv
dotenv is imported but it isn't the pypi
!pypi python-dotenv
!d discord.Message.remove_reaction
await remove_reaction(emoji, member)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Remove a reaction by the member from the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.
The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
It takes a message object not id.
hello,
I would like to get a link from a text, how can I best do it ?
took me 17 lines of code to implement a mute command
Def regex.
In my code, would that be passing it the payload?
Very nice
Fetch the message.
thanks.
yeah, but i dont understand how to do this. How does i geht the regex of my link ?
imo this code looks good?
@bot.command()
@commands.guild_only()
@commands.has_any_role('Official Owner', 'Admins')
async def mute(ctx, member: discord.Member, *, time: int):
# vars
guild = member.guild
mute_role = guild.get_role(918153988573106187)
# add mute
await member.add_roles(mute_role)
# convert to epoch
today_obj = datetime.datetime.today()
date_timestamp = datetime.datetime(today_obj.year, today_obj.month, today_obj.day, today_obj.hour, today_obj.minute, time)
# discord msg
warnmsg = await ctx.reply(":incoming_envelope::ok_hand: Applied mute to {0} for <t:{1}:R> ({2} seconds if the time displayed is incorrect) seconds".format(member.mention, calendar.timegm(date_timestamp.timetuple()), time))
# remove mute role after given time
await asyncio.sleep(int(time))
await member.remove_roles(mute_role)
if today_obj.second > time:
# if time bigger than the time specified itzelf
await warnmsg.edit(content=":incoming_envelope::ok_hand: Applied mute to {0} since <t:{1}:R> ({2} seconds if the time displayed is incorrect) seconds".format(member.mention, calendar.timegm(date_timestamp.timetuple()), time))
Well use a general url finder and the filter it again but if is is a specific URL that's 100% the same you can also just use in

that last if statement seems wrong or ineffecient
๐
take out the check parameter
like this
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'Click Me!')
]
)
print('part one')
interaction = await bot.wait_for("button_click", i: i.component.label.startswith('Click'))
if interaction.user.id == ctx.author.id:
await interaction.send(content="Button Clicked")
?
hmm idk dont get the role,
The problem is, it's often a different link
as example:
https://hallo/....
https://hallo/----
or sth like this
I mean you added the comments but it looks kinda messy, like comments need to be informational vars i mean it's pretty clear those are variables so unnecessary.
noooooo, take out the, i:i.com.......
and check it inside the if statement
format is also pretty old most of use use f-strings these days.
But you want to extract the whole URL or doesn't it matter?
if interaction.component.label == component.label:
#whatever```
like this
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'Click Me!')
]
)
print('part one')
interaction = await bot.wait_for("button_click",if interaction.user.id == ctx.author.id: )
await interaction.send(content="Button Clicked")
?
Just realized ๐ญ
oh yeah and that <t::r> thing, if you put a number between the : you can make a time like this: <t:4934:R>
ohhh no, wait
yes, because it is a picture and i want to get it out of the message and send it somewhere else with my bot
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'Click Me!')
]
)
print('part one')
interaction = await bot.wait_for("button_click")
if interaction.user.id == ctx.author.id and interaction.channel.id == ctx.channel.id and interaction.component.label.startswith("Click"):
await interaction.send(content="Button Clicked")
@slate swan
ohh
@upbeat otter
huhh, do the printing thing
Hey here is my code
@commands.Cog.listener()
async def on_guild_channel_update(self,before,after):
disabled = await self.coll.find_one({"Enabled": "False"})
if disabled:
return
else:
if before.position == after.position:
print("Position didnt change")
return
else:
print(before.position)
print(after.position)
await after.edit(position = before.position, reason = "Channel moved when lock was enabled")
I know for a fact that channels arent really moving but my console is being spammed with position prints (Suprisingly looks like before.position and after.position is same) however looks like the return and print("position didnt change") isnt firing
Did u just copy the code, because if u did the button names are different
uh well, people have a bad habit of doing that
wdym
ow ok, thanks
did u copy the code without changing it?
!e ```py
import re
string = 'test url lol hahaha https://hallo/yes/lol/hax.php no this is lol'
print(re.findall(r'(?:(?:https?|ftp)://)?[\w/-?=%.]+.[\w/-&?=%.]+', string))
ty for the help, it is working now ๐
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
['https://hallo/yes/lol/hax.php']
no
i know how to do buttons but no the response
okay i try thx
my god, I'll dm you for regex next time
okay, let's do this again, send what u have right now
lol needed to figure out regex url for a bot command once.
smh
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'Click Me!')
]
)
print('part one')
interaction = await bot.wait_for("button_click")
print("part two")
if interaction.user.id == ctx.author.id and interaction.channel.id == ctx.channel.id and interaction.component.label.startswith("Click"):
await interaction.send(content="Button Clicked")
print("part 3")
Yeah so much did infact copy it
interaction.component.label.startswith("")
edit this
?
Someone ghost pinged me 
to what your label says
kk
Your label is Click Me! and not Click
eh why dotenv not defined yet
the what
restart vsc thats it
if i have copied the code it will be correct
ok...
(?:(?:https?|ftp):\/\/)?[\w\/\-?=%.]+\.[\w\/\-&?=%.]+
``` sorry this is the correct regex i saw 2 mistakes in here.
so i made a discord bot which gives the faces of a minecraft skin from file
but i can't figure out to extend the size of the image
This is the result
okay thx
pip install python-dotenv
i tried resizing
I mean that is the actual size
in cmd
Lol same
No lmao, the code eevee gave had a different label than the correct one but whatever
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'button')
]
)
print('part one')
interaction = await bot.wait_for("button_click")
print("part two")
if interaction.user.id == ctx.author.id and interaction.channel.id == ctx.channel.id and interaction.component.label.startswith("button"):
await interaction.send(content="Button Clicked")
print("part 3")
Thats terrifying
Could we get the part that fetches the images?
I have no idea then
use pillow
pillow?
pil
if the part from where you get the image does not allow you to resize it
!pypi PIL
i used pil to resize
Pillow can't just magically give an image a higher resolution.
this is the result
try doing, py interaction.component.label == "button"
My idea is to manually draw the pixels
^
not the quality , but it does upto some level..
Else we'll get this 
@upbeat otterthis?
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'button')
]
)
print('part one')
interaction = await bot.wait_for("button_click")
print("part two")
if interaction.user.id == ctx.author.id and interaction.channel.id == ctx.channel.id and interaction.component.label == "button":
await interaction.send(content="Button Clicked")
print("part 3")
yes
i kinda got horrified by the result though
it just scared me
I was expecting this
how do you get the actual image?
This interaction failed
show me the prints
Using requests
The normal size will be this:
url = 'https://www.facebook.com/favicon.ico'
r = requests.get(url, allow_redirects=True)
I see
For a bot?
You know request isnt async right
?
@slate swanuse try and except on bot.wait_for
I go by if it works it works thing
Use aiohttp
It works but its blocking your code
its a minecraft skin afterall xd
I highly recommend putting redirects off especially with a site like Facebook.
haha wtf
I used a tutorials point for example
Yeah but it will show the normal sizs
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'button')
]
)
print('part one')
try:
interaction = await bot.wait_for("button_click")
print("part two")
except:
if interaction.user.id == ctx.author.id and interaction.channel.id == ctx.channel.id and interaction.component.label == "button":
await interaction.send(content="Button Clicked")
print("part 3")
It returns a list, did you filter it?
oh no i didnt xd
nooooo
except Exception as e:
print(e)
#indent the rest code properly
This Regex also catches other URL's
Be aware of what you want.
ummm...?
yeah but there is only on link in it xd
rerun your code
ok
Well a person like me would put in 20 urls to try and break it.
You're a legend
same thing happened
yeah but how should i filter this, i am overstrain
haha
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'button')
]
)
print('part one')
try:
interaction = await bot.wait_for("button_click")
except Exception as e:
print(e)
if interaction.user.id == ctx.author.id and interaction.channel.id == ctx.channel.id and interaction.component.label == "button":
await interaction.send(content="Button Clicked")
print("part 3")
which lib are you using ?
yes
try now
Noob here.
if "1" in message.content:
await message.reply("1234")
How can I make the bot ignore this if the '1' is in a link or in a user's ID?
This interaction failed
import re
string = 'test url lol hahaha https://hallo/yes/lol/hax.php no this is lol https://google.com/'
if match := re.findall(r'(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-&?=%.]+', string):
urls = ", ".join([url for url in match if url.startswith('https://hallo/') or url.startswith('https://www.hallo/')])
okay i try wait
This interaction failed
:l
dose i need pyhton 3.8 or 3.9 because i user 3.7 and there is says this
huhhhh
I mean 3.8 is recommended for Discord.py
show the print
can some one tell me pls help code
okay thx
@slate swan
no print ๐
,-,
just this
oh
help...?
and code :
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'button')
]
)
print('part one')
try:
interaction = await bot.wait_for("button_click")
except Exception as e:
print(e)
if interaction.user.id == ctx.author.id and interaction.channel.id == ctx.channel.id and interaction.component.label == "button":
await interaction.send(content="Button Clicked")
print("part 3")
give me a minute
okay'
which should i use 3.8.2 oder idh 3.8.10
@slate swan
idk?
As high as possible
import re
string = 'test url lol hahaha https://hallo/yes/lol/hax.php no this is lol https://google.com/'
if match := re.findall(r'(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-&?=%.]+', string):
urls = ", ".join([url for url in match if re.search(r'(?:(?:https?|ftp):\/\/)[w+?]?[w]?[w]?[.]?hallo\/', url)])
``` Also updated this to get a more accurate search.
your wait_for is not working
anyone?
okay thx
wow
with what can i replace it
you cant
Regex 
are you usin wait_for?
copied the same code you posted
tf
Inhuman
What?
it's working for the pokemon eevee but not him
Ah well i'm using disnake so i'm good
How do you remember all the signs from regex๐ด๏ธ
I mean this helps -> https://regex101.com
Basically trial and error.

I think im going to buy nitro this month
Why..?
Why not

i would reply but that would be OT
๐ถ
Well this reply is ot
ot
!ot
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
heh
You guys talking about ot is pretty ot
ot
that is ot
You talking about us talking about ot is pretty ot

Could you guys please go to ot
OT
Same, do you game?
ping someone random and ask them if they have any problem with python
Yup i play apex
Bet
@solar magnet Sup
@upbeat otter any problem with python?
Ah never really played.
yeah, teach me python
anyways
Pretty good ngl what do you play?
!ot too much
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
Assigning variables: Course 1
Rocket league sometime and some casual games, waiting for dying light 2
Bet this is all python:
SELECT * FROM your life;
Rocket league is really fun to i use a nissan r34 wbu?
nissan r34 ... lol
Yes
No way that is an actual car right?
It is lmfao
rule 34 community
Nissan r34 skyline
Sure
it works โค๏ธ thank you
dam
Ohh i know that one, i use octane. Do you play ranked?

very nice help :D
Best of the best here ofc ๐
Not much because i dont play the gsme much but i do with my brother
haha
I can hit any aerial ofc๐
Well since we are both bored... mind showing?
Cant im downloading rl rn on my pc because ive moved to pc
Ah okay np
I use kb/m so i use pc :)
Your weird๐ด๏ธ
Thanks
Normal people play rl in controller ๐ด๏ธ
Kbm on rl is a disadvantage
1v1 me
!ot
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
You don't even chat here..?
Drop it๐ค
import disnake as nextcord
import nextcord as discord
import discord as disnake
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
bot.command()
async def smh(ctx: discord.Context):
embed = nextcord.embed(color=ctx.message.author.color)
await ctx.send(embed=embed)
bot.run(disnake.generate_a_token_so_so_random_nobody_ever_seen_it)
why isnt this working?
Ok
Bruh
๐ถ
Whatโs wrong
the whole code
My eyes
Is there an error
my bot isnt working somehow, can you help?
Where is the decorator lmao
no
which decorator?
I actually need to make a cursed bot so cursed that people will want to figure it out how it works.
I've never worked with discord.py before so.....
Breh
lol
read the docs
import disnake as discord
import discord as nextcord
import nextcord as pycord
import pycord as lefi
from disnake import *
import asyncio,datetime
Pep 8 is screaming rn
Have you tried restarting the script?
Drop it @cloud dawn you scared๐ค
What is wrong, is the bot not responding or what lmao
Hmu i beat you in a heartbeat.
Lol pycord is imported by discord only
Ill break your ankles ๐ค
You have to do disnake.ext @upbeat otter
import disnake as nextcord
import nextcord as discord
import discord as disnake
import pycord as bot
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
bot.command()
async def smh(ctx: discord.Context):
embed = nextcord.embed(color=ctx.message.author.color)
await ctx.send(embed=embed)
bot.run(disnake.generate_a_token_so_so_random_nobody_ever_seen_it())
I did this now
He already imported ext ๐
how
everybody isnt a guy, yee
i still need to download it Sounds more like you already gave up.
Your a pokemon
youre*
Havent dropped it you scared or sm?
Then it would be:
You are pokemon
fr wanna play rn?
@cloud dawn can you help, kind sir?
Cant but im down later for sure
use exec
okayyy
Im the best programmer watch
try:
import disnake as nextcord
import nextcord as discord
import discord as disnake
import pycord as bot
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
bot.command()
async def smh(ctx: discord.Context):
embed = nextcord.embed(color=ctx.message.author.color)
await ctx.send(embed=embed)
bot.run(disnake.generate_a_token_so_so_random_nobody_ever_seen_it())
except Exception as e:
cout >> e >> endl;
return 0;
like this?
@cloud dawn
!e
exec(print("told you"))
@slate swan :x: Your eval job has completed with return code 1.
001 | told you
002 | Traceback (most recent call last):
003 | File "<string>", line 1, in <module>
004 | TypeError: exec() arg 1 must be a string, bytes or code object
wanna play smashkarts or skribbl or smth?
On mobile๐
We should make a server and play kahoot later about python
sad
๐
Or anything else๐
i was thinking about ```py
exec("try: \nmport disnake as nextcord\nimport nextcord as discord\nimport discord as disnake\nimport pycord as bot\nfrom discord.ext import commands\nbot = commands.Bot(command_prefix='!', intents=discord.Intents.all())\nbot.command()\nasync def smh(ctx: discord.Context):\n\nembed = nextcord.embed(color=ctx.message.author.color)\n\nawait ctx.send(embed=embed)\nbot.run(disnake.generate_a_token_so_so_random_nobody_ever_seen_it())\nexcept Exception as e:\ncout >> e >> endl;\nreturn 0;")
๐ณ
okay, wait
!e ```py
exec("try: \nmport disnake as nextcord\nimport nextcord as discord\nimport discord as disnake\nimport pycord as bot\nfrom discord.ext import commands\nbot = commands.Bot(command_prefix='!', intents=discord.Intents.all())\nbot.command()\nasync def smh(ctx: discord.Context):\n\nembed = nextcord.embed(color=ctx.message.author.color)\n\nawait ctx.send(embed=embed)\nbot.run(disnake.generate_a_token_so_so_random_nobody_ever_seen_it())\nexcept Exception as e:\ncout >> e >> endl;\nreturn 0;")
@cloud dawn :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | File "<string>", line 2
004 | mport disnake as nextcord
005 | ^
006 | IndentationError: expected an indented block after 'try' statement on line 1

lol no way im gonna debug this shit
but I cant run my bot, what do I do
Look for some1 on fiverr
Any mod hopping in rn would be so confused ๐
I'm not a mod but I am confused
Im having a stroke
Counts for something
Heh
const discord = require("disnake");
const nextcord = require("discord");
const disnake = require("nextcord");
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all());
bot.command();
async def smh(ctx: discord.Context){
embed = nextcord.embed(color=ctx.message.author.color);
await ctx.send(embed=embed);
}
bot.run(disnake.generate_a_token_so_so_random_nobody_ever_seen_it());
this is fine? @cloud dawn
1 hour ago it was like instantly 8 people asked for help and now the whole chat just died.
Okay this is too far

What the heck is const
but my bot nor working
it's js
constant in javascript
Oh
Bro he was still innocent ;-;

everybody is not a guy, cant blame them tho
Look at him 
nvm, I'll just stop now
I treat everyone equal so everyone is a guy.

lol wth
!E
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
#bot-commands
Sir #bot-commands is a thing๐ด๏ธ
I could also start referring people as it
welcome
better
No refer as lemon
lol
Is a lemon considered male or female?
!ot
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
A lemon
Gotta ask the french now
heh
Average lemon hater
lol
Lemon are great
You guys put a smile on my face everytime
no comment
Lemons
why not
Why does everything in French have genders?
Basically, gender in languages is just one way of breaking up nouns into classes. In fact, according to some linguists, โgrammatical genderโ and โnoun classโ are the same thing. It's an inheritance from our distant past. Researchers believe that Proto-Indo-European had two genders: animate and inanimate.
You probably like oranges
@cloud dawn can you help me again haha
i split sth but then it gives me ['text', 'text'] how can i do that it gives me only the text
smhh
sure
no
Could you give me the exact output? What goes in and what you expect.
!ot
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
What do you want to happen with this data?
ony bekomme itยดs me ...
Use .join() if your trying to join strs from a list
okay i try
str.join(iterable)```
Return a string which is the concatenation of the strings in *iterable*. A [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") will be raised if there are any non-string values in *iterable*, including [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") objects. The separator between elements is the string providing this method.
no the [ and ' and , away xd
me making my own function not knowing join existed
I think they are translating from some language
Ah yeah use join.
Your a questionable human
you're*
am I a human?
Stop
Alr I'll stoo
!e ```py
res = ['hello it's me', '..dnafinaf']
print(" ".join(res))
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
hello it's me ..dnafinaf

ok u deleted it
Guys please do keep it polite here.
๐ด๏ธ
whatever floats ur- nvm
we're kidding
Well then, how much is he paying her
Gawd dayum chill๐ญ
100% of my love

Nitro isnt love bro
Still seems like a bribe
chill
Congrats so when are you marrying her so i could come
!ot
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
my god
haha i have it so easy and i tryed think you didnt want to know 
my brain
loooooool

what is your native language
cause I didn't understand what that meant
Ouch
So rude
use deepl translate instead if you're using Google translate
i'm pretty sure i have mastered sql
๐ด๏ธ

Im starting sql so then i can learn js
Where do you get so many good emojis๐ญ
what is the discord help command
For what?
These are from discord.py
what do you mean
Hm i see
huh?
You guys are going to make me miss my nitro in 3 days๐ฅ
!d discord.Message.remove_reaction
await remove_reaction(emoji, member)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Remove a reaction by the member from the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.
The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
These types of msgs? @tacit horizon
ya
!d discord.Message.reply
await reply(content=None, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").
New in version 1.6.
Well msgs from docs start with !d
anyone know how can I get dis in my discord button
https://cdn.discordapp.com/attachments/343944376055103488/919643994168909824/unknown.png
Upload it as an emoji
and it's the psuedocode
And use that in the button
and it's the psuedocode
Yup
okimii u made bot
Damn its ok
Me?
yes sir
I know a few guys you can send pics to for nitro
You good?
discord bots
Yes i do make discord bots i have like 4 in total
'pics' you say hmm..
๐
1 wasn't enough lol
Nope
what they do (need idea to make new things)
๐ณ
One is a custom server bot that sends images from reddit and other stuff, other is multi func bot other is for testing and other is for eval and personal stuff ๐ณ
i am trying to make a giveaway command
its just that the bot deletes in 2seconds instead of timer provided
@bot.command()
async def gstart(ctx, duration=None, *, prize=None):
if duration == None:
return await ctx.send('timer?')
elif prize == None:
return await ctx.send('prize?')
embed = discord.Embed(title=f'{prize}', description=f'**hosted by {ctx.author.mention}**', color=0xcf244)
time_covert = {"s":1, "m":60, 'h':3600, 'd':86400}
gaw_time = int(duration[0]) * time_covert[duration[-1]]
embed.add_field(name=f'React With ๐ To Enter', value=f'Ends in {duration}')
gaw_msg = await ctx.send(embed=embed)
await gaw_msg.add_reaction('๐')
await asyncio.sleep(gaw_time)
gaw_msg2 = await ctx.channel.fetch_message(gaw_msg.id)
users = await gaw_msg2.reactions[0].users().flatten()
users.pop(users.index(bot.user))
if len(users) == 0:
await gaw_msg2.delete()
return await ctx.send('no one enter sad')
else:
winner = random.choice(users)
await ctx.send(f'{winner.mention} and won {prize}')```
no error or anything
Whomever uses asyncio sleep to make giveaway, mute, ban and other temp commands: Please don't do this, it will break once restarted.
what other thing I should use?
yes, with reminders too
Use a database.
I can't even resort to using a db for anything till I figure out how to fix my problem on my vps
How would you implement it with a db?
Save the time when they are gonna be unmuted, cache all the things from the db on startup and then just run a task or something
Save the datetime stamp in the db for all the events and give them an event id then put it in a task, cache the db results and keep checking.
Yep
Well no one got a better way than this ngl
Ok thx
Check them every second or 5 idk
its pandabweer what you expect?
Well essentially a task is the same as time.sleep but a task is way more flexible and unlike a command can be restored.
Yeah
Haha
As always ||i try my best|| 
You are the best
Aww 

This is massively inappropriate here. Please refrain from comments like this in the future.
outerly yes
innerly no
Depends on the coder 

๐คฃ ofc
If youโre bad itโs hell
Bro dont make me show your commits๐ด๏ธ
<t:1460558760>
?
I needed to see if the format was ok, rest assured i still knew it
Updated my about me for once.
Thats nice i update my profile lol
noice
Have you seen rocket league side swipe?
Nope lol
Its rocket league on mobile
Bro
And its official you should check it out

Cause i do it the right way
Damn hit him hard
You dont add a space before a cumment
You do
pep8 says so
!ot (and I play it)
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
the greatest programmer
!ot (is it live already?)
There should be 2 spaces after a hash
I like splitgate
Yea
Pycharm doesnโt say so
!ot (when we all playing together)
Still pre season
!ot
how do I use message.content and delete the message like
user: sends a discord link
bot: deletes
await message.delete
idts
Or whatever the message you sent is
PEP 8 Does
Forgot the ()
await message.delete()
i know but how do I make the bot to read the message
like delete only if its a discord inv link
@velvet tinsel you dont even follow pep8 your indentations are worst than a 3 year olds๐ด๏ธ
Use regex.
No
regex?
yes
U can simply use if "discord.gg" n message.content
No()
If I wanted to get the user's access token, would I most of the time have to redirect them to a website?
Yes{}
ughum
No[]
INVITE_RE = re.compile(
r"(discord([\.,]|dot)gg|" # Could be discord.gg/
r"discord([\.,]|dot)com(\/|slash)invite|" # or discord.com/invite/
r"discordapp([\.,]|dot)com(\/|slash)invite|" # or discordapp.com/invite/
r"discord([\.,]|dot)me|" # or discord.me
r"discord([\.,]|dot)li|" # or discord.li
r"discord([\.,]|dot)io|" # or discord.io.
r"((?<!\w)([\.,]|dot))gg" # or .gg/
r")([\/]|slash)" # / or 'slash'
r"(?P<invite>[a-zA-Z0-9\-]+)", # the invite code itself
flags=re.IGNORECASE
)
yes<>
!regex
yes/\
whats regex?
No #No#
regular expression
yes uwu
@slate swan This is regex
You know, that uwu doesn't fix anything
ohhhh
does it?
How to run client.command and bot.command for my bot? I cant run that for my bot. I can only run 1. Help me please, tysm
well, I wrote that on purpose, so uhh
maiigot
Yea, cz client.command is for a different bot instance
U can instead do client = bot and then do that thing
yikes
!e ```py
import re
INVITE_RE = re.compile(
r"(discord([.,]|dot)gg|" # Could be discord.gg/
r"discord([.,]|dot)com(/|slash)invite|" # or discord.com/invite/
r"discordapp([.,]|dot)com(/|slash)invite|" # or discordapp.com/invite/
r"discord([.,]|dot)me|" # or discord.me
r"discord([.,]|dot)li|" # or discord.li
r"discord([.,]|dot)io|" # or discord.io.
r"((?<!\w)([.,]|dot))gg" # or .gg/
r")([/]|slash)" # / or 'slash'
r"(?P<invite>[a-zA-Z0-9-]+)", # the invite code itself
flags=re.IGNORECASE
)
test = 'some message haha discord.gg/python lol'
print(re.findall(INVITE_RE, test))
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
[('discord.gg', '.', '', '', '', '', '', '', '', '', '', '/', 'python')]
I can do it in a file right?
Same file
damn, you're inhuman
Sure
that's true, he's literally teaching regex with symbolic skills
Why not use a list ๐
flex
Then,
bot.run(token)
client.run(token)
Tuples are easier to manipulate.
Right?
๐ dude...
Shut
i wouldn't know how to explain it to you
๐ณ
.run() is blocking so client.run() will never get executed.
haha no
๐ญ
So, bot.run(token) only right?
U get the idea at least
so how client work?
I meant, why not use an iterable
Bruh
I mean if you are using bot why would you also need Client?
You can call it Okimii itโll still work
if it's capitalized then discord.Client
Ig so but their not clean
I need to run client + bot.command for my bot
No client is the var of discord.Client
Okimii
You could ig, i just showed a quick example tough i wouldn't use it like this either.
how did you read that
Maby i'm a camel guy y know
Panda โฅ๏ธ

import replit
import nextcord as disnake
bot = discord.Client()
@bot.event
def on_ready(message):
await print("works')
Guys why doesnt this work
Idek
Dont copy me ,-,
doesn't seem right
Oh
Shit
Mine was better
Why
I copied from freecodecamp
eyy how are you 
Still, do it another day
ey me good
๐ญ
how are you?
I have a question
y'all actually
pikachu > eevee
Why doesnโt my code work
hmm very nice, i too feel the nice
Ded, you?

Guys i need help
No
Errors
print("run")
Why isn't my bot running๐ด๏ธ
what's even happening here
!e
print("run")
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
run
we went ot in 10 seconds hunter
,-,
just go with it
Figure it out
๐ด๏ธ
๐คฌ
I am out, thanks
Lollll
Idk
Bye
!ot ๐คฌ ๐ค
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
Nice pfp btw
Understandable.
You dont have any code, pog
You already know
๐ด๏ธ i think you should use discord.py instead of just printing run
No im going to use replit๐
get me outta here
We've gone to #ot0-psvmโs-eternal-disapproval
Do hi re it out
discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").
The following, but not limited to, examples illustrate when this event is called...
Actually it should be member, before, after
They already are member objects
That greyness just means that the variable hasn't been used anywhere
now it types another :(
Also the args means the member who joined/left the VC, his voice state before, his voice state after
!d discord.Member.display_name
property display_name: str```
Returns the userโs display name.
For regular users this is just their username, but if they have a guild specific nickname then that is returned instead.
Not display.name
(:
how do I make a command which makes the bot not working in that channel like
user: !disable #channel_name
bot: stops giving outputs in the channel
Make a botvar with a list of channel IDs where not to send messages, add a bot check to check of ctx.channel.id is in the list, and return False if it is. Then, just append the channel ID to the list
when i am joining a definite voice channel bot must create voice channel and move me there, but he creates it only when i leave this definite channel
I recommend a check with hunters method
!d discord.ext.commands.check
@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/master/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/master/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/master/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/master/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/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event.
If an exception should be thrown in the predicate then it should be a subclass of [`CommandError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError"). Any exception not subclassed from it will be propagated while those subclassed will be sent to [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error").
Not exactly clear what you mean but why are you iterating over the guilds?
!d discord.ext.commands.Bot.check
@check```
A decorator that adds a global check to the bot.
A global check is similar to a [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is applied on a per command basis except it is run before any command checks have been verified and applies to every command the bot has.
Note
This function can either be a regular function or a coroutine.
Similar to a command [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check"), this takes a single parameter of type [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context") and can only raise exceptions inherited from [`CommandError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError").
Example...
private rooms system if you could hear earlier
;-;
Never going to ot again
I am
where is the permission to don't allow user to make a thread ?
Hi, i'm making al logs, how i can know the time when the user left/joined the guild?
!d discord.Permissions.create_public_threads
Returns True if a user can create public threads.
New in version 2.0.
!d discord.on_member_join
discord.on_member_join(member)``````py
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
An aware datetime object that specifies the date and time in UTC that the member joined the guild. If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be None.
Exists tho
U can't tell when a person leaves
U can just do datetime.datetime.utcnow() in the on_member_remove event
i will use that, thanks guys!
how do I install the 2.0 version ?
You have to have git
Youโd do something like
pip install git+https://github.com/Rapptz/discord.py
class Cog2(commands.Cog):
def __init__(self,bot):
self.bot = bot
@commands.Cog.listener()
async def on_guild_join(self,guild:discord.Guild):
for channels in guild.channels:
global channel_list
channel_list = await channels.create_webhook(name="Lemontree bot hook")
@commands.command()
async def sudo(self,ctx:commands.Context,member:discord.Member,*,message):
hook = Union(channel_list)
async with ClientSession() as session:
await hook.send(content=message,avatar_url=member.display_avatar,username=member.display_name)```
await ctx.command.invoke(ctx)
File "C:\Users\sony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\commands.py", line 133, in invoke
await injected(ctx)
File "C:\Users\sony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\commands.py", line 90, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: NameError: name 'channel_list' is not defined```
I'm using discord.py rewrite and I have been having issues with running commands.
It isn't latency, I am getting an accurate response to my server, it just takes a while to register that I have sent the command.
When running on localhost I have next to 0ms, it just isn't searching for the command very quickly. Does anyone know why?
did you define channel_list?
Is there a way to make the bot respond with the help command when I only mention the bot? Like @|| || and nothing else?
how do i create a role using ctx.guild.create_role(), how do i enter the name and set permissions like send_messages = False, manage_guild = False like that?
ctx.guild.create_role(name="",permissions = discord.Permissions(send_messages = False ect..))```
would it go like this? overwrites = discord.PermissionOverwrite() overwrites.send_messages = False overwrites.read_messages = True ctx.guild.create_role(name='name here', permissions=overwrites)
or not?
Idk i've never tried this
This 1 creates the role with perms ๐คท๐พ
huh, okay then back to the documentation
Ye
okay then
does anyone know what are the default perms for a role?
Is None valid for that?
when i do py await member.add_roles(role)
do i have to do py await member.add_roles(roles=role)
how can i check if something is a url
no just the first one.
Hi, i want to make a blog in google sites by just typing the command !blog <text>.
Is it possible?
okay
does google sites have an api that lets you do that?
bec i haven't ever used that
Lemme check
Yes.
then yes you can prob do that
Ahhh, idk how but still thanks
how do i find out who sent the message
You can use the .author attr so you can get the member who sent the message
await channel.send(userinput+" submitted by ") how could i include it here
You will need to add message.author and if you want you can add .mention attr to mention the author
when i leave the voice channel it is deletes but the text channel is not
isnt it ctx.author
because it says undefined name message
If you are using context then yes you will get the context author if your using message you will get the message author
@bot.command()
async def submit(ctx, *, userinput):
channel = bot.get_channel(895072295146651709)
valid=validators.url(userinput)
if valid==True:
await channel.send(userinput+" submitted by "+ctx.author)
await ctx.send("succesfully submitted!")
else:
await ctx.send("Please use a valid URL")```why do i get ```File "main.py", line 88, in submit
await channel.send(userinput+" submitted by "+ctx.author)
TypeError: can only concatenate str (not "Member") to str```
@slate swan
You will need to format the string with a f string
await ctx.send(f"sent by {ctx.author.mention}")
This will mention the context author
okay, ill remove the mention but thanks :)
Then you can use the .name attr
okay
Yep
Anytime!
ayy it worked :))
Nice
how can i make my links like that?
You can create a hyperlink as so:
("[Text](url)")
my bot creates a voice channel and text channel when an user joins into definite voice channel, then bot moves him to created voice channel, and if all users left this voice channel, it will be deleted also as a text channel. bot do all of this, but two times, and i dont now why. help me please!
hey um @slate swan do you know how i can get the bot to get the image of a image sent into chat
await ctx.send("[text](url)")
like that?
yes
Correct
because discord uploads images instantly to their servers
You want to log an image?
yeah
if someone uploads a image to discord i want to get the discord url of it
any idea of how thats possible?
Well im not really familiar with that unfortunately
hmmm
sadge
thats weird
smh what is wrong?
How do I make a message send to every single channel
Unfortunately it only works for a description of a embed as far as i know
ah alr thennn thx
You iterate through text channels
Always!
ehh
As so
for guild in bot.guilds:
for channel in text_channel:
await ctx.send("message")
code
You sent the embed object you will need to use the embed kwarg to send the message as so:
em = discordEmbed(**kwargs)
await ctx.send(embed = em)
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**.
ahh right
nonce?
tysm it is working now
Your welcome!
Hello, im trying to make a voice logs, i have this code: ```py
@bot.event
async def on_voice_state_update(member_before, member_after):
Voice Logs
member_before.voice_channel
member_after.voice_channel
msg = ""
channel = bot.get_channel(913158722992373854)
if member_after.voice_channel == member_before.voice_channel:
return
if member_before.voice_channel == None:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] {member_after} ({member_after.id}) ha entrado al canal de voz: {member_after.voice_channel}"
else:
if member_after.voice_channel == None:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] {member_after} ({member_after.id}) ha abandonado el canal de voz: {member_before.voice_channel.mention}"
else:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] {member_after}({member_after.id}) se ha movido de canal de voz, de: {member_before.voice_channel.mention} a: {member_after.voice_channel.mention}"
await channel.send(msg)and this is the traceback Ignoring exception in on_voice_state_update
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)```
!d discord.on_voice_state_update || you sent the wrong part xD. it takes 3 args tho
discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").
The following, but not limited to, examples illustrate when this event is called...
wrong part?
oh yes
but thanks!
Caeden instantly gets the answer without having the full error
You are truly inspirational
yes
typically when you send the traceback you send the bottom part
๐
member_before.voice_channel member_after.voice_channel
quick question; what are you trying to do with this ?
also, msg = "" isnt needed seeing as you are defining it before using it - in all cases (you have an else)
it was for saving it xd
oh
@manic wing now how i can get only the channel mention?
โ [2021-12-14 20:50:29] CiCloH#2916(626127081419571206) se ha movido de canal de voz, de: <VoiceState self_mute=False self_deaf=False self_stream=False suppress=False requested_to_speak_at=None channel=<VoiceChannel id=913158723160121389 name='โหเญจเญง๏ธฐ๐ธใปVIPS' rtc_region=None position=31 bitrate=64000 user_limit=0 category_id=913158723160121386>> a: <VoiceState self_mute=False self_deaf=False self_stream=False suppress=False requested_to_speak_at=None channel=<VoiceChannel id=913158723160121387 name='โหเญจเญง๏ธฐ๐ฅใปSala ยน' rtc_region=None position=29 bitrate=64000 user_limit=0 category_id=913158723160121386>>'
the bot sends this
thats because you did {member_after} I believe
@bot.event
async def on_voice_state_update(member, before, after):
# Voice Logs
name = member
msg = ""
channel = bot.get_channel(913158722992373854)
if after == before:
return
if before == None:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}** ({name.id}) ha entrado al canal de voz: {after}"
else:
if after == None:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}** ({name.id}) ha abandonado el canal de voz: {before}"
else:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}**({name.id}) se ha movido de canal de voz, de: {before} a: {after}"
await channel.send(msg)
the code before was wrong
!d discord.VoiceChannel.mention
property mention: str```
The string that allows you to mention the channel.
it sends the same thing
I can promise you that it doesn't
this has sent the instance of discord.VoiceChannel - if you do after.mention and before.mention in all the msg = then I can promise you it will mention not send the object
the discord.on_voice_state_update event sends everything its happening, if u unmute, mute if u change vc etc
in this code you have sent after and before. if you want to mention, change it to after.mention and before.mention
@bot.event
async def on_voice_state_update(member, before, after):
# Voice Logs
name = member
msg = ""
channel = bot.get_channel(913158722992373854)
if after == before:
return
if before == None:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}** ({name.id}) ha entrado al canal de voz: {after.mention}"
else:
if after == None:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}** ({name.id}) ha abandonado el canal de voz: {before.mention}"
else:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}**({name.id}) se ha movido de canal de voz, de: {before.mention}> a: {after.mention}"
await channel.send(msg)```i have it like this
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 100, in on_voice_state_update
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}**({name.id}) se ha movido de canal de voz, de: {before.mention}> a: {after.mention}"
AttributeError: 'VoiceState' object has no attribute 'mention'```
@manic wing
oh apologies, its actually after.channel.mention
never worked with on_voice_state_update
don't worry, thanks!
Caeden, what other languages do you know?
How can i check if the bot voice is already stopped?
@commands.command(name='stop')
@commands.has_permissions(manage_guild=True)
async def _stop(self, ctx: commands.Context):
if not ctx.author.voice or not ctx.author.voice.channel:
em = discord.Embed(title=":err: Music Error!", description=f"You are not connected to a voice channel!", color=discord.Color.red())
await ctx.send(embed=em)
return
if ctx.voice_client:
if ctx.voice_client.channel != ctx.author.voice.channel:
em = discord.Embed(title=":err: Music Error!", description=f"Scorpio is connected to another voice channel!", color=discord.Color.red())
await ctx.send(embed=em)
return
if not ctx.voice_state.voice:
em = discord.Embed(title=":err: Music Error!", description=f"Scorpio is not connected to a voice channel!", color=discord.Color.red())
await ctx.send(embed=em)
return
if not ctx.voice_state.is_playing:
em = discord.Embed(title=":err: Music Error!", description=f"Nothing being played at the moment!", color=discord.Color.red())
await ctx.send(embed=em)
return
ctx.voice_state.songs.clear()
if ctx.voice_state.is_playing:
ctx.voice_state.voice.stop()
em = discord.Embed(title=":Ver: Music Successful!", description='Scorpio has been stopped', color=discord.Color.from_rgb(black1, black2, black3))
await ctx.send(embed=em)
code im using rn
learning c++, scripted a bunch in bash - basic usage of html, css and js (enough to get around and make websites), bit of java
Sweet
need more help XD, when i leave or join a vc the traceback is this
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 100, in on_voice_state_update
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}** ({name.id}) se ha movido de canal de voz, de: {before.channel.mention} a: {after.channel.mention}"
AttributeError: 'NoneType' object has no attribute 'mention'```
@bot.event
async def on_voice_state_update(member, before, after):
# Voice Logs
name = member
msg = ""
channel = bot.get_channel(913158722992373854)
if after == before:
return
if before == None:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}** ({name.id}) ha entrado al canal de voz: {after.channel.mention}"
else:
if after == None:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}** ({name.id}) ha abandonado el canal de voz: {before.channel.mention}"
else:
msg = f"โ [{datetime.utcnow().replace(microsecond=0)}] **{name}** ({name.id}) se ha movido de canal de voz, de: {before.channel.mention} a: {after.channel.mention}"
await channel.send(msg)```
If anyone minds can they help me out in #help-chili itโs discord.py related
!d discord.on_voice_state_update
discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").
The following, but not limited to, examples illustrate when this event is called...
was this in dms by any chance? im not sure how channel can be none 
@client.before_invoke
async def before_invoke(ctx):
if ctx.guild.id in [some ids]:
invoke
else:
pass
``` how can i continue invoking the command?
you want the command to not run?
if the guild is blacklisted?
nope, to run
nope, whitelisted
so it will only run if its in some ids?
yes
dont understand u, the error is that i can't mention a before if it wasnt a before
so it sends that error
i want to make a command when user use the command Messages coming to the channel where the command is used will come to a channel that I specify, and if I write a message to the channel where the message came from, my message will be sent to the channel where the command is used. how can i make it?
!d discord.ext.commands.check || you use a check, not before_invoke. py @client.check async def mycheck(ctx:discord.Context) -> bool: if ctx.guild.id in [id_list]: return True #if the output of the check is True, it will run return False #dont run
@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/master/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/master/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/master/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/master/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/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event.
If an exception should be thrown in the predicate then it should be a subclass of [`CommandError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError"). Any exception not subclassed from it will be propagated while those subclassed will be sent to [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error").
@manic wing i wanna to check for every command
that is an odd error
not only for one
it does
its a global check for every command
ah
can i share u my replt?
ty
i guess
dm
this is a bit complicated, what you're trying to implement is some sort of userphone thing
its not too complicated, my bot has it as a support thing - however, you need a couple things



