#discord-bots
1 messages · Page 17 of 1
how are these panels glowing 💀
lol
idk some weird screenshot app
magik
show ur command code
what's with this weird deco
@app_commands.command(name="post", description="post a gamepass")
@app_commands.checks.cooldown(1, 600, key=lambda i: (i.user.id))
async def post(self, interaction: discord.Interaction, gamepassid: str):
#view = discord.ui.View() # Establish an instance of the discord.ui.View class
#style = discord.ButtonStyle.blurple # The button will be gray in color
#gamepass = discord.ui.Button(style=style, label="GAMEPASS", url=gamepass)
#view.add_item(item=gamepass)
gamepass=requests.get(f"https://api.roblox.com/marketplace/game-pass-product-info?gamePassId={gamepassid}").json()
thumb=requests.get(f"https://thumbnails.roblox.com/v1/users/avatar-bust?userIds={gamepass['Creator']['Id']}&size=75x75&format=Png&isCircular=false").json()['data'][0]['imageUrl']
if not thumb == "none":
embed=discord.Embed(description="your gamepass has `successfully` been posted in | [#1004310613146734682](/guild/267624335836053506/channel/1004310613146734682/)",color=color.color)
await interaction.response.send_message(embed=embed)
channel = self.client.get_channel(1004310613146734682)
embed=discord.Embed(title=f"new post from {interaction.user}", description=f"donate bobux to **{gamepass['Creator']['Name']}**\n `Robux` = {gamepass['PriceInRobux']}\n`gamepass` = **https://www.roblox.com/game-pass/{gamepassid}/{gamepass['Name']}**",color=color.color)
embed.set_thumbnail(url=thumb)
embed.set_footer(text="/post to post your gamepass!")
await channel.send(embed=embed)
hm it's post
i fixxed
requests is sync
omg, my eyes 💀
hmm well i mean it's better than what i am seeing on phone atleast
i had friends those didn't type spaces anywhere they could, same here, do you guys like hate them?
i had friends who couldn't write code in first place
well not all friends are programmers i guess
i also have friends those can't write code
err by that i mean none of my friends do
oo good
not a single one 😔
or not
and i knew atleast 180 people in same class as me in past years
well those were not really friends, those are my classmates at programming school, everyone else I know except my dad can't code
nearest we got was when they played pubg in school pc in cs class 😔
lol
wut u go to programming school?👀
went
In my school we just used scratch and after a few classes the teacher disappeared
and it was trash
how many years/months
and I left
3 months
scratch programmers🗿
Turtle is useful
everyone there were total noobs, I knew python almost at teacher's level
err well each to their own
variables
objects:))
lmao
Boring af
go to #python-discussion, a lot of fun. probably... lmao
lol what really
disappeared
As you can see this embed has 6 values. The values that this embed can send can be random. But I want this embed to send only 30 specific amount of values, like 10. And then make embed pages
How can I do this?
Have you made UI views before?
no
And you're using dpy 2.0 right
There are examples of views here
@client.command()
async def kick(ctx, member: discord.Member, *, reason=None):
await member.kick(reason=reason)
#await ctx.send(f'Kicked {member.mention}')
@client.command()
async def ban(ctx, member: discord.Member, *, reason=None):
await member.ban(reason=reason)
#await ctx.send(f'Banned {member.mention}')
Traceback (most recent call last):
File "/Users/kevin/Desktop/Projects/Python/Bot/main.py", line 43, in <module>
@client.command()
AttributeError: 'Client' object has no attribute 'command'
Whats wrong?
only Bot classes have command attr
you have client = discord.Client
however it should be client = commands.Bot to use commands
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
async with x Asynchronously initialises the bot and automatically cleans up.
New in version 2.0.
Is that possible to make a argument missing message with integer missing?
I've tried doing but it returns that an integer argument cannot be NoneType
So should I replace client = discord.Client with client = commands.Bot
can anyon help me'
!e py error_string = "Argument something is missing." print(error_string.replace('Argument', 'Integer'))
@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.
Integer something is missing.
anyone here
not only this, see docs here #discord-bots message
channel = (message.channel.name)
print(f'{username}: {user_message} ({channel})')
this isnt working
Oh thank youu
you don't have to put message.channel.name in brackets, it only makes it a tuple, not a string
ok
also, any errors in console?
no
can you show full code of a command/event?
okk
import discord
TOKEN = 'bottoken'
client = discord.Client()
@client.event
async def on_ready():
print(f'{client.user} Is ON')
@client.event
async def message_on(message):
username = str(message.author).split('#')[0]
username = str(client.user).split('#')[0]
user_message = message.content
channel = message.channel.name
print(f'{username}: {user_message} ({channel})')
if message.author == client.user:
return
if message.channel.name == 'spam':
if user_message.lower() == 'Hi':
await message.channel.send(f'hello')
return
client.run(TOKEN)
it was working fine yesterday
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
I fixed it there are no errors but I cant kick and ban
any errors?
import discord
from discord.ext import commands
import os
os.system('cls' if os.name == 'nt' else 'clear')
token = ''
client = commands.Bot(command_prefix='!')
@client.event
async def on_ready():
print('------')
print('Logged in as')
print("Bot name: ",client.user.name)
print("Bot ID: ",client.user.id)
print('------')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content == 'hello':
await message.channel.send('Welcome to the server!')
if message.content == 'cool':
await message.add_reaction('\U0001F60E')
if message.content == '?help':
await message.channel.send('Here are the commands: \n\n ?help \n ?cool \n ?hello \n ?ping \n ?info \n ?invite \n ?source')
@client.event
async def on_message_edit(before, after):
await before.channel.send(
f'{before.author.mention} edited their message!'
f'\n**Before**: {before.content}'
f'\n**After**: {after.content}'
)
@client.command()
async def kick(ctx, member: discord.Member, *, reason=None):
await member.kick(reason=reason)
#await ctx.send(f'Kicked {member.mention}')
@client.command()
async def ban(ctx, member: discord.Member, *, reason=None):
await member.ban(reason=reason)
#await ctx.send(f'Banned {member.mention}')
client.run(token)
well there is no event message_on, only on_message
But how was it working yesterday
idk?
ok thanks lemme see if it works
# bot.py
import os
import discord
from discord.ext import commands
#client = discord.Client()
client = discord.Client(intents=discord.Intents.default(),proxy="http://myproxy.com:8080")
bot = commands.Bot(intents=discord.Intents.default(),proxy="https://myproxy.com:8080",command_prefix='!')
os.environ['HTTP_PROXY'] = 'http://myproxy.com:8080'
os.environ['HTTPS_PROXY'] = 'https://myproxy.com:8080'
@client.event
async def on_ready():
print(f'{client.user} has connected!')
@bot.command()
async def dosomething(ctx):
await ctx.send('I did something')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello!')
client.run('TOKEN')
Does anyone know why I can't kick or ban?
How do i run behind proxy ? this script is working but not working when any request
@storm rose so you type !kick @member and it doesnt kick?
yes
whenever i send a essage in the channel it shows this in console
when I google for request discord using htpps
well code looks nice maybe problem is outside, you could've not saved file or did not reload the bot @storm rose
{username}: {user_message} ({channel})
{username}: {user_message} ({channel})
can anyone help ? my server using proxy.
wow how many problems and only me helper
this script is working only bot is online
wish all the best for you sir
thanks mine is working now
lmao
i just started python last month so i didnt know what you were saying sorry
also @slim spindle i can't really help you since I didn't ever work with proxy and if problem is with it then it's probably not this channel topic. But what do I know about it...
guys is it possible to make a sort of map game using discord.py?
or is it better using js?
why do u have both client and bot?💀
it is
don't even know what a tuple is 😅
thanks for reply sir
i asked because i think i heard that js has newer features
but i dont know much javascript
python is so much simpler than js if u are not able to make in python it's gonna be gg in js
ok thxs
hm, so now that all problems are solved (i guess), I can return to my problem, what colour to use in help embed 
random()
ayooooooooo Master32 tytytytytytytyytytytyuytytyytytyytytytytytytytytytytytytyttyyt
lol true, but what if it will look trash
color won't matter much if ur help command embed looks good
turquoise
so how are ur embed designing skills
not quite good
turquoise light yellow pink all look good but if people are in daymode then rip those colours are invisible
cyan etc
all colors on the softer range mostly
pandas is running when I run the code on vscode. However, there is a problem when I want to run this code by heroku and I couldn't find any reason "why it is"
if people use light mode then RIP them
we should above 13 to be on discord right?
yes (im 5 dont reveal plsplsplspls)
why light theme 😭
im 13
idk
Light mode is better for your eyes!
why
my whole room is filled with light
dark mode is stilll better
go jump in the sun
dont say that🔪
hey I have a problem and I couldn't fix it
sed
thx
yes, buy discord and make cyan theme for me
why are u asking heroku pandas module problem in discord bot channel tho 
Do I write just pandas or pandas.py in the requirements.txt
pandas.djs
!pypi pandas
beacuse it's releated to this channel
write pandas==1.4.3
ok
write that
i don't see how unless u are using panda in ur discord bot
but what for 💀
and I use numpy. Should I write numpy as well?
dataframe
tiktok?
yeah pink but I use this theme for "NEON"
Otherwise I didn't use it
master32 what's the best looking help command u ever seen👀
I
I
I
I...
don't know...
pp..probably RoboDanny's?...
hmm ic well robodanny embeds don't look that gr8 only the pagination part looks nice
embeds are kinda cramped
yeah
well I got some random designer and he did this for me, idk, it looks kinda good, but im not the one who can rate help commands
nice'
how does discord bot responds in a specific server works? for example Server 1 and Server 2
if I send command in Server 1 it will not reply in Server 2
api?
Well it uses id's to determine where it needs to be send.
Since Discord.py is just an API wrapper you just don't need to worry about that.
I have this problem on my quiz bot like; I send answer in server 1, but it responds in server 2
lmao
Then you most likely used hard coded id's.
I use the same theme
cool:)
:D
can anyone help?
with?
what's the code? what's the error (if there is)?
no error
Hey @pearl shoal! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
its just a practice bot lol
import discord
TOKEN = 'bottoken'
client = discord.Client()
@client.event
async def on_ready():
print(f'{client.user} Is ON')
@client.event
async def on_message(message):
username = str(message.author).split('#')[0]
username = str(client.user).split('#')[0]
user_message = message.content
channel = message.channel.name
print(f'{username}: {user_message} ({channel})')
if message.author == client.user:
return
if message.channel.name == 'spam':
if user_message.lower() == 'hello':
await message.channel.send(f'hello')
return
client.run(TOKEN)
console:
Ansh: hi (spam)
so what's the problem?
no response from the bot
the bot will send a message when you send "hello" in a channel named "spam"
well you said hi, not hello
then the channel name is not spam
it is
then something you are telling is a lie
But you are not doing this properly.
pip show discord
ok
in terminal
What do you want to happen?
discord.py is not beginner friendly, you need to know python to use it
import discord
TOKEN = 'bottoken'
client = discord.Client(intents=discord.Intents.all())
@client.event
async def on_ready():
print(f'{client.user} Is ON')
@client.event
async def on_message(message):
if message.author.bot:
return
print(f"{message.author.name}: {message.content} ({message.channel.name})")
if message.channel.name == 'spam':
if message.content.lower() == 'hello':
return await message.channel.send(f'hello')
client.run(TOKEN)
What was the class to add_item a button?
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
Hello ash
hruu 
it was showing an error but when i removed intents=discord.Intents.all it workedstill no reply
because you didnt enable the intents on the dev page
you shouldnt see that there is an error, rather see what the error actually is

