#discord-bots
1 messages ยท Page 108 of 1
message.author.id
You most likely have the message object where you're trying to get that information
Yeah i did that and it said
Name error message is not defined
Well, no code no help
ยฏ_(ใ)_/ยฏ
@bot.command()
@has_permissions(administrator=True)
async def check(ctx, hashn=None, conf=None):
if not hashn or not conf:
await ctx.message.delete()
else:
y = time.time()
mam = message.author.id
mauthor = f("<@{mam}>")```
ctx.author.id in here
You also used it for getting the message object above
await ctx.message.delete()
You can access the author with ctx.author and then have access to lots of attributes and methods
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
import discord
import os
from discord import Intents
from discord.ext import commands
intents = Intents.default()
client = discord.Client(intents=intents)
my_secret = os.environ['TOKEN']
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startwith("`hello"):
await message.channel.send("Whats good!")
client.run(my_secret)
again using replit, this gave a really long error
Remove
bot = commands.Bot(command_prefix="`", intents=intents)
You never use that..
Remove
intents.members = True
as well
You don't need that either as you never use it either
Why not
Look the code, they are using
client = discord.Client(intents=intents)

Yes using Bot is recommended, though they can at least get their bot running by removing unnecessary declarations and intents
supreme error again
Well sorry but we are not interpreters so we can't guess your error..
soething to do with my TOKEN variable...
Again, that's very vague how about you give the actual error ._.
Though my supposition is that you haven't set the environment variable
Sensitive information, such as credentials and API keys, should be separate from your code.
yeah something about that
Take a look at that
#So i have a separate file that stores TOKEN, this is the code:
import discord
import os
client = discord.Client()
intents = Intents.default()
#the Intents.default() now has red squiggly line
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startwith("!hello"):
await message.channel.send("Whats good!")
client.run(os.getenv("TOKEN"))
#The SAMEerror:
Traceback (most recent call last):
File "main.py", line 4, in <module>
client = discord.Client()
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
Maybe you can explain why you removed that
I just told you to specifically remove
intents.members = True
Never told you to remove
intents = Intents.default()
client = discord.Client(intents=intents)
#So i have a separate file that stores TOKEN, this is the code:
import discord
import os
client = discord.Client()
intents = Intents.default()
#the Intents.default() now has red squiggly line
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startwith("!hello"):
await message.channel.send("Whats good!")
client.run(os.getenv("TOKEN"))
#The SAME error:
Traceback (most recent call last):
File "main.py", line 4, in <module>
client = discord.Client()
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
Stop declaring twice client=
Have it only once
what am i doing man
And you need to import the package accordingly, again
from discord import Intents
yess it worksss
for nowmost likely will come back later
Now consider using commands
https://discordpy.readthedocs.io/en/stable/ext/commands/commands.html
i typed !hello
2022-10-17 13:12:41 ERROR discord.client Ignoring exception in on_message
Traceback (most recent call last):
File "/home/runner/Call-Of-Duty/venv/lib/python3.8/site-packages/discord/client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "main.py", line 17, in on_message
if message.content.startwith("!hello"):
AttributeError: 'str' object has no attribute 'startwith'
!d str.startswith
str.startswith(prefix[, start[, end]])```
Return `True` if string starts with the *prefix*, otherwise return `False`. *prefix* can also be a tuple of prefixes to look for. With optional *start*, test string beginning at that position. With optional *end*, stop comparing string at that position.
uh
There's a difference between a, yours, and b
a. startwith
b. startswith
sigh
now no error, no reply
Add this below intents = Intents.default()
intents.message_content = True
and enable the intent in the Discord developer portal - https://discord.com/developers/applications
yess it replies
Now use actual commands instead of the on_message event as it's bad practice, examples are here
https://discordpy.readthedocs.io/en/stable/ext/commands/commands.html
now to make a full on combat simulator since my friends want me too but ill get there soon
ok will read
Essentially the same, just replace the client = ... related line with
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
and then create commands with
@bot.command()
async def hello(ctx):
await ctx.send("hello")
so all my @client.event becomes @bot.command()
You have only one, so you'll remove it and only use @bot.command()
And
@client.event
async def on_ready():
...
becomes
@bot.event # Only changes here
async def on_ready():
...
replaced all the client. to bot.
Traceback (most recent call last):
File "main.py", line 9, in <module>
bot = commands.Bot(command_prefix='!')
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
``` AGAIN???
Well that still doesn't change, you need to pass intents=intents in the constructor all the time
import discord
import os
from discord import Intents
intents = Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print("We have logged in as {0.user}".format(bot))
@bot.event
@bot.command()
async def hello(ctx):
await ctx.send("hello")
if message.author == bot.user:
return
if message.content.startswith("`hello"):
await message.channel.send("Whats good!")
bot.run(os.getenv("TOKEN"))
#error:
Traceback (most recent call last):
File "main.py", line 10, in <module>
bot = commands.Bot(command_prefix='!')
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
Still not passed in the commands.Bot constructor
Still not removed
client = ...
Still not removed on_message and replaced with an actual command
ok lemme edit my thing
import discord
import os
from discord import Intents
intents = Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print("We have logged in as {0.user}".format(bot))
@bot.event
@bot.command()
async def hello(ctx):
await ctx.send("hello")
if message.author == bot.user:
return
if message.content.startswith("`hello"):
await message.channel.send("Whats good!")
bot.run(os.getenv("TOKEN"))
Still the case
Still the case
File "main.py", line 20
if message.author == bot.user:
^
IndentationError: unindent does not match any outer indentation level
i dont need that part right
Correct
You have either a bot.event or bot.command but not both
Just need await ctx.send("hello")
i thought dont remove client = discord.Client(intents=intents)
I just said you need to
well
Traceback (most recent call last):
File "main.py", line 9, in <module>
bot = commands.Bot(command_prefix='!')
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
Still the case x3
^
import discord
import os
from discord import Intents
intents = Intents.default()
intents.message_content = True
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print("We have logged in as {0.user}".format(bot))
@bot.command()
async def hello(ctx):
await ctx.send("hello")
bot.run(os.getenv("TOKEN"))
Why on earth did you remove commands.Bot(..)
wait a minute
Told you to remove discord.Client
Which you did correctly
i wish ?tag lp existed here
Yeah

