#discord-bots
1 messages · Page 524 of 1
RuntimeError: Event loop is closed
https://cdn.upload.systems/uploads/Y8gDUwSp.png
I've got these warnings and I can't seem to get rid of them, I know why it's doing it (because of ComponentsBot), but I need that in my bot (Originally in my main file but I tried to work around it, which didn't work because it requires me to put in bot = commands.ComponentsBot() in my main file, which I can't because I need to have bot = commands.Bot() in it or else the rest of my bot won't work, anyone got an idea on how I can make both of them work (I work with Cog files). Already changed check=lambda inter: to check=lambda i:
Info.pypy from Help import Help ... def __init__(self, bot): self.bot = bot bot.help_command = Help(bot) bot.help_command.cog = self ...Help.pypy ... def __init__(self, bot): super().__init__( command_attrs={ 'cooldown': CooldownMapping.from_cooldown(1, 3, BucketType.member), 'description': 'Shows help about the bot, a command, or a category', } ) self.bot = bot ...ErrorFile "/usr/lib/python3.9/asyncio/base_events.py", line 677, in is_closed return self._closed AttributeError: '_UnixSelectorEventLoop' object has no attribute '_closed'
full exception: https://hastebin.com/tadeceguje.sql
Someone?
Already changed check=lambda inter: to check=lambda i:
client = commands.Bot(command_prefix="!")
TypeError: BotBase.init() missing 1 required positional argument: 'command_prefix'
wtf
someone help me
Uh let me open pycharm rq
how to add webhooks?
Probably because it's prefix= instead of command_prefix
it doesnt work without =
@slate swan
I meant client = commands.Bot(prefix="!")
that wont work
full error?
Traceback (most recent call last):
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "c:\Users\bert.vscode\extensions\ms-python.python-2021.10.1317843341\pythonFiles\lib\python\debugpy_main.py", line 45, in <module>
cli.main()
File "c:\Users\bert.vscode\extensions\ms-python.python-2021.10.1317843341\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\bert.vscode\extensions\ms-python.python-2021.10.1317843341\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("main"))
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 269, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\Users\bert\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 35, in <module>
from .errors import *
ImportError: attempted relative import with no known parent package
is there a way i can keep adding 1 to a value of a field that has an integer string
@client.command() async def id(ctx): await ctx.send("Your ID is" + user.id)
where is the problem ?
you can just use
@client.command()
async def id(ctx):
await ctx.send(f"Your id is {ctx.author.id}")
user.id is nothing I think
Thanks
np
No i watch the user.id in a tutorial, just i did somethings else and i have a problem lol
Tutorial is probably outdated
sorry my language is bad 😦
Also it was probably ctx.user.id
Yup

Also an id command is completely useless
user not defined
or something
Or you could just right click then left click
{ctx.author.id} is working but {membre.id} nop
thanks
ctx.author is defined because use ctx parameter
Unless you have member: discord.Member in the params member is nothing
RuntimeError: Event loop is closed SOMEONE TELL ME WTFFF THIS IS
ive been stuck with this stupid error for 2 hours
What is it breaking?
Traceback (most recent call last):
File "c:\Users\bert\Downloads\discord bots\test.py", line 31, in <module>
client.run(token)
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 601, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000023873381C60>
Traceback (most recent call last):
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
self._check_closed()
File "C:\Users\bert\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Did you enable the intents?
i did now
Enable intents in developer portal
how i set random color to the embed
?
you can do discord.Color.random() in thr color kwarg
thankss
someone?
Does anyone have the image from the dpy server where it shows you how to turn on intents?
I need it for a friend
ty
!d str.replace
str.replace(old, new[, count])```
Return a copy of the string with all occurrences of substring *old* replaced by *new*. If the optional argument *count* is given, only the first *count* occurrences are replaced.
newhex = newhex.replace.....
Anyone got a simple python bot.command()
send.message bot? Im in a pinch and need a simple command bot
that's not how it works
@commands.has_permissions(ban_members=True)
async def ban(ctx, member: discord.Member, *, reason=None):
if reason==None:
reason=" no reason provided"
await ctx.guild.ban(member)
await ctx.send(f'User {member.mention} has been banned for {reason}')
w h a t? explain
wherre is the problem
error?
yea
share it
@commands.has_permissions(ban_members=True) IndentationError: unexpected unindent
its because it dhouldnt be indented
hint in the name
maybe it's because of this space
Just need a simple bot. Types command and embed message is displayed
🤦♂️
ill do it for £500
oh ru

!d discord.Embed
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
Use this to make Discord embeds.
Can you show the whole code?
and this ^
thanks is working
xd
thank u too
lol HHHHHHHHHH
Ah, I didn't see the code you sent.
i get this trying to install slash commands
#python-discussion here is dpy not how to install pip xD
Have you installed Python to PATH?
eh okay
No it is not.
not sure
how do i go about doing that
You'll need to go to the .exe file that you installed Python through, and hit uninstall.
Then when installing, before you click install, make sure you check this.
That's not just for 3.7, but every version.
me an ubuntu user: ok
if i hadnt installed python to path, would i also have problems installing other things with 'pip....'
ofc
i just used it to install nextcord, worked fine
problems with pip are always weird (no)
pip will not work if you do not install Python to PATH.
it just worked a second ago when i used it to install nextcord
@commands.command(help = "Make the bot leave a server", aliases = ['leave', 'lsv'])
async def leaveserver(self, ctx, *, serverName):
guild = discord.utils.get(self.bot.guilds, name=serverName)
if serverName == guild.name or serverName == str(guild.id):
await guild.system_channel.send(f"Bye bye **{guild.name}**.")
await ctx.send("Done")
return await guild.leave()```
how can i make it work for both name and id of the guild?
You can ask here.
Instead of serverName, pass in guild_id:int and get the guild using guild = self.bot.get_guild(guild_id).
don't pass in a list
but that wont work when i use the guild name
pass in 2 args
oh it just worked
no square brackets
i used pip3 instead of pip
Then use guild:discord.Guild. I'm unsure if this really works.
Square brackets???
[]
ty key
yes
It's called lists..
NO
(arg1, arg2).
i know
!e
string = "s"
string.replace("s", "a")
print(string)
@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.
s
you use newhex.replace('#','0x') @potent jetty
Oh. I forgot to re-define.
nice man
!e
string = "s"
string = string.replace("s", "a")
print(string)
@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.
a