so before the problem was with enabling intents on dev portal and now it's because of message contents intents not enabled
I mean he did remove the error.

out of line, but right
the bot just replied 10 minutes ago with the old script
you updated versions so
or did you
no i didnt
nvm fixed it
nice
idk what i fixed but it started working
...
import discord
TOKEN = 'token'
client = discord.Client()
@client.event
async def on_ready():
print(f'{client.user} Is ON')
@client.event
async def on_message(message):
if message.author.bot:
return
print(f"{message.author.name}: {message.content} ({message.channel.name})")
if message.channel.name == 'spam':
if message.content.lower() == 'hello':
await message.channel.send(f'hello')
return
client.run(TOKEN)
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
Sussy client
imagine using Client 
?
then?
omg is that even a thing?
This is sus too
😦
AutoShardedBot 👼
wait now iknow what pandabweer did wrong he wrote "return await message.channel.send(f'hello')
This code is indeed sus
i dont understand
anything what everybody is saying
use the commands extension, you can simply create commands like
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents=discord.Intents.default())
@bot.command()
async def spam(ctx: commands.Context) -> None:
if ctx.channel.name == "spam":
return await ctx.send("hello")
bot.run(token)
spam can be invoked using !spam 
That's functionally equal to
await send(...)
return```
what is the problem with it?
Cause send returns Message (i forgor)
i just did await message.channel.send(f'hello')
There's no need for f prefix if you gonna use just a string without inserting stuff into it
wha-
ahh
god
and then return under it
and I got ignored 
Yes
Yes
ok
logging
why is my script sus it works fine
Best thing
ofc
Common mistake of beginners: this works so it is totally fine
?tag itworks
This is not a Modmail thread.
bruh wrong server
what does that do? It saves console output as a log?
guys i have a question
What's the number of that april 1st PEP
why do you guys even make a bot
just interested
my friend tried to do pip install discord in console and after installation
he did import discord and it didntt work
Same question I am developing unity game
for fun mostly, but also for money
imagine
fr that's thousand times better
And it's very sus

I have no idea what I am making it for and its current content makes no sense
could be problem with python version
that's even more pointless than my life
i am trying to make a bot for the past 2 years first i used discprd.js that was so complicated then last month i found that we can do it through python also
Not really, I am learning some gamedev stuff
Tbh I learned quite a lot while making this concrete game
haha, your life is not even close to pointlessness of my life
flex - ||im on an💀 i3 dell laptop
I believe in equality 
go make a discord bot 
its hard
Why not I guess
ok
I learned python by creating a bot for a community
I make them when the random motivation at 3am appears
where are you guys from?
and well now I got my own bot
Argentina
London 
for argentina users i guess
lmao
why?
because you ask where are we from
San Francisco
no its for my server]
PokeMod
we will ban people using pokemon attacks lame but i like it so idc
My last thought was to make a "nerd bot" that would disagree with every statement in a channel and say "um, actually"
did someone here use contabo as a host for a bot?
What is that
a host
🤣
Hosting website
I don't know any other hosts than ubuntu server
sounds like my cat's dad's name
something you will not use
3 am shit do some real damage
How is he named
One dude tried to run one of my open source bots that uses postgres and docker on replit
oh
And was like "how to run it"
hope dies last
why is it bad
The only thing that seems ok about that is poetry
its same as vscode
no
bad for hosting a discord bot
Vscode is much much better
👆
we cant host on vscode
i cant keep my laptop on whole day
Build some server from old computer parts if you have some
for hosting this
Like I did
i dont
Imagine buying a server when you can build one 😏
this is my first laptop...
euwoue
I had some random old computer parts like intel pentium and 3gb of ddr3
It works well 😀
why am i automatically added to these "EGIRL CLUB | CHATTING" servers
lmao dont click random links
Probably some bad oauth2 link with guilds.join scope
Discord oauth2 links can make you join the guilds once authorized
i dont addd random bots
While I was making dashboard for bot with django I learned their oauth2 inside out
how to make kick command?
Well only with identify and guilds scope but who cares
owowowowowowowowoowowowow
use your feet
you didnt know about that? 
!d discord.Member.kick
await kick(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.kick "discord.Guild.kick").
kick user cmd
What is cogs?
I did, just never worked with it
do we have to import something
!d discord.ext.commands.Cog
class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.
A cog is a collection of commands, listeners, and optional state to help group commands together. More information on them can be found on the [Cogs](https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html#ext-commands-cogs) page.
When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta") are equally valid here.
Yeah
or groups
Classes for better organisation
Groups are a bit different if you mean commands groups
yeah
!d discord.Member.kick
await kick(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Kicks this member. Equivalent to [`Guild.kick()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.kick "discord.Guild.kick").
ok
noone will spoonfeed you here
add_item(item)```
Adds an item to the view.
This function returns the class instance to allow for fluent-style chaining.
That didnt help me at all
you cant catch values of a select menu in a modal as of now 
well them maybe use some common sense cause i don;t think Modal.add_item(<an item>) can be futhermore simplified
From what I know modals only support text inputs
it supports SelectMenus too
Interesting I didn't know
doesnt show up on mobile phones tho
when did they update it? 
its been more than a month ig
ic
There is a way to add menu to modal but idk how
I used code to do so.
Wow real interesting
I can't find any mentions about modals in discord api docs actually lmao
They only mention modals together with text inputs
how can i make it that some people with the right roles use certain commands
like i have a reset command i only want server managers using it
Is it a single guild bot
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/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/latest/api.html#discord.Permissions "discord.Permissions").
This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
!d discord.ext.commands.has_any_role "right roles"
@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.
Similar to [`has_role()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.
This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
when i change the manage_messages to mod it gives me a error
oh yeah that is also a thing
@golden tapir
@golden tapir
what
click the reply
i did i am on it
@golden tapir
you use has_permissions
do u want to sere the error
ok how fix then
oh
why'd you ping me 😭
oh sorry forgot do disable it(

@nextcord.slash_command(name='vemojiinfo', description='Shows info about an emoji')
async def infofemoji(self, interaction: nextcord.Interaction, emoji: str=SlashOption(description='Valid emoji in the server')):
try:
emoji = await emoji.guild.fetch_emoji(emoji.id)
except:
return await interaction.response.send_message('Couldnt find the emoji', ephemeral=True)
name = emoji.name
id = emoji.id
anime = emoji.animated
by = emoji.user
creation = emoji.created_at
link = emoji.url
embed = nextcord.Embed()
embed.title = ("Emoji Info")
embed.description = (f"Showing info of `{name}` emoji")
embed.add_field(name="__Emoji Name__", value=name)
embed.add_field(name="__Emoji ID__", value=id)
embed.add_field(name="__Animated?__", value=anime, inline=False)
embed.add_field(name="__Created By__", value=by, inline=False)
embed.add_field(name="__Created At__", value=creation, inline=True)
embed.set_thumbnail(url=link)
embed.timestamp = dt.datetime.utcnow()
embed.color = (3066993)
await interaction.response.send_message(embed=embed)
I'm trying to make an emoji info command...
But problem is whenever i give any emoji it shows could not find emoji [ as given in exception ]
Is there a way to solve this ?
Typehint emoji with nextcord.Emoji
not with str
You will automatically get emoji object
class discord.ext.commands.EmojiConverter(*args, **kwargs)```
Converts to a [`Emoji`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Emoji "discord.Emoji").
All lookups are done for the local guild first, if available. If that lookup fails, then it checks the client’s global cache.
The lookup strategy is as follows (in order)...
Then use this
Converters require a Context object, I don't remember if an Interaction works too
how can you make slash command with discord py 2.0 ver with cogs
that's much helpful thx
is there something like on_mention???
A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.
Warning
The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.
how would I get discord.py to use asqlite's async loop with setup_hook?
i created something like that on the cog file but i get err
import asyncio
import discord
from discord.ext import commands
from discord import app_commands
class MySlashCog(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@app_commands.command(name="ping", description="...")
async def _ping(self, interaction: discord.Interaction):
await interaction.response.send_message("pong!")
class MySlashBot(commands.Bot):
def __init__(self) -> None:
super().__init__(command_prefix="!", intents=discord.Intents.default())
async def setup_hook(self) -> None:
await self.add_cog(MySlashCog(self))
self.tree.copy_global_to(discord.Object(id=serveridlolwhatdoyouwantuhhhh))
await self.tree.sync()
bot = MySlashBot()
async def main():
await bot.start("mytokenjusthidedlol")
asyncio.run(main())
still one err remains
also why don't u just do bot.run('token') at the end of file without all that awaiting stuff
uh that was giving me err like didnt await it
ye that only
let me try again
there
full traceback?
is there someting like on_join??
!d discord.on_member_join
discord.on_member_join(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") joins a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
!d discord.on_guild_join
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
you still use asyncio.run somewhere
Can you send your full code right now?
i meant when a bot joins new server
thats in main
that is absolutely what I sent
import discord
from discord.ext import commands
from discord import app_commands
class MySlashCog(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@app_commands.command(name="ping", description="...")
async def _ping(self, interaction: discord.Interaction):
await interaction.response.send_message("pong!")
class MySlashBot(commands.Bot):
def __init__(self) -> None:
super().__init__(command_prefix="!", intents=discord.Intents.default())
async def setup_hook(self) -> None:
await self.add_cog(MySlashCog(self))
self.tree.copy_global_to(discord.Object(id='id'))
await self.tree.sync()
bot = MySlashBot()
bot.run("token")
can u show full traceback please?
but what do i put in () and where do i use that discord.on_join ,like this?
didnt i show
You only showed the error, not the traceback where it shows you where the error occurs
@bot.event
discord.on_join
this is what you showed
my main dont have any problem id think
and this is full traceback
ok a sec
use it like any other event handler
@bot.event
async def on_guild_join(guild):
...
wrong reply
ooh
oh woops
do
async with bot:
await bot.start(token)
inside main
remove the asyncio
?
Do you have the full traceback? We should really figure out why the normal method isn't working first before you start to do other methods
no, just replace await bot.start(token) with
async with bot:
await bot.start(token)
ye ok i wil try
oh that seems working without giving an err
but cant see the slash cmds in the server
did you put a tick near application.commands when creating oauth link?
i should've ticked it so you can see, me dumb
ye i did
is there anything I need to enable in the dev portal?
and another problem is my other cog files not working lol
Hey i was wondering if u could use an account token instead of a bot token to manipulate the account
TOS
wdym by not working, please elaborate
@client.command()
@commands.has_permissions(administrator=True)
async def createvoice(ctx, *, channel_name: str, number: int):
for x in range(number):
await ctx.guild.create_voice_channel(f"{channel_name}")
I want to make number of channels with a custom name
example:
?createvoice Ara 10
But it doesn't work...
remove the *
@client.command()
@commands.has_permissions(administrator=True)
async def createvoice(ctx, channel_name: str, number: int):
for x in range(number):
await ctx.guild.create_voice_channel(f"{channel_name}")
Will this work?
for example my ping cmd, when i use the cmd its not sending the msg
try it
try it and see
👍
How do I specify the category (with ID)?
its after i did the
async with bot: await bot.start(token)
change
there is literally an arg category
await create_voice_channel(name, *, reason=None, category=None, position=..., bitrate=..., user_limit=..., rtc_region=..., video_quality_mode=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This is similar to [`create_text_channel()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") except makes a [`VoiceChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel "discord.VoiceChannel") instead.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
Yeah I know, But how do I use it?
create_voice_channel(..., category=ctx.guild.get_channel(category_id))
@client.command()
@commands.has_permissions(administrator=True)
async def createvoice(ctx, channel_name: str, number: int, category_name: str):
for x in range(number):
await ctx.guild.create_voice_channel(f"{channel_name}", category=category_name)
does the ping slash command show up in the server?
nop
rather than the default help cmd nonthing works now
Honestly, the easiest way is if you just provide a snowflake
await ctx.guild.create_voice_channel(f"{channel_name}", category=discord.Object(id=<category-id>)))
@client.command()
@commands.has_permissions(administrator=True)
async def createvoice(ctx, channel_name: str, number: int, category_id: str):
for x in range(number):
await ctx.guild.create_voice_channel(f"{channel_name}", category=ctx.guild.get_channel(category_id))
I did this, Will it work?
or discord.Object(id=category_id) lmao
try it and see
ah yeah that too
yeah it works
!paste can you send your code?
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.
Thanks guys lol ❤️
or maybe it might be that, my code isn't right
anyone know how to use time in a bot status?
this time? <t:102901392121>
current time
discord.utils.utcnow()```
A helper function to return an aware UTC datetime representing the current time.
This should be preferred to [`datetime.datetime.utcnow()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow "(in Python v3.10)") since it is an aware datetime, compared to the naive datetime in the standard library.
New in version 2.0.
await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the client’s presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
``` Changed in version 2.0: Removed the `afk` keyword-only parameter...
@client.command()
@commands.has_permissions(administrator=True)
async def allchannels(ctx, *, new_channel: str, category_id: int):
for channel in ctx.guild.channels:
try:
await channel.edit(name=f"{new_channel}", category=ctx.guild.get_channel(category_id))
except Exception as e:
print(e)
continue
I want to change all channel name is a specified category, But I get an error which is:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: allchannels() missing 1 required keyword-only argument: 'category_id'
Did you pass category id properly?
Well, I don't know
try this
When allchannels() is being called, it's not recieving anything for category_id, you have to specify that
I tried this tho
Hmm that seems like it should be correct
Yes
async def allchannels(ctx, new_channel: str, category_id: int):
i think the * may be the problem
when you call the command but im not sure
My thought as well, but discord.py has been some time for me
okay so it kinda worked
Well it worked
at least you can pass the id now
Not kinda, the bot did what it should have 
It's trying to make new channels?
It tried to make a channel however the category it's trying to place it in is full with too many channels
O wait i misread the code mb
it's ok
Oh i see the problem
That's why I'm giving a category ID
but you are going trough every channel tho
The loop goes over every channel in your server, and when editing the channel, it places it in the category with category_id, this causes your bot to place all channels in there, filling it up
Is there such thing as channel.category.id?
What i believe you are trying to do is rename all channels in a category you specified right? @crystal glen
Lemme check
@client.command()
@commands.has_permissions(administrator=True)
async def allchannels(ctx, new_channel: str, category_id: int):
for channel in ctx.guild.channels.category.id == category_id:
try:
await channel.edit(name=f"{new_channel}")
except Exception as e:
print(e)
continue
I did this
There is discord.TextChannel.category and discord.TextChannel.category_id
How do I use it?
What exactly are you trying to do?
Rename all the channels that are in a category
its hard to code on cellphone
Alright, that means your loop starts wrong
If you only want to rename channels in a category, you dont need to loop over all the channels in a server, only over the channels in that category
If you get the category object, you can access it's channels and loop over those
what about doing this after the try
if channel.category_id == category_id:
try:
...
@client.command()
@commands.has_permissions(administrator=True)
async def allchannels(ctx, new_channel: str, category_id: int):
for channel in ctx.guild.channels:
if channel.category_id == category_id:
try:
await channel.edit(name=f"{new_channel}")
except Exception as e:
print(e)
continue
try that
It worked 🙂
Yep, this seems good
good
Awesome
Thank you guys
Always
❤️
Yeah thanks again ❤️
Damn it's been a while since i used discord.py, i've been much more about doing the api calls and the gateway communications myself
Much more fun imo, really digging through the docs
discord.py's gone worse in that while
?q=Araso+The+Best
The let me google that for you is bouncing
We have it blacklisted because so many people used it to be a dick
So if you repaste your code with that URL replaced, it'll go through just fine
bRUH
!e py query = "Araso The Best" print(query.replace(' ', '+'))
@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.
Araso+The+Best
no as str.replace isnt inplace
search_term = search_term.replace(...) will work
Yeah I did that 🙂
Thanks guys ❤️
how would I get setup_hook to use the asqlite async loop?
I haven't really looked at dpy 2.0, but there should be a loop kwarg in the commands.Bot class
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
async with x Asynchronously initialises the bot and automatically cleans up.
New in version 2.0.
Nvm I'm wrong
wdym "use the asqlite async loop"?
I'm not sure, to be honest? I don't understand async too much.
I got this answer to a problem I had, though, and I'm not sure how to implement it.
You should create the connection in dpy's async context. Try subclassing
commands.Botand overridesetup_hookmethod to make your connection and set it as a class attribute.
well, I guess connection means database connection, so about subclassing commands.Bot and overriding that method, for example RoboDanny uses it (he uses AutoShardedBot). https://github.com/Rapptz/RoboDanny/blob/rewrite/bot.py
Also you could subclass commands.Bot and put db connection in __init__, it doesn't really matter in setup_hook or in init (i guess)
for my bot, how can I send to a specific channel when I dont have self.bot in the class that Im using, ive been using interaction.followup but I want to now change to send to a specific channel
await i.followup.send(embed=embed)
I have this currently but how can I change it so I can send to a specific channel? Im not good with interactions and such
Thanks
Is the channel in the same guild as the interaction?
Yep
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
Changed in version 2.0: `channel_id` parameter is now positional-only.
ooo thats exactly what I was looking for thank you
didnt know interaction had that
thanks homie
@client.event()
async def on_member_join(member : discord.Member):
is_verified_bot = member.public_flags.verified_bot
if member.bot:
if is_verified_bot:
print(member, "is verified!")
else:
print("You are a bot, but you are not verified!")
Why this isn't working?
error?
wdym
you do @client.event()
should be @client.event
bruh
class bot(commands.Bot):
async def __init__(self):
super().__init__(command_prefix=".", intents=intents)
async def setup_hook(self):
conn = await asqlite.connect("uc_transactions.db")
cursor = await conn.cursor()
later:
@bot.command(name="buyoffer", help="Adds a buy offer to the channel and spreadsheet.")
and I get this:
command() missing 1 required positional argument: 'self'
I hope you didnt't do @bot.command in class
That decorator is not a staticmethod and please name classes in UpperCamelCase
no
Running it inside one of discord.py's methods will do, since it can automatically get the async event loop that way, you shouldn't have to do anything special. Initializing your database inside of setup_hook will allow it to access the event loop
Cause you confused the instance and the class it seems
@client.event
async def on_member_join(member : discord.Member):
is_verified_bot = member.public_flags.verified_bot
if member.bot:
if is_verified_bot:
print(member, "is verified!")
else:
await member.kick()
print(member, "is kicked")
Muhahahaha
I probably sound a bit stupid, but running what inside which method?
Unverified bots kicker
Any asynchronous method, really
Since you can only have one event loop at a time (correct me if i'm wrong)
@Robin J#2415 hi there, could you tell me about this
Discord mentions smoking smth again
I can't ping you at all lol
Once the necessary people have approved your PR, then it's just a matter of time until the right person comes along and merges them
Ok thanks
I'm sorry; I still don't understand. Could you explain again? I've been confused on this for a few days now.
There must be no space between argument name and the colon btw
But it still works 🙂
I mean code style
PEP
Yup. let me try to explain using another example, aiohttp, which is a common usecase in discord bots:
class MyBot(commands.Bot):
def __init__(self, ...) -> None:
""" Regular bot initialization """
super().__init__(...)
...
async def setup_hook(self) -> None:
self.session = aiohttp.ClientSession()
In this example, aiohttp.ClientSession() is created with the discord.py asynchronous event loop as a context. This is because it's inside of an asynchronous function, which can only have one event loop. Same deal for your asqlite or any other asynchronous database connection, if you do it inside of setup_hook, it'll automatically get the asynchronous context
I think what you think is that different modules (e.g discord.py, asqlite, etc) have their own event loops that they work on, which is not necessarily true. Your program as a whole as one big event loop, which would be the "context"
Thank you. This cleared things up immensely.
Feel free to ask any follow up questions you may have, I know the whole asynchronous programming thing can be quite complex and hard to understand, we've all been there! The most important thing is to ask 😄
So.. if I want to get the reason I need to fetch the audit logs?
Unfortunately, yes
Luckily it should be the very first audit log
well the bot already works like that but I was trying to optimize it for the 2.0 version haha
Honestly I still don't completely get it, but I think I understand how it's supposed to work now.
What syntax would make it do that?
If I just connect to my database in setup_hook and try to do the Bot.command decorator, it says this:
command() missing 1 required positional argument: 'self'
show code
you need to use instance of your Bot class, not class it self. so you define class Bot and do command decorator with it, however you should define a variable bot = Bot(command_prefix="prefix") for example and do @bot.command()
Thanks. I make that mistake a lot, honestly
everyone makes mistakes and thats fine, actually a good thing if you keep learning from them
it worked.. I'm ecstatic
or rather
it got a different error
but that is one I can deal with
see and there you went a step further
i get errors that i need help with so rare that i already want to make a fake error so someone here will help me lol
hahaha i know exactly what you mean lmao
async def on_message_delete(self, message):
embed=nextcord.Embed(title="Message delete", description= f"Deleted by {message.author.mention} in {message.channel.mention}\nMessage:{message.content}",color=0xfd9fa1, timestamp=datetime.datetime.utcnow())
instead of message.author.mention, what can i put so that it grabs the person who deleted the message, not the person who wrote the message?
i guess you have to use audit logs for that
wont that just grab the person who wrote the message?
async for ... in audit_logs(*, limit=100, before=..., after=..., oldest_first=..., user=..., action=...)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the guild’s audit logs.
You must have the [`view_audit_log`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.view_audit_log "discord.Permissions.view_audit_log") permission to use this.
Examples
Getting the first 100 entries:
```py
async for entry in guild.audit_logs(limit=100):
print(f'{entry.user} did {entry.action} to {entry.target}')
```...
excatly but without the mention and so you get the name of the person who deleted the message/s
i ment who ran the delte_message command
wait wha
oh i got i wrong sorry my bad
Using python async def on_message(message):
How does one get the message.author's icon url?
!d discord.Member.avatar.url
!d discord.Asset.url
property url```
Returns the underlying URL of the asset.
ehh
Member.avatar returns an Asset object lol
oh wait, okimii, hi there!
message.author.avatar_url?
hello my good sir
depends on your dpy version
.replace('_', '.') if 2.0
1.7.3