๐
hate when they delete the message
kewl
sorry
i was just in time to witness
good for you
lol
its a historical momett
sorry for english
PS consider learning Python before doing a bot, it's not really meant for beginners - at least know the basics
https://www.pythondiscord.com/resources/
the only thing i did was learn it for half a year once a week is lucky in school
You'll need more knowledge than half a year once every week, and motivation as well; once a week doesn't really show motivation at all
i cant make out this error is
Bot doesn't seem to have permission to create application/slash commands within a guild
Make sure bot is invited with applications.command scope, should be default now when inviting though
Shouldn't add that to your bot, against Discord ToS - they don't like it
Can use .members on the channel object and then give them for the select menu
what did i do wrong here
its __init__ not __int__
oops
25 is max number of options
so if users are more than 25 it won't work
u can just assign discord.ui.select to a var and keep updating
move people from one voice channel to another
well I'm sorry I'm dumb and can only read sentences that aren't surrounded by other text, my fault
hmm so u read only single sentences not paragraphs? 
how can i stop asyncio sleep ? within the command ?
for example
i have
await asyncio.sleep(20)
How can i stop that from happening ?
cuz i am making a notify me and cancel button
and if you click notify me it will do this
but if i click cancel i want it to cancel doing that
How to send long code
@hallow kernel, looks like you posted a Discord webhook URL. Therefore, your message has been removed, and your webhook has been deleted. You can re-create it if you wish to. If you believe this was a mistake, please let us know.
does anyone know any good bots for reporting stuff to mods? I've looked at modmail and you have to physically DM the bot and verify which I would imagine would be too annoying to follow through with, and a ticket bot is just hard to report someone else because its only you in the chat with a moderator
hhhh i had to remove whole link
wdym webhook has been deleted, how you can do this?
I think most bots work similar to that
async def on_ready():
log("started, getting bank channel...")
ch = client.get_channel(sender.bank)
log("got bank channel.")
times = int(input("how many arts to send?: "))
log(f"sending {times} arts...")
for i in range(times):
log("making history")
history = ch.history(oldest_first=True)
log("made history, asking first message...")
first = await history.next()
log("got first message, downloading art...")
first_art = await first.attachments[-1].to_file()
log("loaded art, sending art...")
sender.send_art(first_art, file=True)
log("art sent, deleting from bank channel...")
await first.delete()
log(f"deleted. done {i} arts")
log("finished!", "\n"*2, "-"*15)
exit()
if __name__=="__main__":
log("starting...")
client.run(sender.token)
Yea something like this
So what is happened with channel.history?
it was changed in dpy 2.0
see the examples in the docs for the new usage
!d discord.TextChannel.history
async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the destinationโs message history.
You must have [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") to do this.
Examples
Usage...
Hi! Can i somehow get access to guild or command author at this point?
@CLIENT.tree.command(name="name")
DiscrodWebhook strange
im1: source
im2: whook link 1
im3: whook link 2
First made perfect and second made some sss...
Log
I have no ideas......
library broken maybe
Explanation:
I tried to send images with webhook to 2 discord servers, it sent normal on first, but on second it send with no pfp and no image data, only empty files
if you're reading from a file and it comes out as a 0 bytes image, it usually means the file was already read once and needs to be seeked back to the start before reading again
hm, ok, but what is with pfp(avatar), same?
i cant tell where you even sent the pfp from that screenshot, which you should also show as a paste so its easier to read
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
given that it seems you're also using discord.py (based on your log) i would suggest using its builtin webhook support rather than the discord_webhook package
pls help
Wrap it in an asyncio task and call cancel() on it when you want to cancel it. See https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.cancel
ok
There is an example on the docs explaining how to do so, take inspiration from it
ok can you show me the example cuz i dont see it
async def cancel_me():
print('cancel_me(): before sleep')
try:
# Wait for 1 hour
await asyncio.sleep(3600)
except asyncio.CancelledError:
print('cancel_me(): cancel sleep')
raise
finally:
print('cancel_me(): after sleep')
async def main():
# Create a "cancel_me" Task
task = asyncio.create_task(cancel_me())
# Wait for 1 second
await asyncio.sleep(1)
task.cancel()
try:
await task
except asyncio.CancelledError:
print("main(): cancel_me is cancelled now")
asyncio.run(main())
# Expected output:
#
# cancel_me(): before sleep
# cancel_me(): cancel sleep
# cancel_me(): after sleep
# main(): cancel_me is cancelled now``` is it this
Yes, no need to paste it here
ok
@hushed galleon any ideas?
You can see they await asyncio.sleep(3600) but cancel that afterwards with task.cancel()
Read the code
ah nvm
hm it doesnt seem like you're reading the same file more than once, though this is code is also somewhat janky
it is not working
how does it even work
Look at the code
bro i dont understand it
They create a function to sleep, they wrap that function in a task and call it. Then they cancel it
Well technically they cancel it first hut that doesn't matter
like i need this in buttons
task.cancel()
so i just use task.cancel
the most significant improvement would be switching to discord.py webhooks, so id start with that
!d discord.Webhook
class discord.Webhook```
Represents an asynchronous Discord webhook.
Webhooks are a form to send messages to channels in Discord without a bot user or authentication.
There are two main ways to use Webhooks. The first is through the ones received by the library such as [`Guild.webhooks()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.webhooks "discord.Guild.webhooks"), [`TextChannel.webhooks()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.webhooks "discord.TextChannel.webhooks"), [`VoiceChannel.webhooks()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.webhooks "discord.VoiceChannel.webhooks") and [`ForumChannel.webhooks()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.ForumChannel.webhooks "discord.ForumChannel.webhooks"). The ones received by the library will automatically be bound using the libraryโs internal HTTP session.
The second form involves creating a webhook object manually using the [`from_url()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook.from_url "discord.Webhook.from_url") or [`partial()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook.partial "discord.Webhook.partial") classmethods.
For example, creating a webhook from a URL and using [aiohttp](https://docs.aiohttp.org/en/stable/index.html "(in aiohttp v3.8)"):
And it can solve all problems..
still not working
Thanks, I can definitely read your screen from where I am and see why it's not working ๐
you said before that the code was not needed
I said you don't need to copy paste the code from the docs, not yours...
ah ok
Yeah that's not like the docs as I can see, the sleep is the only thing in the function
ye
Got other things to do, so someone else can help you further
i hope so
for using it id structure your code as something like this: ```py
Define the webhook
session = aiohttp.ClientSession()
webhook = discord.Webhook.from_url('https:...', session=session)
async for message in channel.history(limit=times, oldest_first=True):
# ^ Simpler than using anext() repeatedly
file = await message.attachments[-1].to_file()
# Send the file through the webhook
await webhook.send(file=file)
# Delete the message afterwards...```
send() is also where you can specify the username and avatar_url, you can check the previously linked docs to reference that
I wanna send only few arts...
Solution:
still maybe something like break
thats what limit= is for
Hmm
Uh, genius, i unreasonably considered that it works only with oldest_first=False
Ok ill try tommorow
Thank you
Uh no, i remember the reason, i thought it will give last three messages oldest first
Like
Discord: (line-message)
hi
how are you?
im fine
and you?
too
And it will return (history limit=3, oldest_first=True)
Return: (line-list element)
im fine
and you?
too
still think like that
https://paste.pythondiscord.com/foletegami
Anyone know why this does not work? It works in main.py but I want it to work from an interaction of a user.
simply saying "it doesn't work" doesn't help. Are there any tracebacks that you could send? What is the expected behaviour vs the actual behaviour?
Literally no errors, its supposed to ask you the questions and store them in a list and send it in an embed, but it just sends the error message saying "timeout etc" even tho i messaged
not sure what you mean, both history approaches should still give Message objects
I need oldest message in channel
Someone just ping me if you know/DM
but it instead gives the newest messages regardless?
It works so i wont change code
well then you probably have something eating your errors, cause bot doesn't seem to be defined in the scope
People with lack of experience/habit tend to forget self 
tbf this is a kinda of odd approach to this
and you don't even have to pass in bot at all, just use interaction.client
if u are gonna use an interaction just use a modal itself for this 
Yeah
Just purchased a raspberry pi 4
And I was looking into how to host multiple bots
Anyone know a good article/video they can share?
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content == "hello":
await message.channel.send("Welcome!")
Why isn't the bot responding when message.content is "hello"
you need message_content intent
dev portal and bot object
where did u get urs ive been thinking about doing this.
Facebook marketplace
this intents thing is annoying, how can I include them all
discord.Intents.all()
ok
im getting
ight thanks
discord.py doesnt even work for me anymore
How so?
I have no idea, it used to work fine now it doesnt.
Bot gets online but commands don't work
Your message content intents are disabled
You need to enable them in the dev portal first then in your code
is that a new update
Yes major version 2.0 was released a month or so ago
MESSAGE CONTENT INTENT?
Explains why.
But discord's message content intent went live much longer before that
?
yeah
intents = discord.Intents.default()
intents.message_content = True # this is the important part
bot = commands.Bot(..., intents=intents)
as always not a plug and play copy and paste solution but more of a general idea
yes
Alright, ill try it.
intents.message_content = True
AttributeError: 'Intents' object has no attribute 'message_content'
Oh right
You need to be on discord.py version 2.0
It worked without the Intents lol
``
@commands.Cog.listener()
async def on_command_error(ctx, error):
if isinstance(error, commands.errors.NSFWChannelRequired):
embed = discord.Embed
embed.title = "NSFW Command"
embed.description = error.args[0]
await ctx.send(embed=embed)
``
|| discord.ext.commands.errors.NSFWChannelRequired: Channel 'no-nsfw-test' needs to be NSFW for this command to work. ||
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'choice'```
i get this error bc `random.choice` doesnt work
This is my Code
temp_array = []
bot = ctx.guild.get_member(client.user.id)
count = 0
for r in ctx.guild.roles:
if r.position >= bot.top_role.position:
continue
else:
count += 1
temp_array.append(r.id)
And this is the Error I get Command raised an exception: AttributeError: 'int' object has no attribute 'id'. Im not sure what I did wrong because normally when I do this things it works
btw to get your Bot as member you could just do ctx.guild.me
property me```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
thanks
isn't the error pretty clear?
could you share your code?
yeah but i want that the bot send an embed that this channel is not nsfw
ohh i got it
you may have a command called "random"
Yes, you overwrote the random lib
you can change the name of the function to something like _random or random_command or something more specific or fitting than just random. You can pass in the name= parameter to change the name of the command that you'll type in discord to be seperate from the actual function name
๐ญI'm dumb
@bot.command(name="hello")
async def world(...):
...
the command would not work with !world but would work with !hello
I understand what I did wrong, thank you guys.
is there a clean way to import across all your modules the same module rather than doing import x on every thing 
i'm tired of writing py import asyncio
Can you explain better what you are trying to do
in one line i somehow import asyncio to every module im using in a folder
instead of writing it every time
@dull terrace
some editors (at least pycharm) have the ability to use live templates, but I don't see why you'd use that for just one line
@bot.command()
async def world(ctx):
await ctx.send("world")
@sick birch
starting a new project, my last one was 5.5k lines split between like 20 files
the amount of times i forgot to import something
probably more of an #editors-ides question too
you forgot the @
yea
what about it?
Just purchased a raspberry pi 4
And I was looking into how to host multiple bots
Anyone know a good article/video they can share?
If it's running Ubuntu you can just use screen utility
Oooo thanks
if you know how to host one bot on the rpi you also know how to host many bots, since a discord bot simply needs a process to run on
the most basic setup would be manually starting each bot script, but raspbian OS (and also ubuntu if you already installed it) manages services with systemd, therefore you could set up a unit file per bot to run on and have them start on each boot
why dont ppl commonly dopy intents = discord.Intents.all()
It's not recommended because it enabled all intents which increases the computational power
It's OK in the testing or development phase but when it goes out to production it's important you change it to only the intents you need
Or just keep it as the intents you need from the start
Imagine if you're in a larger server, and your bot doesn't care about presence updates, but you can potentially get multiple presence updates that discord.py has to parse out and dispatch for you which can be a problem
TL;DR it's a waste of resources
basically
im trying to make my first simple discord bot but its giving me an error with this code
import discord
import random
TOKEN = 'my token that i deleted for this'
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
client.run(TOKEN)
File "C:\Users\rmont\PycharmProjects\discordBot\main.py", line 6, in <module>
client = discord.Client()
TypeError: Client.init() missing 1 required keyword-only argument: 'intents'
client = discord.Client()
TypeError: Client.init() missing 1 required keyword-only argument: 'intents'```
you have to define intents inside the class of discord.Client()
so like discord.Client(intents)?
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
example:py client = discord.Client(intents = discord.Intents.default())
so what would i do to fix this
use my example to define your client
it gave me a whole bunch of errors wehn i replaced it
send errors
data = await self.request(Route('GET', '/users/@me'))
File "C:\Users\rmont\PycharmProjects\discordBot\venv\lib\site-packages\discord\http.py", line 744, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\rmont\PycharmProjects\discordBot\main.py", line 13, in <module>
client.run(TOKEN)
File "C:\Users\rmont\PycharmProjects\discordBot\venv\lib\site-packages\discord\client.py", line 828, in run
asyncio.run(runner())
File "C:\Users\rmont\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\rmont\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "C:\Users\rmont\PycharmProjects\discordBot\venv\lib\site-packages\discord\client.py", line 817, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\rmont\PycharmProjects\discordBot\venv\lib\site-packages\discord\client.py", line 745, in start
await self.login(token)
File "C:\Users\rmont\PycharmProjects\discordBot\venv\lib\site-packages\discord\client.py", line 580, in login
data = await self.http.static_login(token)
File "C:\Users\rmont\PycharmProjects\discordBot\venv\lib\site-packages\discord\http.py", line 805, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.```
you gave the wrong token
breh
on the very last line, it says Improper token has been passed.
ok ill reset it
๐
it said
[2022-10-17 21:22:35] [INFO ] discord.gateway: Shard ID None has connected to Gateway (Session ID: 1d8b0bb42729fca37aaab9d9082d01e1).
We have logged in as Ethan Mwiti#9621
thanks
yes good job
btw
BRUH THERE ARE NO DAMN SPACES
so i do this?
dude you cant just use different indent sizes in your code
sadly replit just becomes a bozo when u do so
ok so you see a = len(e)
well replit is my temporary bc it sucks Idk about this
ye?
can you explain to me why it is indented more than if a == 36:
What im trying to do is ex: when i do !mines (36length long)
then it will reply to the user getting round id
when you said mines = None, you said that if the mines argument isnt given, it should default to None
e should come before mines because it's required
you have not set e equal to anything in the function, so yes, the argument is required
yes
but due to positioning you cant have required arguments after a default argument
now it's just a matter of indents
I dont know alot of py tbh
ok so
My friend is just helping me out but hes offline
?
I usually don't like telling people this but discord.py is not a beginner friendly library and you'll only be doing yourself a favour by learning intermediate python before attempting discord.py
This current issue should ideally take no more than 5 seconds to solve
But as it stands, everything after if a == 30: needs to be indented one step so it's inside the function
when it says if (line 71), else (line 76), and try (line 81), since these arent indented, you have put them OUTSIDE of the pmines function, meaning the pmines command will not execute that code
I managed to fix it.
@bot.command()
async def pmines(ctx, e, mines=None, spots=None):
a = len(e)
if a == 30:
await ctx.send("**Getting RoundID {e}**")
# rest of code here
yes but now
can you copy and paste your code
@amber ether
instead of sending a picture
i legit did that on my own XD
?
async def pmines(ctx, e, mines=None, spots=None):
a = len(e)
if a == 36:
await ctx.send(f'**Getting RoundID {e}**')
if checkid(e) == False:
return
await mines(ctx, e)
else:
time.sleep(2)
await ctx.send('**Invalid RoundID**')```
The indents are still messed up
now at else: its gonna give me, unindent does not match any outer indentation level. But when i move it its still on
lemme legit try this on VS
async def pmines(ctx, e, mines=None, spots=None):
a = len(e)
if a == 36:
await ctx.send(f'**Getting RoundID {e}**')
if checkid(e) == False:
return
await mines(ctx, e)
else:
time.sleep(2)
await ctx.send('**Invalid RoundID**')```
The last two lines should be indented as well
Why the useless reference and contradictory annotations?
ohh
sorry for picking on you Robin
It's exactly their code, copy pasted
With the initial indents fixed up to get them on the right foot
fix it
why not left?
Ok I'll stop kek
That's going to detract away from the main problem. Don't want to overwhelm them. One issue at a time
Throwing everything wrong with the code at their face is not going to help
Indents first, as that's the basic building blocks of the app, then the logical errors that require a little bit more thinking
I would say fixing one issue would still overwhelm the user from what the messages sent
No need to make it worse then, eh?
true ๐ unlike discord.js Saying u dumb boi. but idk How tf i get this Error i litterally fixed it
Your else statement currently has nothing in it
You probably meant to indent the time.sleep(2) so it's inside the else
oh
yeah there's quite a few i'll give you that
lol
why is everything so damn hard to learn lol
reap?
if mines == None:
await ctx.reply("You forgot mines! `.pmines (MINES) (SPOTS)`")
return
elif spots == None:
await ctx.reply("You forgot spots! `.pmines (MINES) (SPOTS)`")``` i get yield outside the function?
full code pls
why does this not work
import random
TOKEN = "my token :)"
client = discord.Client(intents = discord.Intents.default())
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
username = str(message.author).split("#")[0]
user_message = str(message.content)
channel = str(message.channel.name)
print(f"{username}: {user_message} ({channel})")
if message.author == client.user:
return
if message.channel.name == "chat":
if user_message.lower() == "chicken":
await message.channel.send(f"hello {username}! did i hear chicken?")
return
elif user_message.lower() == ("summon mwiti"):
await message.channel.send(f"IM NOT GOIN BACK TO WORK UNLESS I GET ME SOME FRIED CHICKEN")
return
elif user_message.lower() == ("watermelon"):
await message.channel.send(f"Where?")
return
client.run(TOKEN)
i dont get any errors but it doesnt work
starting from @bot.command
it's an idiom
rmont: (chat)
rmont: (chat)```
Default intents doesn't include message content
so what do i do to fix it?
cuh wtf
You'll need something like
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
Intents.all
ah, yeah, the words defintion isnt really suitable with the context
Individual words of an idiom usually don't make sense in any context - the idiom "reap what you sow" means you get what you put in, in this context, you need to put the effort into learning something before you can use it
An elif needs to immediately follow the ending of an if statement
You have a return statement breaking up the flow
I've never heard of that idiom tbh
first thing that came to mind
Did your grandma told you that?
!resources in all seriousness though @amber ether I think you may find some of the resources here helpful
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
mayhaps
fixed that
I JUST DONT GET INDENTED I LITTERALLY NOT FIX THAT
|
That's something my grandma would tell me, wise people am i right
I, er, sorry?
where
not wise enough to know if thats a compliment
that gives me errors now saying my token is incorrect
Then your token must be incorrect
How would that be a compliment?
but when i use the same token and undo what u suggested it works so im confused now
What does the error say?
I have a feeling it's not the improper token is passed error
yeah nvm read a bit wrong it says at the bottom
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.```
knew it
yup just follow the link in the error and do as it says
you should be golden
yes it works thanks robin
np
my bot is not working anymore? when i do .pmines 3 3 but without 3 3 it will say you forgot spots Like idk why. I just restarted my Bot now its not working
Can someone do anything naughty with your application id?
Like with bot token, they can have access to your bot.
I donโt think they can
Application ID is bot's user ID most of times
What malicious stuff could you do with user ID which is public data
ye
@slate swan show ur code
you want me to send the whole file?
no, just the method it's reffering to
I dont know which method it is reffering to you
you didn't invite the bot with application commands scope in the server mb
does anyone know how to send a embed with a view in a specified ctx.channel?
currently this doesnt work : py await self.current.source.channel.send(embed=self.current.create_embed(),view=MusicUI(MusicV2.get_voice_state(self._ctx)))
the issue is not how youre sending it
but what you are sending
.send(embed=embed, view=view)
is correct.
are you getting an error?
Nope
can you send some more code?
Uhmm
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
Wait
can i set a spoiler in an embedded image?
try assigning a var to those functions and send the var rather than calling them inside of the .send function
@brave flint
How?
What code
Add spoiler=True in the discord.File() parameters - discord.File(..., spoiler=True), ... being what you have right now. Then you will see if it works or not
Like the button things?
Ok
|| spoiler url ||
That's not an *embedded * image
you realize u can use urls for an image right?
fetching it from a web server, so it should be like embed.set_image(spoiler=True,url=)?
Nah that won't work
Needs to be a discord.File object
alright, thanks man
is it sending the embed but not the view? or not sending either?
what? no it doesnt?????????
embed.set_image(url=|| img url ||)
but its not wrong ? wtf
u explicitly said no as if it isn't plausible
it is wrong.
Not sending either
No embed, no view
No error
read. the. code.
that. won't work.
thats not what i was referring to
of course if you don't read the code and what I've sent you can't understand
but that's a different issue
alright guys don't fight it's fine i appreciate you both
you can't have a spoiled image in an embed, can you?
you think he is trying to spoil an already embedded image. he isnt he is trying to send a img in a discord EMBED and add a spoiler
Pretty sure you can
yeah
And that is not possible..
You're not that advanced to guess what my brain thinks, sorry
yo staff?
can we tell this dude to chill wtf
XD
You are the one already coming back? I am simply replying to you..

for the person who needs help, sending an example of what you're trying to do would be more helpful
Oh ye seffo, it will send the embed if i remove the view part
.
Your MusicUI class expects ctx but you're passing a voice state to it

No error, well its an old one
Wait lemme try
Im on school rn so...
He said "yeah" to the second part, explaining what HE wants.
I said "No I don't think that" to the first part where you randomly guess what I think, not what HE wants.
jeez move on instead of always coming back 
you are also mixing ctx and interaction
Won't work either way with || url ||
it will raise some error saying url must be an http or https
Most likely, yeeah
Hence discord.File
And provide an attachment
If they can be even spoilered, which I think but not sure
as for discord.File the spoiler kwarg does nothing but add a SPOILER_ before the file's name
so i doubt if even that would work
If spoilers are supported in embeds it most likely will
Well looks pretty bad and not what they want
So either way, both solutions are wrong and not what they want
yeah it doesn't work
lol sed, any other way tho?
ooooo there's no spoiler in embed
Image spoilered in the embed apparently not
Will be sent separately
I used
f = discord.File("x.png", filename="x.png", spoiler=True)
e = discord.Embed()
e.set_image(url="attachment://x.png")
await ctx.send(file=f, embed=e)
got the result above
depends on use case but you can prompt user of image then send ephemerally
it's fine i'll just do it without spoiler
Ikr, i should mine vc
try url="attachment://SPOILER_x.png" instead
the filename gets changed ( copy the file's url and see)
Can try, give me a few seconds
Nop
Sends in the embed, just not as a spoiler
Kind of sad they don't support that
When a image is embedded due to being linked to by URL such as https://media.discordapp.net/attachments/561700849022140417/943800897358680064/SPOILER_Screenshot_20220217-092731.png The spoiler file...
i think thats not the problem
hmmm,i need MusicUI to expects voice states
Then change your class to do that
!user
You are not allowed to use that command here. Please use the #bot-commands channel instead.
new bot work starts today 
how many slash commands can we add?
what's the limit?
100 global CHAT_INPUT commands
5 global USER commands
5 global MESSAGE commands
even for private bots?
Doesn't matter, it's the same
Can read more about them here https://discord.com/developers/docs/interactions/application-commands
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
That's why slash commands suck
With prefix commands we are only bound to machine power but with slash commands we also have limited amount
Seems like the first time you say slash commands suck, maybe you got a reason to hate them today
Still curious why they added such a "low" limit
Well ig discord just can't allow infinite amount
Cause their databases gonna go boom boom
I wouldn't say they're bad just limited literally
I was not here to start an argument I can give yall another topic
This was only related to the limit nothing else
Also no support for arg lists
They still are somewhat limited, which is why I don't really like them so far
i wish the limit was somewhat around 300 commands lol
They are user-friendly tho
They are adding things which is nice
Not developer friendly
i added around 70 image manipulating commands only to get slapped in the face by the limit
But I don't think adding a channel only select menu is of any use so far
That was already doable before, just without a select menu
That looks like Apple politics ๐
use groups for similar commands
Also this discord mobile design update
Could maybe put more time and effort in things like modals, that are missing lots of components so far
and options etc
Apple definitely secretly took over discord 100%
You can also make a general image manipulation command that depends on input for results
slash group commands are just options anyways
it's still limited bro
Well that's when you use one command and make an option for it
Adding 70+ sub commands is not convenient either
use your bot's mention as prefix and get unlimited commands
i am talking about slash commands
Would be a nice use case of an auto complete option
Where you list the different manipulations that can be done
tbh if your bot has these many commands, i feel like its overloaded
Depends, for image generation there can be lots of different images
They're not unique commands, just variations of one
There's always that one bot that has like 1k commands kek
Hence just using an option is maybe not that bad
the owner of that bot never bothered to even see the grass
theres a bot called notsobot (also made w python) which has many image manipulation commands and it implements them using subcommands ๐ถ you just need to know how to organise the commands
But what if he makes /touchgrass command
Wasn't that bot terminated 
If the commands are organized in a good way it's not a big deal, but if you have commands like /generate cat, /generate dog, /generate ... you could as well just make /generate animal:dog
Which is, in my opinion, much more user friendly as you can make the animal option an auto completed option
Which is essentially what I use for my /tag command
lol
There are only a few tags, so could as well make them as sub-commands but it's not really handy, programmatically and user experience
could have added choices/autocomplete as well
Discord broke my connections or what 
Your 8 connections still appear, seems like a client issue
Same on mobile

๐ฆ
welp discord broke
Is it possible to describe an argument when the command is a hybrid command?
Yes
from discord import app_commands
# ...
@app_commands.describe(arg="The description you want to give.")
Alright, thanks
arg being the name of the argument in the function of course
are guild ids and user ids always different from each other
i think not necessarily
?
If you mean, you logging in as your bot and doing actions, that's against the ToS so you won't get help
thats against tos
Discord ids are always unique. You can read more about them here
https://discord.com/developers/docs/reference#snowflakes
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
What's so illegal about it? It's just sending requests with a different client
In fact any action done by bot can be considered done by its application's owner
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
thank you
"Illegal" is a big choice of wording, there are indeed no laws against that.
ToS don't restrict you from that to my knowledge as well
I am not native english speaker sorry I speak by synonyms
Developer policy doesn't allow people to login explicitly as their bot as far as I remember from other people's wording and my reading
You will use any developer credentials (such as your Application ID, passwords, keys, tokens, and client secrets) we assign to you solely with your Application and the applicable APIs...
https://discord.com/developers/docs/policies-and-agreements/terms-of-service#d-developer-credentials
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
It's more about confidentiality of that data imo
Still policies and agreements you accept by using Discord's API & Applications
Well if I login with bot's token and start sending requests authenticated as bot that doesn't really break this, does it? I am still using discord API and I don't disclose the token to 3rd parties
Ask Discord, we're not lawyers
I'm barely interested in that, was trying to figure out this for another person
You will only get a valuable answer from discord.
you are proving the bot token to a third party when you do that (, unless you're building the application you're logging in to yourself)
isn't that against tos
That's where the "solely with your Application" part comes in
Personally I meant my own client
If that's 3rd party client it's forbidden without any doubts
I don't think it's related
The section you linked was actually about keeping private data safe
The section is about the use of APIs. The second half of that paragraph is about not disclosing your token. The first part, that I quoted, is about where you can use that token.
It clearly states that you can only use your token with your application, and with the allowed APIs
Depends what they mean by "your application"
For some reason I haven't found a clear definition in that policy
Clearly defined
โApplicationโ (or โappโ) means any application (including any bot, game, activity, website, or other client) that accesses or uses our APIs or to which we have assigned an Application ID. โyour Applicationโ means any Application that you own or operate. References made to API Client in existing terms, policies, agreements, or Documentation will now mean Application.
section 13
^
to which we have assigned an Application ID.
"any Application that you own or operate"
โyour Applicationโ means any Application that you own or operate.
That is only used
โApp Contentโ means any data, information, technology, materials, or other content that you or those acting on your behalf add to our services or otherwise make available to us in connection with the APIs or your Application (including as submitted, posted, or displayed by or through your Application).
Hence unrelated
Its seems discord clearly state that its " not allowed "
Lets finish the topic ๐
"your Application" is not the same as "Application"
This is kinda outdated but ok
Bot user accounts are not the same
That's self botting, another unrelated topic
Nah, that post is mentioning this topic
what legitimate purpose would you even want a bot user account for?
No
We are talking about logging in as a bot with another client, such as some fake discord client for bot
Nah this question actually about user asked to login in bot account and discord replied
They are talking about making your account using a script to automate it
Why the heck every time when I get good mood I get into some pointless argument and then it worsens
@t0xapex Are you logging into the bot or your user account? Bot user accounts aren't allowed.
Which is not the same
Bot user accounts aren't allowed.
Meaning automating your user account
Absolutely unrelated to logging in as your bot
Never got worse until someone brought another unrelated topic in
Mood worsens
You don't get my point do you
Logging in as your account with your account's token and automating your account = bot user accounts = self bots
talking to programmers
Which is not the same as making a custom client to login as your bot using the bot's token
expected result is an argument 
The bro. Jamed
This was more of juridical cringe rather than programming
well, making a custom client to use your bot's APIs would be within TOS, as long as you don't try to access any APIs you're not allowed to
This is what I meant, my bad
For me that qualifies as an application so it's fine
Don't know how Discord considers that 
kek today i learnt js on pycharm for website
with no prior knowledge kewl

ew js
ikr
The only thing I created in js was the automatic github release tagger based on commits or smth and that's what js programmers definitely shouldn't look at
does it even do intellisense
surprisingly it does
i haven't tried a js ide yet or vsc or js at all so i can't compare yet
webstorm is pretty nice
I'll take ur word for it 
it's jetbrains' stuff
then its nice ๐
ah that was intellij whatever
same for webstorm etc.
yeah icons are custom icon pack though
which one?
ehm hold on
sure thanks
i think material but not sure anymore
changed so many times
yeah is that
noice thanks ๐
and theme is material arc dark
switching between that and material deep ocean
Make sure you're on latest version and python version, otherwise restart vsc
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Maybe you can explain why you have all of these when you only need one and py-cord will make conflicts
discord==2.0.0
discord.py==2.0.1
py-cord==2.0.1
What is discord
Am talkin about the first thing here
It's a mirror of discord.py
discord.py should be used
But doesn't really matter
Just no point on using both and no point on using discord.py and pycord
Just use discord.py
pip uninstall py-cord
No, disnake is cool
from my experience
Idk if disnake is included in your experience
It isn't hence you can't say "No" 


Using TEXT requires you to provide a size. There are some types that have predefined sizes, like TINYTEXT, 255 characters, MEDIUMTEXT, about 16,000,000 characters, and LONGTEXT, about 4,000,000,000 characters
Idk, I donโt use sql much
what the prob?
read the error
it says clearly no command named asd
which driver is this
aiosqlite asyncpg
i don't think aiomysql has a TEXT datatype not sure lemme check
hmm it does
all sql dbs have TEXT
ik ik my bad
oh damn ๐
no i am just kidding, i just don't want you to use that name
where should I start if I wanna start making bots with python
how much of python do you know?
bruh lol
it actually exists, and thats your issue
you could literally google "left function mysql" to verify it
The basics
use _left
Like functions variables loops
just change the name smh
nice, have you made any projects with python yet?
learn oop and asyncio
Yea I made a few like mini games
Made a simple discord bot that just replies to u and stuff
nice, so your first step for making discord bots would be choosing a library
there are many like discord.py disnake.etc... depending upon the library you choose the process varies
Where can I find more info about the libraries
use dpy largest community for it
Thatโs the one I used to make my simple one
discord.py
disnake
hikari
nextcord
py-cord
these are some popular ones
search for them on pypi (https://pypi.org)
yes
Thanks sarth
py cord ๐
not bad as per user convince ๐ถ
i just hate the codebase
you don't use ? in mysql, its %s
you asked the database to store them as Text and you are giving it as integer
str the ids
or use BIGINT data type for tables
Odd comma before FROM ig
bad commas
I made a embed welcome command but it gives a error embed.set_image(url="https://tenor.com/view/welcome-gif-23422204" invalid synatx)
code:
@bot.event
async def on_join(member):
channel = guild.get_channel(1008254245016981537)
embed = discord.Embed(title="Welcome",description=("f(Welcome, {member.mention}. Have a great day!")
embed.set_image(url="https://tenor.com/view/welcome-gif-23422204")
await channel.send(embed=embed)
can you send full traceback?
You are missing some ) at the embed = .... line
As you are using a ( too much when setting the description=(
Which is not needed, you should use f-strings instead to add variables in text for your description
!f-strings
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
So something like that instead
description=f"Welcome {member.mention}....."
Then you will have
embed = discord.Embed(title="...", description=f"...")
and that will be fine 
yeah how are u checking if they joined from your invite?
what does update_totals do?
thats the update_totals function right?
yea your passing the member that joined into that function
should it not be the member that invited them passed into that function
What editor and theme is that?
Well I mean it has to be ayu that's my baby
But I keep forgetting the editor
Wh-
๐ฟ
Does anyone have any idea how I would get the command to grab the text that triggered it?
I know modifier isnโt in there thatโs cause modifier is exactly what Iโm trying to figure out how to add.
Because I plan on using regex to search for the modifier inside the original text that triggered the command to apply it to the end result as a plus.
why not... use discord.ext.commands?
I do not know how to use it.
its a built in extension specifically for writing commands
although it does expect commands to be structured as prefix + command name + parameters
Thatโs fine.
As long as it can return the end result.
Iโd rather it work than well it not.
they're just suggesting the extension since writing commands in on_message tends to get messy/frustrating
but anyway, message.content would contain the text that the user typed in their message
Alright Iโll try that.
if you do go for regex you might use it on that to match the number of sides and the modifier character
Thank you.
@hushed galleon so I wrote it up and it came back with an error like this.
Iโm pretty sure I used message.content incorrectly.
apparently your modifier is None, which is what re.match will return if it doesnt match the string
id double check the regex in https://regex101.com/ first so you can get d20+ / d20 / d20- working, and also consider refactoring your startswith if-statements into just one with your new regex pattern
Yeah the regex is totally wrong.
Think I got the pattern now.
@hushed galleon ok so I fixed the regex and it definitely catches what I want it to now but it still comes back with the same error.
Wait hold on.
Caught what I did.
I was doing \d+ when I should have put \d+$.
It was getting two matches since I left the dollar sign out.
After fixing that I still got the same error.
Ok so I intentionally made it error out the the regex literally isnโt passing anything and I know the regex is correct now. So I think I must have implemented the message.content wrong.
Since it is recognizing the d20 as an int.
@hushed galleon
you should claim a help channel for this since its related to your regex
It isnโt the regex is the thing it does pick up the correct portion of the message.
Itโs just not getting any content or something.
re.match specifically scans from the start of the string
That must be it then.
Maybe itโs only scanning the front.

I think I get it now.
Itโs trying to match it to the entire string.
But it canโt.
And then returns nothing.
Iโll try something.
I may go wrong but Iโm more confident in it now.
It*
Different error this time but that better than the same error.
It actually came back with something.
@hushed galleon I got it working.
I realized Re.match only returns once it finds a match.
So it doesnโt actually return the content.
Just checks for a match.
re.group actually returns the content.
This is what it looks like in the end.
Iโll try adding the ability to roll multiple dice of the same type.
Instead of one die at a time.
A global for each loop would work I think.
Thanks for the help btw.
I thought discord.py ended
it did, then a few months later it wasn't anymore
it's very much still a thing
wow that's annoying I already switched libraries
ive switched from dpy 2.0a to enhanced-dpy, then to disnake, then back to dpy 2.0
i never bothered to bring my bot's features to parity so its never truly been the same since then ๐
hihi, can someone help me ?
https://paste.pythondiscord.com/motapifagu.py
so i want it to say a message every time a specific user says a message
but it isnt
@ me if someone responds btw im probs gonna go to sleep
why not send them here
just keep it appropriate though, given some of those responses in your code
yeah duh why would i get myself permad in a server i like
have you regenerated your token?
why should i regen it ?
its in that screenshot
run what
the paste you showed earlier?
i can point out possible issues in it but what matters is what happens on your system
e.g. client.get_user shouldnt be awaited, but somehow it ran fine for you given that your deleted screenshot showed the on_message print statement had worked
Do you get any errors?
nope
What happens when you type in a message?
why not use message.guild.get_user
so what's the issue
but when i want it to write a message after a specfific user writes a m,essage
it doesnt do it
Try comparing message.author to message.guild.get_member(879004139361816596) instead
The discord.Member to discord.User comparision might be failing
so change message.author to message.guild.get_member(879004139361816596)
No, change user1 to that
didnt work
How does that if statement look now?
@client.event
async def on_message(message):
user1 = message.guild.get_member(879004139361816596) # user1 = person the AI should send messages after
username = str(message.author).split('#')[0]
user_message = str(message.content)
channel = str(message.channel.name)
print(f'{username}: {user_message} ({channel}')
and the if statement at the end?
if message.author == user1:
response = f'die' # this should automatically send a message after user1 sends a message
await message.channel.send(response)```
looks right
both inherit from UserTag so this should work as expected, that is assuming get_user doesnt return None
try comparing the IDs instead?
if message.author.id == 879004139361816596:
mhm
I suspect that's what's going on
how so?
yup
Well actually default includes members, no?
or do you mean it's disabled on the portal
nah members is a privileged intent so discord.py excludes it from the default
so whjat do i do now
well, you can still assign the integer to a variable
thats what i want yes
so i can make it multipe users
Oh, you're right:
A factory method that creates a Intents with everything enabled except presences, members, and message_content.
Didn't see the "except" part. Silly me
i,e if author = user1, user2
you can store the ids in a list/tuple/set and then check if the message author's id is in that collection
e.g. ```py
OWNER_IDS = {654818715183087626} # IDs stored in a set
@client.event
async def on_message(message):
if message.author.id in OWNER_IDS:
await message.channel.send('master!')```
yeah but tuples still scare me
owner_ids is user1?
At this stage I think all you need to know is that it's a list that uses () instead of [] and can't be changed
so i replace py if message.author.id == 879004139361816596: response = f'die' # this should automatically send a message after user1 sends a message await message.channel.send(response) with
if message.author.id in OWNER_IDS:
await message.channel.send(response)```
and ids are something that WILL not cange
correct
what ab this
both of these should work given your member intents are enabled properly
nah you dont need members intent for that
if you have the intent disabled then it merely turns off join/leave events and discord.py's member caching, but messages will receive member objects as normal
i dont really understand whats going on in the screenshots
oh nevermind tverculosis is a different person right
i replaced my code with the one you sent me
yeah tverculosis is the guy with the ID
the ID belongs to him
did you make sure the ID written inside owner_ids is the same as their ID?
yeah, i just wrote an example
i c
so if i wanted to add more ids id do
OWNER_IDS = {879004139361816596, a, b, c}
so instead of owner ids itd be like
idk something else
thats just pycharm being peeved at your variable name
pep8 is a style guide, they want you to write cleaner code
man
how do i make the errors stop appearing
done
Ignore errors like this (EZ)
not the best idea
yeah that'll work
is it possible to make it so you could write messages as the bot from the console
more effort than it's worth
input() is blocking so you'll have to find an asynchronous version, it's not worth it
i wouldnt say its a lot of effort, but its janky
you can just run input in a thread with asyncio
what we do with @unkempt canyon is the mods have a "say" command they can run from private channels and troll us