Btw, @potent jetty if you want to convert RGB, he, and other forms of colors. You can use discord.ext.commands.ColourConverter.
!d discord.ext.commands.ColourConverter
class discord.ext.commands.ColourConverter(*args, **kwargs)```
Converts to a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour").
Changed in version 1.5: Add an alias named ColorConverter
The following formats are accepted...
plea... uh.. useless
Hey guys, I'm having a quite basic issue that I don't remember how to solve it.
client = commands.Bot(command_prefix = 'Alice, ', case_insensitive=True, self_bot=False)
@client.listen()
async def on_message(message):
msg = message.content.lower()
ints = predict_class(msg)
response = get_response(ints, intents)
await message.channel.send(response)
This code makes the bot correctly detect a message. However, when it answers that message, instead of answering just a single time, it keeps sending messages over and over. Can someone give me a hint on how to fix this?
Hello, I am having an error where the display_strikes command in my code is not being recognized, when I run it with my bot on discord.
This is the error I am getting: discord.ext.commands.errors.CommandNotFound: Command "display_strikes" is not found
This is the cog in which the error is occurring: https://pastebin.com/u4rhJNJn
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it must be commands.command(name= "display_strikes")
Oh, I see now, thanks.
When discord forces bots to transition to slash commands next year will it only be verified bots or all of them?
verified
what you want
help
bruh?
he has
asked 999 times
he replied to his question
i keep getting this error trying to test out slash commands
i can't scroll
how come
ah ok
import discord
from discord.ext import commands
from discord_slash import SlashCommand
bot = commands.Bot(command_prefix = '!')
slash = SlashCommand(bot, sync_commands = True)
@bot.event
async def on_ready():
print('Ready')
@slash.slash(name = 'Ping', description='sends pong')
async def ping(ctx):
await ctx.send('pong!')
Whats wrong
gives me this error
full exception?
What
!traceback
Please provide a full traceback to your exception in order for us to identify your issue.
A full traceback could look like:
Traceback (most recent call last):
File "tiny", line 3, in
do_something()
File "tiny", line 2, in do_something
a = 6 / 0
ZeroDivisionError: integer division or modulo by zero
The best way to read your traceback is bottom to top.
• Identify the exception raised (e.g. ZeroDivisionError)
• Make note of the line number, and navigate there in your program.
• Try to understand why the error occurred.
To read more about exceptions and errors, please refer to the PyDis Wiki or the official Python tutorial.
ok traceback
Info.pypy from Help import Help ... def __init__(self, bot): self.bot = bot bot.help_command = Help(bot) bot.help_command.cog = self ...Help.pypy ... def __init__(self, bot): super().__init__( command_attrs={ 'cooldown': CooldownMapping.from_cooldown(1, 3, BucketType.member), 'description': 'Shows help about the bot, a command, or a category', } ) self.bot = bot ...
full traceback: https://hastebin.com/tadeceguje.sql
So anyone know why I'm getting an error from this
i know

I've tried;
await reaction.message.set_field_at(0, "Status:", "Approved", inline=True)
And i got this:
AttributeError: 'Message' object has no attribute 'set_field_at'
How can i fix this?
set_field_at(index, *, name, value, inline=True)```
Modifies a field to the embed object.
The index must point to a valid pre-existing field.
This function returns the class instance to allow for fluent-style chaining.
Yeah i found that on the offical docs
bruh read the docs, reaction.message is Message object, only Embed object has set_field_at, you need Message.embeds[0].set_field_at() and to edit message
how make slash commands?
future: <Task finished name='Task-1' coro=<SlashCommand.sync_all_commands() done, defined at C:\Users\marva\python\lib\site-packages\discord_slash\client.py:415> exception=Forbidden('403 Forbidden (error code: 50001): Missing Access')>
Traceback (most recent call last):
File "C:\Users\marva\python\lib\site-packages\discord_slash\client.py", line 439, in sync_all_commands
existing_cmds = await self.req.get_all_commands(guild_id=scope)
File "C:\Users\marva\python\lib\site-packages\discord\http.py", line 248, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
from discord.ext import commands
from discord_slash import SlashCommand
from discord_slash.utils.manage_commands import create_option
import config
client = commands.Bot(command_prefix = '.', intents = discord.Intents.all())
slash = SlashCommand(client, sync_commands = True)
@slash.slash(name = 'hi', description = 'поприветствовать', options = [{"name": "member", "description": "пользователь", "type": 6, "requied": False}], guild_ids = [680754330022051890])
@client.command(aliase = ['hi'])
async def hi(ctx, member: discord.Member = None):
await ctx.send(f"Передаю привет, {member}!")
client.run(config.TOKEN)```
im need help
first it is aliases not aliase
second all is alright idk maybe your bot just dont have perms to slash commands
how do i edit the value of a specific field in an embed
!d discord.Embed
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
Anyone?
error:
ticket_channel = await interaction.author.guild.category.create_text_channel(f"ticket-{interaction.author.name}",
AttributeError: 'Guild' object has no attribute 'category'
Code:
@commands.Cog.listener()
async def on_button_click(self, interaction):
if interaction.custom_id == "support":
guild = interaction.guild
for category in guild.categories:
if category.id == 883942826222686259:
break
if discord.utils.get(guild.channels, name=f"ticket-{interaction.author.name}") is None:
ticket_channel = await interaction.author.guild.category.create_text_channel(f"ticket-{interaction.author.name}",
topic=f"Support ticket for {interaction.author.name}.",
permission_synced=True)
await ticket_channel.set_permissions(interaction.author, read_messages=True, send_messages=True)
await ticket_channel.set_permissions(guild.default_role, read_messages=False, send_messages=False)
Everything is in the error
Guild object doesn't have category attribute
You need to get the category differently
Well I tried every other way
Keep getting the error
Ever tried get_channel
And save it in a variable
Anyone know a good async YouTube library to get things like views/likes off a video? Ideally it would have a search function for videos but its not needed
That will get your account locked by YouTube
Youtube doesn't allow scraping?
They don't
Sub botting, like botting, view botting can get your YouTube channel deleted.
Not what im planning on doing lmao
Yes
Simply use their API
They have one?
@bot.command(aliases = ["gamble"])
@commands.cooldown(1, 1, commands.BucketType.user)
async def lottery(ctx):
def check(message:str):
return message.author == ctx.author and message.channel == ctx.channel
await ctx.send(f"how many {random.choice(bananalist)} gamble???")
message=await bot.wait_for('message', check=check)
await open_account(ctx.author)
users = await get_bank_data()
user= ctx.author
lotterywin = message.content * random.randrange(1, 3)
await ctx.send(f"you have won {lotterywin} {random.choice(bananalist)}")
users[str(user.id)]["wallet"] += lotterywin```
How can I fix this?
I know str can't += int, so i changed the last line to
users[str(user.id)]["wallet"] += int(lotterywin)```
that gave no error, but didn't actually add the 'lotterywin' to the wallet
what am i doing wrong?
how to make a cogs file but for custom emojis?
You never saved the new 'bank data'
ohhh oops lmfao
Why would you need a cog for custom emojis?
i put in what i usually use to save it, yet it's not changing
Anybody know where I can find a list of all discord.py events?
what would be the best method to iterate through a list using tasks loop to change the status. and on each task loop go down each element of the list, rather than what i imagine is start from the first element over and over
idn if that space between startswith and your ("CLICK") was intended?
!d itertools.cycle
itertools.cycle(iterable)```
Make an iterator returning elements from the iterable and saving a copy of each. When the iterable is exhausted, return elements from the saved copy. Repeats indefinitely. Roughly equivalent to:
```py
def cycle(iterable):
# cycle('ABCD') --> A B C D A B C D A B C D ...
saved = []
for element in iterable:
yield element
saved.append(element)
while saved:
for element in saved:
yield element
```...
or if that’s not what you want, you can just pop from the list
when I send an array there are still the square brackets, the quotes and the commas.
how do i get that away?
replace()
Google documentation
You would create a variable with the characters you don't want
Then loop through the message replacing the blacklisted characters with ""
can you send a code example?
Don't have access to my pc rn
msg = " ".join(list)
Also probably not the best solution
!e
string = "s"
string = string.replace("s", "a")
print(string)
@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.
a
i get this error trying to add slash command
What do you want to replace?
I don't want the square brackets and the quotes and commas to appear when outputting the variable
Ah, then just do "".join(emo).
!e
names = ["Seif", "Wessam"]
print(" - ".join(names))
@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.
Seif - Wessam
This made a - join in-between the items in the list names.
Thanks, it worked ^^
No problem.
how do i can create an embed with a button? and this button do something
You would need to create a function that builds an embed
ye, but how do i can put the button on he?
You would need to find a lib that supports them
the discord.components don't work more?
I have no idea tbh
Where are you trying to mention them in?
@slate swan = @slate swan
And also, if you're trying to achieve that in an embed's title, footer, field name or author name, it will not work.
No problem. 
try
authorid = f"<@{ctx.author.id}"
embed = discord.Embed(
title = "title's here",
description = "description's here",
color = colour here
)
embed.add_field(name="pinging you", value="authorid")
``` i think that this works
What?
he's wanna do an embed, alright?
Why authorid = f"<@{ctx.author.id}"?
Just ctx.author.mention.
And also, you used the variable inside strings in the value kwarg.
gives the same
No?
this work's with me
!e
value = "Hello world!"
print("value")
@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.
value
You used the variable in strings, how would it work?
authorid = f"<@{ctx.author.id}"
embed.add_field(name="pinging you", value="authorid")
the "<@>" is a string that will help me make the code work, and the id stay on middle @dusk dust
And also discord.Member.mention returns <@user-id>, so no need for this hassle.
!d discord.Member.mention
property mention: str```
Returns a string that allows you to mention the member.
this code never work for me
Try value=ctx.author.mention.
there are several ways, I do it this way because I think more didactic
How could I make a command that stores how much of a item someone bought
Example
add @honest wing 100
check @honest wing | returns 100
add @honest wing 1042
check @honest wing | returns 1142
- I know I would need to use a dict, but I suck with them so if you could help me out, I would appreciate it.
you wouldn't have to use a dict
that's the exact opposite of what we tell people...
use a database
i don't like the hassle of setting one up, i rather store it in a json file lmfao
why am i getting repeated people in my json leaderboard?
code here:
@client.command(aliases = ["lb"])
async def leaderbard(ctx):
users = await get_bank_data()
leader_board = {}
total = []
for user in users:
name = int(user)
total_amount = users[user]["wallet"]
leader_board[total_amount] = name
total.append(total_amount)
total = sorted(total,reverse=True)
em = discord.Embed(title = ftop 5 leaderboard: " , description = "Top 5 credit leaderboard",color = discord.Color(0xfa43ee))
index = 1
for amt in total:
id_ = leader_board[amt]
member = client.get_user(id_)
name = member.name
em.add_field(name = f"{index}. {name}" , value = f"{amt}", inline = False)
if index == 5:
break
else:
index += 1
await ctx.send(embed = em)
and in the json, there are no repeats there
in the ids or anything
Btw you spelt leaderboard wrong
It says: Command raised an exception: AttributeError: 'Bot' object has no attribute 'open_account'My Code: py @commands.command() async def balance(self, ctx): await self.client.open_account(self, ctx.author) user = ctx.author users = await get_bank_data() wallet_amt = users[str(user.id)]["wallet"] bank_amt = users[str(user.id)]["bank"] em = discord.Embed(title = f"{ctx.author.name}'s balance",color = discord.Color.red()) em.add_field(name = "Wallet",value = wallet_amt) em.add_field(name = "Bank balance",value = bank_amt) await ctx.send(embed = em)
o ty
got any clue for the repeated people?
On phone atm so incredibly hard to read
!e
print('hi')
@somber musk :warning: Your eval job has completed with return code 0.
[No output]
!e
@somber musk :white_check_mark: Your eval job has completed with return code 0.
hi
That's so cool
How you can code on the bot
You make a command that takes in some code as the param (a str) and then you use eval on it and return whatever the result is
Yeah I totally understand you :(
To code a discord bot?
I'm talking about the discord bot @unkempt canyon Development
U asked about coding on the bot which is what the !e command does
I- that's exactly why y'all people should put every sentence and word that's in the same context in the same message instead of sending one message for each sentence
The way you did it seemed as if you asked how it's done 🤷♂️
"how you can code on a discord bot" can't resemble a question in any way grammatically
But I understand how u got confused
A lot of people ask questions like that 😔
Yea probably aren't fluent in English which is ok
@somber musk rephrase your question
What?
😂
I never asked a question I just said "that's so cool How you can code on a bot"
It wasn't on the same line but okay
i didn't just say that earlier
GOD DAMN I don't understand you guys "how you can code a bot" isn't even a question
^
I know but instead of being clueless read mine and @slate swan Convo before speaking :)
Does anyone know how to make a discord bot that sends messages to people promoting their server?
Chill with the passive aggressive shit dude
Sorry uh I don't understand I'm trying to be kind
That's why I put a ":)"
Well you can have specific words like JOIN SERVER or NITRO SERVER, which then the bot can talk
Use regex and check for discord invite
Have you seen those discord bots that randomly message you and invite you to their server
Ohhh
Ur talking about those
yeah
Also @final iron why ignore
If it's not in your dms you can't do anything about it
^
Because instead of being childish I decided to abandon the conversation
I'll show you by dms
Alr?
But I don't understand how I was aggressive I was trying to be kind
It's called passive aggressive
But I wasn't trying to be negative in anyway anyways
Someone knows about telegram bots?
Like the messaging service?
Sending messages, more specifically sending a message every X time
Not what I was asking
I'm still learning python tho
Are you talking about the messaging service
I'm creating a bot for telegram
I want my bot to send a message in an specific chat every X time
This is #discord-bots
You would probably want to ask in #python-discussion or get a help channel
Thanks you 😊
Anyone know why this won't work?
with open("characters.txt", encoding="utf8") as file:
letters = file.read().split('\n')
letters = tuple(letters)
@bot.listen()
async def on_member_update(before, after):
if before.nick.startswith(letters):
await after.edit(nick=f'Inaproprite Name')```
I don't have any errors
Do you have member intents enabled?
Since this event requires that in order to properly dispatch
You need to switch on the member intents and just so yk it's inappropriate not inapropriate
At first it worked and I thought I had it on. Now it stopped working and I didn't have it on. Thanks for the help
Yeah, it works now
And I didn't notice the spelling mistake lol
That's good
It happens xD
is it possible if i were want to send out whole list content into
list = ["a","b","b"}
^ adding this list into an embed making it become
a
b
c
use py "\n".join(listname)
help how to fix?!?!?
you miss a : after a if/elif/else statement or a function
ok
and the variables are not defined....
If you want to get the first item in the array then it's [0] not [1].
Sidenote are you using a wrapper for this or just raw json
cheers tq
I try it
Also not working
Sorry i cant understand
Try printing search_results.
Are you using regex, a wrapper or using aiohttp?
Without [1]?
No i am using urllib package
Yes.
Ok
Thanks
async def on_member_join(member):
if member.guild.id == yourguildidhere:
print(f"{member} has joined the guild")
oh, that's so simple how didn't I think of it lol, thanks
You shouldn't spoonfeed
also not working
they ask to print and check what does it print
do you get a [] in the console?
this is error
ok
It’s a big error
no
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
i asked , what does print(search_results) print
search_results = re.findall('href=\"\\/watch\\?v=(.{11})', htm_content.read().decode())
this is it
wait
UnboundLocalError: local variable 'search_results' referenced before assignment```
i did it this error coming
only printing [] this
It means you don't get any results for your search
oh
so how can fix it
whats a code camp discord bot
I’m out of ideas for custom commands for my bot. Does anyone have ideas? I’ve already made a fake nitro command. Perhaps games?
a modmail system is a fun challenge
Oh god
I was thinking more of like fun commands that I could make for entertainment, since my bot’s purpose is to entertain.
How do I do live timer?
Could someone give me an example of storing a user's ID to a MySQL database?
Please anyone say
look into the tasks framework maybe?
I don't understand
i think he means read the documentation
Ok
i think that helps you schedule events
hm
what database system are you using? (sqlite, postgres, etc)
@hollow agate forgot to ping ^
tictactoe? battleship? connect4?
How to get a list of servers my bot is in??
for guild in bot.guilds:
!d discord.Embed.set_field_at
set_field_at(index, *, name, value, inline=True)```
Modifies a field to the embed object.
The index must point to a valid pre-existing field.
This function returns the class instance to allow for fluent-style chaining.
Merged my documentation and now my python discord wrapper turned into an HTML repo 👁️ 👄 👁️
someone please help I'm getting this error https://hastebin.com/tadeceguje.sql
@commands.command()
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member : discord.Member=None, reason=None):
if reason == None:
reason = 'No reason provided.'
await member.ban(reason=reason)
embed = discord.Embed(
title = 'User Banned',
description = f'{ctx.message.author.mention} banned {member.mention} from {ctx.guild.name}. Reason: `{reason}`'
)
await ctx.send(embed=embed)
i want owners of server able to ban moderators but it pops out an command error
what do i add
this was the PR responsible
!d discord.ext.commands.check_any
@discord.ext.commands.check_any(*checks)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if any of the checks passed will pass, i.e. using logical OR.
If all checks fail then [`CheckAnyFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckAnyFailure "discord.ext.commands.CheckAnyFailure") is raised to signal the failure. It inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Note
The `predicate` attribute for this function **is** a coroutine.
New in version 1.3.
@stark hearth
sad to know that the whole PR only documented 3 files
Lmao
??
@pliant gulch that's not topic of this channel
I am talking about my discord API wrapper
!d discord.ext.commands.Bot.guilds
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
TY
uh im tired, okay, talk about your wrapper
Wait no
wrapper in HTML
I want all the guild bot is in
Yeaaa
ty
<commands.Bot>.guilds returns list of all guilds bot is in
someone please help I'm getting this error https://hastebin.com/tadeceguje.sql
show your cog code and help command code
cogs/info.py```py
from discord import Embed, Color, Member, Status
import discord
from datetime import datetime
from discord.ext.commands import Cog, command, cooldown, BucketType
from discord.abc import GuildChannel
from typing import Optional
from config import owners
from cogs.help import Help
...
class Info(Cog):
def init(self, bot):
self.bot = bot
self.description = "Information commands"
self.start_time = datetime.utcnow()
self.ver = 1.0
self._original_help_command = bot.help_command
bot.help_command = Help(bot)
bot.help_command.cog = self
...*cogs/help.py*py
from discord.ext.commands import HelpCommand, BucketType, CooldownMapping
from discord import Embed, Color
class Help(HelpCommand):
def init(self, bot):
super().init(
command_attrs={
'cooldown': CooldownMapping.from_cooldown(1, 3, BucketType.member),
'description': 'Shows help about the bot, a command, or a category',
}
)
self.bot = bot
...``` @slate swan
can you show more?
what more?
so the issue is this, you passed a bot instance into HelpCommand init, dont do that, HelpCommand will deepcopy each arguments that gets passed, making it raises this error, instead, get the bot instance of self.context.bot
I have my custom bot class Hokker will ctx.bot return it?
okay thank you
no
self.context.bot?
super refers to your parent class that you subclass
sure
me dumb thought ctx.bot returns Bot class xD
thats fine
hi
@bot.event
async def on_message(message):
db = TinyDB('databases/blacklist.json')
member = message.author.id
try:
query = Query()
blacklisted_guild = db.search(query['guild_id'] == message.guild.id)
blacklisted_peeps = None
for i in range(0, len(blacklisted_guild)):
if str(member) in str(blacklisted_guild[i]):
blacklisted_peeps = blacklisted_guild[i]
if blacklisted_peeps is not None:
return
except:
print("It's a DM")
db2 = TinyDB('databases/afk.json')
query = Query()
for member in message.mentions:
if db2.search(query['afk_user'] == member.id):
value = str(
list(
map(lambda entry: entry["reason"],
db2.search(query['afk_user'] == member.id)))[0])
await message.channel.send(
embed=discord.Embed(title=f"{member.display_name} is currently afk",
description=f"Afk note is: {value}",
color=discord.Color.random()))
member = message.author
if db2.search(query['afk_user'] == member.id):
await message.channel.send(embed=discord.Embed(
title=f"{member.display_name} You typed a message!",
description=f"That means you ain't afk!\nWelcome back buddy.",
color=discord.Color.random()))
query = Query()
db2.remove(query.afk_user == member.id)
await bot.process_commands(message=message)```
This is my old bot.py, on msg code
i tried moving it to an events cog
and?
error?
yeah giving
what one
yeah giving
@gloomy coral
https://hastebin.com/gavapelese.py
Ok so basically, now if i do -afk eating food then it shows....
it shows??
It used to work before
also now if you blacklist someone...... then the bot considers their commands
it would work before i moved it... idk why
How would I go about restricting certain emoji's to certain roles? like if a user has Level 10 role they can use the 🍞 emoji but users without that role cannot.
AFK COMMAND(If you need)
@commands.command()
async def afk(self,ctx, *, reason=None):
if reason is None:
embed = discord.Embed(title="Give ME A REASON",
description="You can't be afk for ___",
color=discord.Color.random())
embed.set_footer(text="That's Louis' job")
await ctx.send(embed=embed)
return
if len(reason) > 30:
embed = discord.Embed(title="I'm sorry.",
description="I got bored reading your LONG reason.\nSo I ignored it.",
color=discord.Color.random())
embed.set_footer(text="Nothing more than 30 characters please")
await ctx.send(embed=embed)
return
db = TinyDB('databases/afk.json')
db.insert({'afk_user': ctx.author.id, 'reason': reason})
await ctx.send(embed=discord.Embed(title=f"Ok {ctx.author.display_name}.",
description=f"I have set your status as afk for {reason}.",
color=discord.Color.random()))```
impossible
you cant restrict, but what you can do is write an on message event, and if the bread is in the msg content, delete it and tell them they cant use
thts rlly cruel tho ngl 😄
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
thats only for custom emojis iirc
yeah?
@gloomy coral when you use afk command it puts you into afk, but it's a message and after executing that command it checks if user is afk in on_message event and makes him, so you need to check if content startswith {prefix}afk
the 🍞 emoji isnt a custom emoji, or was that an example...
yes it was an example
!d discord.Guild.create_custom_emoji
await create_custom_emoji(*, name, image, roles=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a custom [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji") for the guild.
There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.
You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
There is a roles parameter
but then that worked before.... how did it work before then?
roles hmm
List of discord.Role objects
i have a question
cog.listener works something different and this problem is that it executes command before doing on_message code
i made 3 bot.event but only the last one is working
alright so wht do i do???
on message events?
hmm
what event?
bot.event u can hab only 1... u shld use cog.listener but im guessing u dont now wht tht is?
thats the same thing
and the blacklist command?
async def on_message(message):
try:
if message.mentions[0].id ==760010546728402975:
user = await message.guild.fetch_member(760010546728402975)
guild = message.guild
mee6_muted_id = 882886302196957204
mutedrole = discord.utils.get(guild.roles, id =mee6_muted_id)
await sleep(1)
await user.remove_roles(mutedrole)
except:
pass
await bot.process_commands(message)```
Why do u need raw requests tho?
@commands.Cog.listener() is for only inside cogs though
u can only have 1 bot.event for on message
and thts the rule
if message.content.startswith('{your_bot_prefix}afk'): return @gloomy coral
i am not using cog
what
aye
u can have multiple events tho
idk that was an example
idk
Hmm
how?
wdym how?
bot bot.onmessage
it depends on what event tho
omg
im so dumb
i thought tht he was using 3 bot.events for on_message
sorry dude, have a good day im out
u said @bot.event u didnt say on_message
yes ik ik
well i can combine all the possiblities in one bot.event
right?
yeah u thought right
wdymean
XDDDDDDDDD
read context bruh
he has command
xd
omfg
read context bruh
he has afk command
and on_message with disabling afk users
and when he types command
it makes afk
and on_message disables afk
ok
Is there a better alt to Discord.py?
Pls i need a answer
wdym as better alt
rly?
ehhhh
discord.py is a library for python there is alternative as nextcord but I don't think it's much better (my point of view) or you can use other langs as js (faster then python but harder syntax)
@near oyster
yes
buttheres a prblem
the porblem is tht my computer is not fast enough for node
it takes 5 hrs just to run a node js program
oof, then idk here is python server not nodejs to help you for that...
idk, im not good at that, i just use dpy)
class Batch(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.dispatcher_cog = bot.get_cog("Dispatcher")
why dispatcher_cog is None?
because cog Dispatcher not exists?
the cog isnt loaded
you should choose whichever you like since most have the same capabilities because they are wrappers of the same api (not the same structure or design tho)
however, i would suggest sticking to d.py till it stops working entirely or gets too outdated, because you cant know for sure if the alternative you will switch to will get discontinued after a while or ends up messed up. So that by the time d.py is gone completely there will most likely be other "good" successors with an OK reputation you can transfer to
anyways, if you are willing to switch to an alt regardless, I have read some nice things about hikari but I cant say for sure
ctrl+F ?
but you are using some command
and it is replying with this on it
right?
find in files
hlo
for idx in range(len(total_roles)):
print(total_roles[idx])
embed.add_field(name=f"Members: {total_members}", value=f"Roles : {index_roles}")```
what are you doing?
you want the roles of a guild and members in a guild?
!d discord.Guild.member_count
property member_count: int```
Returns the true member count regardless of it being loaded fully or not.
Warning
Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified.
uh trying to get all the roles in a guild
!d discord.Guild.roles
property roles: List[discord.role.Role]```
Returns a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of the guild’s roles in hierarchy order.
The first element of this list will be the lowest role in the hierarchy.
the amount?
no the names
iterate through using list comp
[role.name for role in <discord.Guild>.roles]
^
there is a class discord.Channel
ohh nice thx
!d discord.Channel
No documentation found for the requested symbol.
class discord.TextChannel```
Represents a Discord guild text channel.
x == y Checks if two channels are equal.
x != y Checks if two channels are not equal.
hash(x) Returns the channel’s hash.
str(x) Returns the channel’s name.
class discord.abc.GuildChannel```
An ABC that details the common operations on a Discord guild channel.
The following implement this ABC...
oh
No documentation found for the requested symbol.
confusion
class discord.DMChannel```
Represents a Discord direct message channel.
x == y Checks if two channels are equal.
x != y Checks if two channels are not equal.
hash(x) Returns the channel’s hash.
str(x) Returns a string representation of the channel
or this ^
It turned out to be discord.TextChannel
okay then discord.TextChannel
where can i go to learn about making an app?
👍
never knew what they are called lol
cool
yeah cool, was just curious on where to start since i had no clue on where to search for them ¯_(ツ)_/¯
Does anyone know the max ammount of text channels a server can have?
IIRC 500 including voice channels
TextChannel | MAX
VoiceChannel | LIMIT
StageChannel | =
CategoryChannel | 500
like this? @bright palm
or not including category or stage channels?
Not sure if it includes stage channels it won't include categories but you can only have 50 channels per category and there might be other limits
ok
it includes category channels too
categories == category channels
xd
categories are just special channels
name is not defined, might want to use args (like in your parameters list)
And you realize it will change the name of every single channel right?
@bot.command()
async def rename(ctx, *, args):
await ctx.message.delete()
for channel in ctx.guild.channels:
await channel.edit(name=args)``` im just lazy to not spoonfeed
@leaden onyx
use that code
idk
hi guys, i had a question, how do i set this missingpermissions to this command? because if i try to use it, missing permissions doesn't work.
here the code
@ commands.is_owner ()
async def dis (ctx, *, command):
command = client.get_command (command)
if command is None:
await ctx.send ("There is no command with that name.")
elif ctx.command == command:
await ctx.send ("You don't have enough permissions.")
else:
command.enabled = not command.enabled
ternary = "enabled" if command.enabled else "disabled"
await ctx.send (f "The command` {command.qualified_name} `was ** {ternary} **")
@ dis.error
async def dis_error (ctx, error):
if isinstance (error, MissingPermissions):
await ctx.send (f'You don't have enough permissions to run this command. ')```
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.
Note that this check operates on the current channel permissions, not the guild wide permissions.
The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").
This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
use this decorator , or since you have is_owner() check , you must use NotOwner expception in the isinstance
How do I make my bot edit the perms of a channel?
!d discord.Channel.edit
No documentation found for the requested symbol.
wait
No documentation found for the requested symbol.
!d discord.TextChannel.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/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 1.4: The `type` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
overwrites (Mapping) – A Mapping of target (either a role or a member) to PermissionOverwrite to apply to the channel.
hi guys, i'm creating a command that is used to disable the commands you don't want, but if i try to disable it the bot disables the command in ALL the servers it is in, i want only the person who disables the command to be disabled only on that server. Does anyone know how to do?
Use a way to store if the command is disabled or not in the guild, example: a database
you can do it like this
database
=>
TABLE settings
=>
COLUMN guild_id BIGINT
COLUMN disabled_cmds STRING
command
async def disable(ctx, *, command_name):
database.execute(ADD_COMMAND_NAME_TO_DISABLED_CMDS where GUILD_ID == CTX.GUILD.ID)```
***each command***
```py
async def cmd_name(cmd_args):
if 'cmd_name' in database.execute(SELECT_DISABLED_CMDS where GUILD_ID == CTX.GUILD.id):
return```
Why checking on each command?
or cog_check
other ways except cog_check?
Whatever
This exists
on_command
It's called when a command is found and about to get invoked
No it's discord.on_command
Like any events
Yeah like 99.9%
no on_command
Jeez
Are we talking about 2.0?
No
So don't come with the shit 2.0 stuff
And on 2.0 it also exists just not discord.on_command
!d discord.discord.ext.commands.on_command
discord.ext.commands.on_command(ctx)```
An event that is called when a command is found and is about to be invoked.
This event is called regardless of whether the command itself succeeds via error or completes.
There
yes because it is latest version?
eh okay...
Latest is not 2.0
1.7.3 then?
Let's keep the chat polite, also we provide help regarding discord so it doesn't matter what d.py version someone is using.
If you're referring to the word 'shit' and you read the entire sentence you can see it was referring to the 2.0 stuff, which is indeed shit.
And considering 2.0 is not even officially released, 100% of the users who come with basic issues definitely do not have 2.0 so coming and saying something doesn't exist in 2.0 (which even still does exist) makes everything even more irrelevant to the conversation.
And let's not mini mod as no servers like it
And why is not having 2.0 an issue?
My point was
Saying that something doesn't exist in 2.0, which even does because you can't search
Why come up and say it doesn't even exist and mislead people
Even if it's 2.0 or not, doesn't matter
Ah, sorry i kinda misunderstood then.
can we add a folder in cog? will the cmd run if the the py is in that folder?
no, use os.listdir on that folder and use bot.load_extension on each file in that folder
!d os.listdir
os.listdir(path='.')```
Return a list containing the names of the entries in the directory given by *path*. The list is in arbitrary order, and does not include the special entries `'.'` and `'..'` even if they are present in the directory. If a file is removed from or added to the directory during the call of this function, whether a name for that file be included is unspecified.
*path* may be a [path-like object](https://docs.python.org/3/glossary.html#term-path-like-object). If *path* is of type `bytes` (directly or indirectly through the [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike "os.PathLike") interface), the filenames returned will also be of type `bytes`; in all other circumstances, they will be of type `str`.
This function can also support [specifying a file descriptor](https://docs.python.org/3/library/os.html#path-fd); the file descriptor must refer to a directory.
Raises an [auditing event](https://docs.python.org/3/library/sys.html#auditing) `os.listdir` with argument `path`.
ooo ty
how to make custom help command?

👀
that really isnt basic
k
lol
How to use multiple bots in single file without typing whole program again and again?
You don't
Is there something to fetch a message then edit it?
wdym how to run?
what like your code is ran twice by two different bots?
Just fetch it and save it in a variable then edit it I guess
so you have bot a that runs it and you also want bot b to run the same thing?
But why do you want that
yeah but how?
you simply can. easily


@slate swan have u at least tried doing it before asking for help?
Please tell I am going to tution I will check later sorry bye
nah
Well you need the channel where the message is, then use fetch_message
then try it??
aight
a) you can copy and paste the files and replace token and link it to main with os.system and running the other file
b) use some asyncio thing to make the second client.run, its like get_running_loop or smthing
c) make a thread for it @slate swan
Try it and see
from discord.ext import commands
import json
import os
import config
@bot.command(description="Mutes the specified user.")
@commands.has_permissions(manage_messages=True)
async def mute(ctx, member: discord.Member, *, reason=None):
guild = ctx.guild
mutedRole = discord.utils.get(guild.roles, name="Muted")
if not mutedRole:
mutedRole = await guild.create_role(name="Muted")
for channel in guild.channels:
await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)
await member.add_roles(mutedRole, reason=reason)
await ctx.send(f"Muted {member.mention} for reason {reason}")
await member.send(f"You were muted in the server {guild.name} for {reason}")
@bot.command(description="Unmutes a specified user.")
@commands.has_permissions(manage_messages=True)
async def unmute(ctx, member: discord.Member):
mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")
await member.remove_roles(mutedRole)
await ctx.send(f"Unmuted {member.mention}")
await member.send(f"You were unmuted in the server {ctx.guild.name}")
bot.run(config.TOKEN)```
Traceback (most recent call last):
File "C:\Users\marva\Desktop\test\main.py", line 9, in <module>
@bot.command(description="Mutes the specified user.")
NameError: name 'bot' is not defined
im need help
Everything is in the error
You never created a bot variable
Make a variable using commads.Bot() thingy
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
command
commands
Making a discord bot
async def novaaa(ctx, a, b)
I did it like shown above
It takes in info when i do
!novaaa abc hab
But it doesnt take in info when done like this
!novaaa abc hab
Haj
Jha
I want the b to take everything even in next line any suggestions?
cant u do something like this is it not gonna work?
import discord
from discord.ext import commands
bot_one = commands.Bot(command_prefix="!")
bot_two = commands.Bot(command_prefix="?")
bot_one.run(token)
bot_two.run(token)
nah, .run loops everything inside of it
hm
its like a big while bot_running loop
You can't run two at once well
thanks
you can
"well"
i dont understand
It's useless pain
If you're going to run two bots, run two scripts.
Because then you now have two bots which can only use a single core shared between them and that won't be fun
Just basically the bot will not take anything i sent in next line
so like
Well
async def novaaa(ctx, a, b):
!novaaa abc hab
abc = a
hab = b
.split('\n')[0]
Yes correct
this ignores newlines
issue with is is i want to do
!novaaa abc hab
habc
hah
then maybe i can append the hab habc and hah into a list
But in order for me to do so, i need the bot to somehow get the habc hah
Possibility of me saving it as message content then splitting it? Hmm
async def novaaa(ctx, a, b, *, c)?
you can use an asterisk in the args to make the bot read all the args
or that
Ahh
Hello I need help
Aight will give it a try later
await bot.process_commands(message)
This code not working
I am giving command in message but command is not working
Show the entire event code
async def on_message(message):
not_restricted_chan = await events.is_not_restricted_channel(message)
if not_restricted_chan :
print("Entered")
if bot.user.mentioned_in(message):
await message.channel.send("Hello I am Minecord the ultimate Minecraft Discord Bot, my prefix is ```m!```.")
elif "start" in message.content[2:] or "help" in message.content[2:]:
print("processing command")
await bot.process_commands(message)
elif await events.has_profile(message):
chance = random.randint(1,3)
if chance == 1:
game.xp_manager(message, random.randint(1, 3))
await bot.process_commands(message)
else:
await message.channel.send(f"{message.author.mention} you haven't created a profile, create a profil by the ```start``` command and start playing.")```
What is events.is_not_restricted_channel()
Checking for if the channel is not set to restricted one
Does it print Entered
Yes
Why do you check if the content has start or help
Just process commands normally without checking that
ok but
Put the process_commands after the else
It prints ```processing command``
but after that the command doesn't runs
yeah, this is only gonna process commands if the start thing is true
Just put it at the end
Only once
add my bot to top.gg
Wait for it to get approved
ok
code for keeping inline false
in embed
@bot.event
async def on_message(ctx):
if len(message.content) > 5:
await message.channel.send("yes")
``` soo i was doing this then my bot kept spamming the channel. Why?
add an inline kwarg at .add_field(name=..., value=..., inline=bool)
got it
which is the right channel to ask something about aiohttp error
you can ask here if you want
or python-general, up to you
I asked in async and concurrency
ok, both work as they’re pretty much both asynchronous shit
is there any pip for reddit memes?
the bot sends the message yes then because the bot sent a message it runs on_message again
User ≠ bot 
what does that mean
what does ≠ mean
wait

button for python little bit buggy idk why 
😦 so sad
Worked thanks!!
Can you show your code
what is the footer code? for embed?
Which button you're using
uhmmm....
I dont have nitro so its a lil hard to send
hold on.
embed.set_footer(text="nabs")
o.o kk how to add image?
in footer the small one
Hey @slate swan!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Hmm
:/
@slate swan go paste it in pastebin or any paste service
Idk this one maybe- i don't use embed that much
Embed is embed
Example ^
ook ty for ur help tho
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
heres the pastedbin
password is password ¯_(ツ)_/¯
@solar pikeembed.set_footer(text="whatever", icon_url="https://www.nab.nab/nab")
lol ty
:incoming_envelope: :ok_hand: applied mute to @vale narwhal until <t:1633785301:f> (9 minutes and 59 seconds) (reason: newlines rule: sent 115 newlines in 10s).
what was the question tho?
She/he asking why his/her button was interaction fail
^ code here password = password
yep
any clues?
!d discord.Embed.set_image
set_image(*, url)```
Sets the image for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
got it
any error you get?
can i add eet in the timezone and no utc
?
also , did you import Button from discord_components?
no errors except the interaction failed thing that happens
yes
from discord_components import *
Sry but it's answered and he's asking about footer
do you have an on_slash_command_error event?
no?
!d discord.Embed.set_footer @solar pike if u were looking for this
set_footer(*, text=Embed.Empty, icon_url=Embed.Empty)```
Sets the footer for the embed content.
This function returns the class instance to allow for fluent-style chaining.
got it
button confusing sometimes 
yes
reaction pagination feels old..so wanted to ue buttons,but NOPE
you must try using type ids instead of ButtonStyle
I have never heard of that..
hmm
why would that make buttons not work tho :/
the error appears when you click a button right?
yep
yk that This interaction failed thing
why dont you set a variable for the first message you send as embed , and then use variable.edit() , seems functional to me

from discord_components import Button
msg = await _ctx.send( embed=discord.Embed(description="hmm"), components= [Button(label="Invite",url="https://google.com",style=5) ])
#you send the embed
#on interaction:
await msg.edit(components= [Button(label="edited",url="https://google.com",style=5) ])```
ty! Imma try
Probably isn't working cause you are setting an id you should only do that if you want it to be persistent as it will cause conflicts with previous buttons
What's function for this example:
If there are 2 members in General Voice Channel, Change the Voice limit.
The thing is I don't know how to tell the program when there are 2 members
Unless whatever you are using handles buttons differently
!d discord.VoiceChannel.members
property members: List[Member]```
Returns all members that are currently inside this voice channel.
len(voice.members)
So, Something like this?
limit = 2
if len(voice.members) == limit:
limit += 1
So if there is 2 make it 3 if there is 3 make it 4?
oh... that wouldn't work :/
Can't we fetch voice members?
So...
if len(voice.memberr) == Members:
channel.edit(limit += 1)
else:
channel.edit(limit -= 1)
right?...
that should be good
but indents
What do you mean
except
voice is gotta be your channel object
How can I tell the program to fetch voice channel members count
limit = 2
if len(voice.members) == limit:
limit += 1
exactly like this?
Yes
But, If there is no body in the channel, the channel limit should be 2
How the program will know that?
We gotta fetch it right?