Is there a limit for fetching the audit log for bans? Or should I use guild.bans() instead?
Because fetching the audit log also gives me the user who banned the target
And I would prefer to do that
there is no limit
so i have this code
but how do i get the channel from interaction
im used to do ctx.channel
but how would i do it for interaction
The channel the interaction was sent from.
Note that due to a Discord limitation, DM channels are not resolved since there is no data to complete them. These are PartialMessageable instead.
oh ok ty
ig when you load cogs in your main file with .load_extension() it searches for setup() function inside each cog
which then adds the cog
is there a method that can be used to cleanly stop the bot with a slash command?
thank you
@sick birch could u check #help-broccoli ?
how come "level" is not defined (line 21)? I already declared it on line 16
Because it's inside a class, defined as a class variable
how can i fix it?
self.level
ohh i get it now
When using app_commands.check should I use it as a common check oruse the deco implementation? Is there any benefit to doing it either way? https://discordpy.readthedocs.io/en/latest/interactions/api.html?highlight=check#discord.app_commands.check
https://hastebin.com/yerafaciri.rust - error
whitelisted = fields.ManyToManyField("Bot.UserModel", on_delete=fields.SET_NULL, null=True, related_name="whitelisted")
vanity_whitelisted = fields.ManyToManyField("Bot.UserModel", on_delete=fields.SET_NULL, null=True, related_name="vanity_whitelisted")
That error is coming from those 2 lines...
@sick birch do u mind checking this out?
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I think this is more suited in #databases, and is also out of my expertise
its not really about database
idk if u remember me long time ago.. u told me to change from json to SQL
and i can tell is a lot better.. a lot of work but my last 2 modules are being a pain in the ass lol
It's directly related to Postgres/TortioseORM, so yes, it is
https://hastebin.com/rasewimoho.sql
I've gotten a similar error before but I have no idea why it's going wrong
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
How are you defining member?
Great, but I'd prefer we avoid crossposting in the future
here's the function that has the error
Looks like member is None for some reason
hmm
How can I create vc vai bot in a fixed catagory ?
!d discord.CategoryChannel.create_voice_channel
await create_voice_channel(name, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`Guild.create_voice_channel()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_voice_channel "discord.Guild.create_voice_channel") to create a [`VoiceChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel "discord.VoiceChannel") in the category.
What library is this?
pycord ofc
Hi can someone help me with this bot not working?
I got it from github
https://github.com/jamal0025/Discord-Success-Bot
i keep getting an error when i paste the image
Image
Here is the code
https://hastebin.com/fagexivuva.py
Your average discord success reposter that includes a delete function. - GitHub - jamal0025/Discord-Success-Bot: Your average discord success reposter that includes a delete function.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
what's the error
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\16479\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\16479\Downloads\Discord-Success-Bot-master\Discord-Success-Bot-master\main.py", line 37, in on_message
image_url = message.attachments[0]['url']
TypeError: 'Attachment' object is not subscriptable
[0].url
it runs but on the image send it bugs out
and there's so much wrong with the code, consider rewriting it urself
what is the issue with this?
you should be using .url property of attachment object, but the code is indexing it using ["url"]
the problem would be considering that the bot is created in late 2019
does anyone can help me on #help-pretzel im so confused about the new error
hi guys, im making a discord bot and am trying to host my bot using heroku. everything is working except for when I try to run my bot token, i get
2022-08-04T02:28:36.236205+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/boto/s3/connection.py", line 188, in __init__
2022-08-04T02:28:36.236309+00:00 app[worker.1]: super(S3Connection, self).__init__(host,
2022-08-04T02:28:36.236311+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/boto/connection.py", line 568, in __init__
2022-08-04T02:28:36.236464+00:00 app[worker.1]: self._auth_handler = auth.get_auth_handler(
2022-08-04T02:28:36.236466+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/boto/auth.py", line 1018, in get_auth_handler
2022-08-04T02:28:36.236754+00:00 app[worker.1]: raise boto.exception.NoAuthHandlerFound(
2022-08-04T02:28:36.236800+00:00 app[worker.1]: boto.exception.NoAuthHandlerFound: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials```
im using configure vars in heroku
here is the line ``aclient.run(S3Connection(os.environ['TOKEN']))``
i am using boto ``from boto.s3.connection import S3Connection``
any ideas why im getting this and how to fix it?
i have boto installed using pip install boto as well
This would be more suited for #tools-and-devops
i want a bot that can check if someone is online on roblox and it sends a msg in a channel ive got the api and the channel stuff done idk how to make it so when someone gets online it says
Guys.
I have an error.
File "main.py", line 2
from discord
^
SyntaxError: invalid syntax
How do I fix it?
Can anyone tell me why my bot isnt responding to my commands
Only one function is working
- You have an on_message event that doesn't call bot.process_commands. Consider using a listener instead. https://discordpy.readthedocs.io/en/stable/faq.html#why-does-on-message-make-my-commands-stop-working
- You are ignoring errors in your on_command_error. https://gist.github.com/EvieePy/7822af90858ef65012ea500bcecf1612#file-error_handler-py-L69-L72
- You have more than one bot/client and are running the wrong one. commands.Bot is discord.Client with extra features, you should not use both or more than one.
- You are using 2.0 and have not enabled the privileged message_content intent. https://discordpy.readthedocs.io/en/latest/intents.html#message-content
- You are using client.start in 2.0 and have not enabled logging. https://discordpy.readthedocs.io/en/latest/migrating.html#logging-changes
you are not importing anything from discord
error_handler.py lines 69 to 72
else:
# All other Errors not returned come here. And we can just print the default TraceBack.
print('Ignoring exception in command {}:'.format(ctx.command), file=sys.stderr)
traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr)```
you either do from discord import something or import discord
I did write import discord before that
and what happened?
it cannot just be from discord, you should consider importing something from it
like from discord import Embed
or from discord.ext import commands
what error?
Import discord
show the error..
Traceback (most recent call last):
File "main.py", line 1, in <module>
import discord
File "/home/runner/SwiftIrresponsibleCarat/venv/lib/python3.8/site-packages/discord/init.py", line 69, in <module>
clientrun(the token)
NameError: name 'clientrun' is not defined
KeyboardInterrupt
client**.**run
Oh.
there is a dot
it said client.run (the token)
In line 39 AKA last line, it says client.run
huh wait this error is something weird
That's what I'm saying.
it says about discord package's line 69
Well, how will the bot turn on?
did you probably accidentaly go into that file /home/runner/SwiftIrresponsibleCarat/venv/lib/python3.8/site-packages/discord/init.py and write that line?
I don't know.
There isn't.
i wanna see what needs that
It's 39 as last line
open not your file
but this one /home/runner/SwiftIrresponsibleCarat/venv/lib/python3.8/site-packages/discord/__init__.py
Oh, yeah, I clicked it.
it is the file which raises an error
How do I fix it?
show me the code like from 65'th to 75'th line
I'm using replit.
huh?
I don't know if I saved.
well, you somehow installed it, right?
so there should be the way to uninstall it
I'm not sure.
and install again
well, I don't use repl.it and Idk how to use, so my help is: reinstall discord.py package. Idk how, also, dont use repl.it
Oh.
idk
is it possible for me to get reasons of ban/unban from the audit logs?
!d discord.AuditLogEntry.reason
The reason this action was done.
Hey guys im getting the "too many values to unpack" error on a dict object. How do i fix this?
This is the said dictionarypy { "teamid": "emojiid", "teamid2": "emojiid2", "852995791996190751": ":D1:" }
and the command i used: for k,v in teamsdb: which triggered this error
for k,v in teamsdb.items():
np
hey guys, just getting into bot creation and would simply like to change the text color, ive not used css before so just wondering how i go about doing that inline?
"""This is some colored Text"""
using that text box
or you can use ANSI codeblocks, that's limited to desktop client only though
thats very helpfull thank you
😄 np
what are the tips for submitting discord bot for verification ?
Guys am i using the or statements properly? because somethings not right i dont know what it is though.
if foRole not in message.author.roles or gmRole not in message.author.roles or hcRole not in message.author.roles:```
your editing it to be the embed that you used prior await message.edit(embed=embed) therefor it doesnt change
embed4 not embed, if u were trying to use the embed4 variable u just made
Ok
do you have any experiance with this? i can get colors to change however the bold/underlining doesnt seem to work.
some of the markdowns u can only bold/underline before putting the markdown
__You cant do this__
But you can do this
why not use any()?
oh i've never used that one before
ill go check the py docs on that ty
using this since I didn't do anything in discord.py in months, and I've read somewhere that discord.py does not support slash commands...
https://discord-py-slash-command.readthedocs.io/en/latest/quickstart.html
right, discord.py is discountinued
it did not, but now it supports, after a huge comeback
wait its been recontinued?
yes
Lol rlly?
i've been using nextcord when it got discontinued
Ok I am really outdated...
You guys think the problem is coming from that "discord-py-interactions" I am using?
Should I just switch back to discord.py?
probably
if you haven't done a lot of work
lmao I just sent slash commands in dpy
oh wait nvm
also you can join dpy server
i found it mb 😂
Danny keeps updating
damn now i gotta switch back all my bots again
I think it is cause that ctx you are using is not same as usual dpy commands.Context and so it's harder to use it, not just ctx.send
I need help by using replit python.
lmao
@silk fulcrum Nothing is working, I still need help.
I can't help you
np
Oh.
He already came here with his problem, and I said him to reinstall discord package, he doesn't know how to do it, but i do not neither, since I don't use repl.it, that's it
oh ive used repl.it before its pretty easy
but it's pretty bad host
ik
i only use it for fast prototyping
everything ends up on main IDE which is pycharm once i've got something working
I don't even use those big hosts like digital ocean, I use one very cheap server and even not only for bot and it's pretty enough. I think still way better than repl.it
‘a code block'
a code block

