#discord-bots
1 messages · Page 711 of 1
Cuz someone on the same IP as you abused the API
dang
would change the command names to the language that the user set by the command command description etc to change the language from Polish to another language that the user set by the command
prob someone running an ssh server or alucard lmao
why doesnt this work?
Yeah maybe
Why is it not working? Show the error
out of all the flagship selfbots alucard is the most resource heavy
show your command
I don't think but ok
there is so much trashed code that it looks worse than react lmao\
Ok, so basically everything works except when you send the command, it returns every single role, including the ones that users have
@slate swan gn & thank you for your help so far, im going to bed so ill respond in the morning
"is" not "in", show traceback exception
do u uderstand what i am thinking
@slate swan
its
if isinstance
Alucard dumb fr
how do i make the client wait untill its ready to recive messages?
kinda confused tbh
yes
you mean on ready or wait until ready?
repl will rate limit you from time to time cus all the bots share the same IP. Only permanent solution is paying for a host
or self-hosting
wait untill the "on_ready" funtion has been run so it can recive messages seamlessly
function*
dont understand what you want tbh
i want the client to wait for onready then display messages
on ready is an event when your bot connects to the gateway
!d discord.Client.wait_until_ready
await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits until the client’s internal cache is all ready.
thank you
Np
literally said it right here
🤷🏼♂️
smh
i didnt know what you meant
Alright , you can just dm me the further problem you face :)
async def on_message(ctx):
async user.wait_until_ready()
import os
os.system("clear")
global currentchannel
global currentguild
if currentguild != "DM":
currentguild = int(currentguild)
try:
ctx.channel.id
ctx.guild.id
except:
return
if ctx.channel.id == currentchannel:
# await ctx.delete()
msg = ctx.content
msghistory.append(ctx.guild.name + " | channel :: " + ctx.channel.name + " | " +fore_fromhex(ctx.author.display_name, getcolor(ctx.author)) +colorama.Back.RESET + colorama.Fore.RESET + " :: " + msg)
for mssg in msghistory:
print(mssg,colorama.Back.RESET, colorama.Fore.RESET)
yes this is "selfbot" code yes this is. custom client but its just a cli port just pls help me debug
It’ s await
Not async
thanks im dumb
async keyword is for making asynchronous functions await is to use one as a coro
yep got it
Oh wait, It’ s a self-bot?
Oh ok
"yes this is "selfbot" code yes this is. custom client but its just a cli port just pls help me debug"
What am amazing declaration👏
Cus It’ s user client
^
lol
You just said yes this is "selfbot" code yes this is
its selfbot wording but its client code
yw
Cmon do you think I am so dumb?
Well anyways let's leave it
It’ s kinda weird how they expose their api and only limits u to using it with bots
is that like "i know thats a selfbot" or "i get it im not that dumb"
oh i was just meaning by no working as why removeRole is underlined
Sorry I should be more specific
genuenly confused
Yes it is.......
only legally
genuinely
Yea
its not a selfbot
i mess up my codes from spelling for as in fro
Is it illegal to make a self-bot?
took me 10 min to figure out
I thought it was.....
it breaks. a legally binding contract so yes
But if it isn't very cooll
then nobody cares!
I am gonna use selfbotsss
So like u can go to jail if u make one?
(If they are legal)
you can get sued
Nah
anyone know fix?
tf? I dont think so lol
At max your ID banned
Cus custom clients are basically same shit
nope just sued
are you high
uhhh
30 min sober
why would u get sued for making a selfbot on discord
lollllll
THEY'VE DONE IT BEFORE
um ok bro
the original java discord.cli devs got threatend with a suit
Even got banned thrice
They probably cant do that if you dont use it for phishing
i got banned bc i said "nazi"
Whhhhaaattttttttttt really???????
ok
yes
granted it was an actual malicous program
it had selfbot shit in it and a token stealer
Hmmmmmmm
I got banned for this once but I didnt know it was against tos at the time, I thought it was allowed
So they were sued for token stealer not for selfbot
lollll
the main charge was breach of TOS on the grounds of selfbotting
Just a shit excuse theyy were afraid of token stealers instead
selfbotting is not something major
So those self bots that attack random servers and spam members in dms could be sued?
Yessssss
tbh i dont think they knew abt the token stealers
no
Yes, I just wanted to make every message I send embed
Could they get sued
Yeah i just use selfbot for fetching lyrics
who?
Those self bots
i just use powecord
Ohh yes
Why are we even discussing about selfbots
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Suggest more topics here!
even BetterDiscord and Bluecord are against Tos
IKR
It’ s basically same as self botting except It’ s not automated
Mhm it just edits your discord client
I saw one of the plugins which is like hella cool it allows spotify listen along without premium
I wonder how that is possible??
U can just make a gui that makes request to discord api with ur user token as Authorization header and u have a custom client
anyone?????
And is that possible with bots??
Does it directly stream audio to ur machine?
It opens spotify and just works as if I got premium
pause music together, play the same song etc.
Mby it uses a token from the other person
It can't
How can it get other person's token
I tried to know bout it but I was too dumb to understand JS
Well if user gives this plugin perms via oauth, client will get access token
From spotify
But I’ m not sure if that is how they did it
But that doesn't relate to how it gives premium benefits
Does it open spotify directly?
Yeah......
If spotify not installed it opens on web browser
Hm
Imma try something out later
Looks like spotify has a fat client which is hard to believe
hmm
they are just client side though
discord is just jealous
That's not the main reason
malicious stuff? i know that
Client modifications are dangerous because you're risking to install a malicious plugin
Not really but ok......
Many plugins abuse API
¯\_(ツ)_/¯
but the plugins aren't malicious
ive never seen a malicious bd plugin before
const plugin = (Plugin, Library) => {
const { DiscordModules, Patcher, WebpackModules } = Library;
return class SpotifyListenAlong extends Plugin {
constructor() {
super();
}
start() {
const { ActionTypes: { SPOTIFY_PROFILE_UPDATE: type } } = DiscordModules.DiscordConstants
Patcher.instead(DiscordModules.DeviceStore, 'getProfile', ( _, [id, t] ) =>
DiscordModules.Dispatcher.dispatch({
type,
accountId: id,
isPremium: true
})
)
Patcher.instead(WebpackModules.getByProps("isSpotifyPremium"), 'isSpotifyPremium', () => true)```
Things like these prolly break TOS
See the last line
Yeah if discord didn't make proper tos for that, all issues with plugins would've been their fault
Formally
I can prolly see Spotify withdrawing their partnership with discord due to these kind of plugins
is it possible to get the messages a user sent in dms with the bot
plugins dont hurt anyone 🙏
Except discord
Instead of the company
how
It's like hosting on your PC doesn't hurt anyone instead of your PC
async for msg in channel.history(limit=None):
Where channel is the DM channel
hmm
the on_message event
thanks
How do I send an animated emoji with my bot?
I tried putting it as <a:name:id>, but it doesn't work.
what doesnt work, show output?
it doesnt work in some fields of the embed
discord limitation
ye
How to give animated emoji in bot messages
<a:emojiname:emoji_id>
How can I make anyone who invites the bot to their server will automatically join my server
no
I prefer sending a message as "thanks for adding me to the server" with related links in it
¯\_(ツ)_/¯
Inside the server itself
That sounds like a very annoying feature
If u have a dashboard u can make a button that adds u to the server and invites the bot
i wonder how i would setup a mongodb database for discord.py on a digitalocean vps...
does anyone have an idea on how to do that?
With mongo atlas
yea you can add a redirect to the invite link
well i need it to be on a VPS. which is, terminal only.
I dont think u can run mongo on vps
hm.
You can create a mongodb server....
yea
Or , if you want to save stuff locally use sqlite3 or something
idk how to do that on a vps and connect it to my discord bot.
Bro…
Look
You dont run mongo atlas on vps
Ur code for discord bot runs on ur vps
then stop saying about mongo atlas, holy shit.
Can't it be done using the bot only?
It has a python example
ah thanks
😭
I don’t think so
Tho ,it's preferred to use motor instead of Pymongo for Discord bots
alr
Or MotorEngine
why not use sqlite
hmmm, maybe.
Yes , with the invite url
ive heard sqlite isn't great if you're bot is in a bit of servers though/
I mean, if you wanna make a public bot u wont want to use sqlite
How? I have used redirect URI but that asks the user if he wants to join
I want to make so that it automatically join
without asking the user
Ah it's not possible
Without the consent of user
not possible and why'd you do that...
Then let me do it as its going on
that sounds annoying
Well, sql has certain limit at which it wont work as fast as it used to, nosql is scalable and it will work as fast with billions of data
IDK just 😄

Cache stuff
instead of always reading it
what im looking for is if it works on a vps.
thats all.
just forget about it.
ill ask in another server
You can have db somewhere else and access it from vps
💀
I’ m talking bout big companies that have billions of users and lot of data
Not discord bots
Yea ofcourse for them
Istg that guy will go on another server and ask how he can run mongo on vps and they will tell him to use mongo atlas
I actually did that but, it doesn't work for me.
Is the bot in the server with that emoji?
nvm
lol
idt the bot has access to the emoji
Hm
try doing ctx.message.add_reaction(emoji) and see if any error returns
What should I add in the parameter for emoji?
!d discord.Client.get_emoji
get_emoji(id, /)```
Returns an emoji with the given ID.
Mkay
or "<:name:id>"
Try getting emoji with this
oh yeah
And send it
Is :aclock: emoji in your guild?
k
Bots have free partial nitro ig
Makes no sense ig
They can send emojis across guilds
And they can send animated emojis
Never work too much with emoji's so i dunno
ye
That doesn't work
any errors?
do you have an error handler
What's that?
have you tried this?
show code
ye one sec
nvm
@bot.command()
async def timer(ctx):
timer = discord.Client.get_emoji(924959483589971978)
await ctx.send(timer)

yes
nono
O_o
bot.get_emoji()
oh
you have to use an instance of it, not a class object
oh
anyone know why its underlined
There's a difference between a class and an instance. Think of it like this:
- A class is like a blueprint, or a concept. It defines what something should have, but it's not the same as actually having it.
- An instance is the 'realized' version of the class, it contains everything that the class defines should be on it, but you can actually access and interact with these features.
Let's consider the Cat. We know a Cat has a name and an age, but Cat.age won't work, because Cat isn't an actual cat, it just represents the concept of a cat. It's like asking "What is the age of a cat?" - it doesn't make sense, because we need to have an actual cat.
mimi on the other hand is an instance of a Cat - it has everything a Cat should have. Maybe mimi was constructed, like mimi = Cat("Mimi", age=4), or maybe mimi was retrieved from somewhere else, like house.cats[0], but in any case, it has everything we need, and mimi.age will rightfully give us 4.
There are many situations in Object Oriented Programming where you will need an instance instead of a class to perform an operation properly (in fact, you almost always need an instance instead of a class), and these cases will usually be documented.
You should learn a good amount about Object Oriented Programming before working extensively with discord.py.
https://i.imgur.com/dHYdejb.png
Read more about classes and instances here:
- <https://www.digitalocean.com/community/tutorials/understanding-class-and-instance-variables-in-python-3>
- <https://docs.python.org/3/tutorial/classes.html>
Credit: devon
ive tried import random.choice and import choice
because you didnt import
which
That did nothing rip
@bot.command()
async def timer(ctx):
print("sending emoji")
timer = bot.get_emoji(924959483589971978)
await ctx.send(timer)
it's just import random then random.choice()
hmm sec
!d discord.Emoji
class discord.Emoji```
Represents a custom emoji.
Depending on the way this object was created, some of the attributes can have a value of `None`...
O-o
docs not loading for me hang on
Hello, I am trying to make broadcast command by my way, and I have code in this form: ```@bot.command()
@commands.has_permissions(administrator=True)
async def bc(ctx):
await ctx.send('Type header text: ')
header = await bot.wait_for('message')
await ctx.send('Type footer text: ')
footer = await bot.wait_for('message')
embed = discord.Embed(title=header, description=footer, color=0x66d9ff)
await ctx.send(embed=embed)``` Header text type working, footer too, but It will not send embed into text channel. Can anybody help me?
how do i send that message where only the command author can see it
Are you using slash commands?
yes
What lib?
discord-interactions
try ```py
await ctx.message.add_reaction("<:name:id>")
Um, did I get ghost pinged?
sorry i keep asking do yk why this doesnt work. why loop is underlined
i used a youtube tutorial for looping. I was curious what global loop was too
await ctx.send("message", ephemeral=True)
and define it at the start of your code
tank
!global
When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.
Instead of writing
def update_score():
global score, roll
score = score + roll
update_score()
do this instead
def update_score(score, roll):
return score + roll
score = update_score(score, roll)
For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.
my bot send to message per command and the code has only one sent function. how to fix?
What do you mean?
i have this code
if mem == None :
mem = ctx.author.id
fin = {
f"{mem}" : { "$gt": "1"}
}
for i in mycol.find(fin):
k = i[f"{mem}"]
await ctx.send(f"""
your id is :
{k}
""")
when i use the command the bot response twice
are there two instances of the bot?
yes but it has another response
else :
fin = {
f"{mem.id}" : { "$gt": "1"}
}
mycol.find(fin)
k = i[f"{mem.id}"]
await ctx.reply(f"""
id <@{mem.id}>'s
{k}
""")
so 2 instances mean bot responds two times
yeah, i mean this
i am having difficulty in what u wanna do
give me reference of the command
and ur combined code in codeblocks
then i maybe able to help u better
@cloud bison
did you mean the full code?
no the part where ur getting error
running twice etc
my problem is when i use the command the bot respond two times theres no error in the code
So you are trying to send the members member id?
yeah
k
nope, its UID game system
member id
give me ur full command with the decorator
@commands.command()
async def id(self, ctx, mem : discord.Member = None ):
myclient = pymongo.MongoClient(os.environ['URLM'])
mydb = myclient["players"]
mycol = mydb["id"]
try :
if mem == None :
mem = ctx.author.id
fin = {
f"{mem}" : { "$gt": "1"}
}
for i in mycol.find(fin):
k = i[f"{mem}"]
await ctx.send(f"""
your id is
{k}
""")
else :
fin = {
f"{mem.id}" : { "$gt": "1"}
}
mycol.find(fin)
k = i[f"{mem.id}"]
await ctx.reply(f"""
<@{mem.id}>'s id
{k}
""")
except Exception:
await ctx.send("""
use
"setid
""")
@commands.command()
async def id(self, ctx, mem: discord.Member = None ):
myclient = pymongo.MongoClient(os.environ['URLM'])
mydb = myclient["players"]
mycol = mydb["id"]
mem = mem or ctx.author
try:
fin = {
f"{mem.id}" : { "$gt": "1"}
}
for i in mycol.find(fin):
k = i[f"{mem.id}"]
await ctx.send(f"your id is {k}")
except Exception:
await ctx.send("use \"setid")
``` let's shorten it first...
How many different cogs may cause a error
send it outside the loop?
and why are you defining ur mongo client inside ur function
yes i thought that
14 cog only
you can have unlimited cogs
hm
I have 12 cogs. When i unload 1 cog, then it still runs
Never had a issue in past, but now when i created some more, problems started to happen
@commands.command()
async def id(self, ctx, mem : discord.Member = None ):
myclient = pymongo.MongoClient(os.environ['URLM'])
mydb = myclient["players"]
mycol = mydb["id"]
try :
if mem == None :
mem = ctx.author.id
fin = {
f"{mem}" : { "$gt": "1"}
}
for i in mycol.find(fin):
k = i[f"{mem}"]
await ctx.send(f"your id is {k}")
ok i'll try
whats the issue?
Say, I have 1 cog, which has a loop inside. The loop prints something every 10 minutes. NOW when i unload the cog, it still keeps printing like nothing has happened.
Another issue. I have a 3 hour loop which outputs something into chat. Instead of outputing every 3 hours, outputs the results like 25 times within 3 hours
crazy.
Could you show the loop and how you start the loop.
cog_unload()```
A special method that is called when the cog gets removed.
This function **cannot** be a coroutine. It must be a regular function.
Subclasses must replace this if they want special unloading behaviour.
!d discord.ext.tasks.Loop.stop
stop()```
Gracefully stops the task from running.
Unlike [`cancel()`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop.cancel "discord.ext.tasks.Loop.cancel"), this allows the task to finish its current iteration before gracefully exiting.
Note
If the internal function raises an error that can be handled before finishing then it will retry until it succeeds.
If this is undesirable, either remove the error handling before stopping via [`clear_exception_types()`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop.clear_exception_types "discord.ext.tasks.Loop.clear_exception_types") or use [`cancel()`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop.cancel "discord.ext.tasks.Loop.cancel") instead.
New in version 1.2.
But can you explain or guess why the loop runs 25 times within 3 hours?
On reloading you re-executed the init.
Where do you load your cogs?
when i start the bot?
Yeah but where? on_ready?
Hmm do you import the main file somewhere?
nopee
First I tought my raspberry is broken or smth, but the problem keeps happening on my pc aswell
What do you expect is causing this?
I recommend adding the cog unload function though.. But the 25 times in 3 hours is still a mystery since i have thought of most my theories.
Best to add a print in the init to see if it gets re-executed.
Okay, will do
Been programming discord bots for a year and now its first time when such thing is happening to me xd
No i get it it's pretty weird though
Most of these questions you have prob asked yourself aswell.
Mhm
Just ping me if anything pops up.
Pandabweer ♥️
Did anyone know that if you get rate limited on replit
♥️
Yes
you can do kill 1 to change to a different ip and not get rate limited
😳
.bm
wait really?
yeah
oh, time to bm
use it in your on_disconnect event
😭
Facts
.bm
Thanks Sir
😂 imagine using that on your local-host tho
Won't work ngl
it just kills the process with the id 1
😭
anyone have tried?
replit's terminal on phone doesn't work well
yeah, but it probably could solve the issue replit users are experiencing
Replit terrible
With 64 mb ram there is nothing to fix
What is the issue?
I'm getting this output with the bot deploy on Heroku.
This is the code
import discord
from discord.ext import commands, tasks
from discord.commands import slash_command, Option
from pymongo import MongoClient
import os
from dotenv import load_dotenv
load_dotenv()
cluster = MongoClient(os.environ.get('mongodb'))
db = cluster['Data']['logs']
class Logsmesed(commands.Cog):
def __init__(self, bot):
self.bot=bot
@commands.Cog.listener()
async def on_message_edit(self, before, after):
find=db.find_one({'guild':after.guild.id})
if find is None:
return
else:
channelid=find['channel']
channel=self.bot.get_channel(channelid)
if before.content!=after.content:
embed=discord.Embed(
title=f'Message edited!',
description=f'**Author:** {before.author.mention}\n**Channel:** {after.channel.mention}',
colour=discord.Colour.green()
)
embed.add_field(name='Before:', value=f'{before.content}', inline=True)
embed.add_field(name='After:', value=f'{after.content}', inline=True)
embed.set_footer(text=f'{after.author} | Made by Aung.S#8430.')
embed.set_thumbnail(url=after.author.avatar.url)
await channel.send(embed=embed)
else:
return
def setup(bot):
bot.add_cog(Logsmesed(bot))```
Replit doesn't have 64 ram
It gives you 512
I know i was joking about the performance lol
Thats not the entire logs
this is all
I this the entire code?
uhh yeah
Well this will never execute 
when message is edited, it output this
why?
this is in cog
It's just a cog? There is no bot.
kill 1 doesn't change the IP no, process PID 1 is killed which I'd the main repl process and causes the repl to reset and then connect and restart
bot is in main.py
Yeah and it contains this code?
is that necessary?

it work well before this file
from discord.ext import commands, tasks
import os
from discord import Intents, Bot
from keep_alive import keep_alive
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents.all()
intents.members = True
intents.messages = True
bot=discord.Bot(intents=intents)
for ext in ['cogs.event.logs.logssetup', 'cogs.event.logs.memberupdate', 'cogs.event.logs.messagedelete', 'cogs.event.logs.messageedit', 'cogs.event.logs.newmember', 'cogs.event.logs.removemember', 'cogs.event.logs.userupdate', 'cogs.reactionrole.reactionrole', 'cogs.event.welcomeconfig', 'cogs.general.avatar','cogs.general.stats', 'cogs.general.translate','cogs.general.userinfo','cogs.general.serverinfo','cogs.levelling.levelling', 'cogs.moderation.verify', 'cogs.moderation.kick', 'cogs.fun.image', 'cogs.music.music', 'cogs.music.chess', 'cogs.music.betrayal', 'cogs.music.poker', 'cogs.general.dm', 'cogs.fun.pop', 'cogs.moderation.nickname', 'cogs.ticketing.ticketing', 'cogs.fun.fasttype', 'cogs.general.wikipedia', 'cogs.fun.userphone', 'cogs.fun.connect', 'cogs.moderation.mute', 'cogs.general.calc', 'cogs.chatbot.chatbot', 'cogs.globalchat.globalchat']:
bot.load_extension(ext)
keep_alive()
print(str(os.environ.get('TOKEN')))
bot.run(str(os.environ.get('TOKEN')))```
if you want
Lol how to cut yourself in the fingers.
what do you mean?
We're not allowed to help with music bots here 👀
Also you could use a much better way to load cogs
No not the os way, even better
using pkgutil
it isn't music bot
cogs.music.music
but that isn't a problem
they didnt ask help for music/ytdl, so its ok
I ask help with just audit logs command
..? No.. we are in general not allowed to contribute to projects that break ToS regarding the helping matter.
YES ik
how is it breaking tos?
I just told you 
what if it is lavalink?
import pkgutil
for m in pkgutil.iter_modules([exts]):
# a much better way to load cogs
module = f"cogs.{m.name}"
try:
bot.load_extension(module)
print(f"Loaded extension '{m.name}'")
except Exception as e:
traceback.format_exc(e)
which doesnt play from yt link
there is no music feature in this bot
it's watch together
I use pkgutil to load cogs
buy they didnt ask for help concerning music..?
So if i pasted a script here that literally says music cog and imports ytdl and the person ask how to create a for loop you'd still help him?
he is asking for yt watch together
and to ur question i wont help
coz idk myself
from discord.ext import commands
from discord_together import DiscordTogether
from discord.commands import slash_command
import os
class YoutubeTogetherCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
self.togetherControl = await DiscordTogether(os.getenv('TOKEN'))
@slash_command(
name='youtube',
description='Watch youtube together.'
)
async def youtube(self, ctx):
link = await self.togetherControl.create_link(ctx.author.voice.channel.id, 'youtube')
embed=discord.Embed(
description='**A WILD YOUTUBE TOGETHER APPEARS!**',
colour=discord.Colour.green()
)
embed.add_field(name='Click the button below to watch.', value='This is beta feature so it works only on PC.', inline=False)
embed.set_thumbnail(url='https://docs.discord-together.ml/1.2/assets/DT-Logo-New.png')
view = discord.ui.View()
view.add_item(discord.ui.Button(label='Click here to watch!', url=link, style=discord.ButtonStyle.url))
await ctx.respond(embed=embed, view=view)
def setup(bot):
bot.add_cog(YoutubeTogetherCog(bot))```
this is music.py
and like to keep it that way
and problem isn't watch together
this is problem
He breaks ToS anyways since he made an experimental feature publicly accessible.
whats the error?
hm
No? Watch together is usable by bots
There is a literally a verified bot for it
Activities
this
yes it is
yes
my friend has one that uses it
You can use a bot application create a discord Activity and it doesn't break any TOS
and its verified
and yt together doesn't related to my problem..
The SIGKILL signal is sent to a process to cause it to terminate immediately (kill). In contrast to SIGTERM and SIGINT, this signal cannot be caught or ignored, and the receiving process cannot perform any clean-up upon receiving this signal.
so, there is now way to fix it right?
it's a problem with the worker
although there might be a fix, it won't be on your code
Your code is probably ignoring SIGTERM signals
is possible to make a server mute command?
Like.. what kind of?
Why do I receive this error for my verification command?
https://paste.pythondiscord.com/inofibotom.py
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'lower'
i mean its possible in discord.py
Yeah I'm pretty sure it is
!d disnake.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., timeout=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
use the mute
It's don't send a embed:
@bot.command()
async def reactrole(ctx, emoji, role: discord.role,*, message):
emb = discord.Embed(description= message)
msg = await ctx.send(embed= emb)
await msg.add_reaction(emoji)
with open("reactrole.json") as json_file:
data = json.load(json_file)
new_react_role = {
'role_name':role.name,
'role_id':role.id,
'emoji':emoji,
'message_id':msg.id
}
data.append(new_react_role)
with open("reactrole.json", "w") as j:
json.dump(data, j, indent=4)
you never send it?
im making it with tutorial: https://www.youtube.com/watch?v=Qn0yCR7rwPo&t=438s
Hey everyone, welcome to my channel.👋
In this part 4 of my how to make Discord Bot video we will be implementing reaction role for our discord bot
All the links 🌐 mentioned in the video 📺
https://discord.com/developers/applications
https://discordpy.readthedocs.io/en/latest/
🐙 Github
https://github.com/Dhanush-git/Discord.py
👋 Get in touch
...
await member.edit(mute=True)
ty
Any tutorial using json, don't watch.
can you share whole traceback
Sure, one sec
Big error
Traceback (most recent call last):
File "C:\Users\leogr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\leogr\OneDrive\Desktop\SEC Interactive\cogs\verification.py", line 38, in verify
code = await self.bot.wait_for(verification_code, check=check)
File "C:\Users\leogr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 980, in wait_for
ev = event.lower()
AttributeError: 'int' object has no attribute 'lower'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\leogr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\leogr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\leogr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'lower'
you use .lower somewhere?
no, it's from the internals
Nope
oh?
event should be string
What event?
verification_code is the event currently, and is an int
you can wait for specific message to be sent by using that?
you have 2 instances running
no
Cool
only one
Checked task manager?
you made it send 2 messages then?
Hello Pandabweer
knew it
What’s happening
Well, it can happen if you’re running it on another editor
Hi
So you didn't check task manager..
That’s how I close windows running in the background
Like splitgate
Sometimes it runs after I close my PC
I only use pycharm...this was very wierd. Must be pycharm bug...another instance of it was running
No...i was too freaked out😂
Just shutdown the pc
Ok


Any good tutorials to make a music bot?
No
Music bots are kind of against ToS of most of services
Can't you make one for a personal server or something?
no, they break ToS doesn't matter if it's for your personal server
but if you make your own songs/music then...
hi i have this code ```py
@commands.command(pass_context=True)
@commands.has_permissions(ban_members = True)
async def softban(self, ctx, member: discord.Member=None, *, reason=None):
await ctx.guild.ban(member, reason = reason)
await asyncio.sleep(0.1)
await ctx.guild.unban(member)
embed = discord.Embed(title=f"Softban", description=f"Softban will ban but immediately unban the user and send them a new invite link!")
await ctx.reply(embed=embed)
await member.send(f" You have been softbanned from: {guild.name} reason: {reason}")
any ideas?
Well he isn't in the guild anymore when you send the message.
Why not just kick them?
pass_context=True is depricated btw
cause the bot needs to share a guild with the user
Hello, I am trying to make voice channel invite command but It will not work. Can anybody help me?
import os
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_connect():
print("bot is online!")
@bot.command()
async def F(self,ctx,*,text):
if(ctx.author.voice):
channel = ctx.author.voice.channel
Invite = await ctx.channel.create_invite(max_uses=100,unique=True)
name = channel.name
embed = discord.Embed()
link = "["+name+"]("+str(Invite)+")"
embed.description = text+"\n"+link
await ctx.send(embed=embed)
else:
await ctx.send("You are not in the voice")
I made a create channel command and was wondering if it would be possible if it could make it under a certain category and not at the top of the server
Well you need to fill in the text arg in the command.
Ok thk, i go to try
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
this is my code rn
I sended the docs.
@client.command(aliases=['cc'])
@commands.has_permissions(manage_channels=True)
async def createchan(ctx, *, name=None):
guild = ctx.message.guild
if name == None:
await ctx.send('Sorry, but you have to insert a name. Try again, but do it like this: `.cc [channel name]`')
else:
channel = await guild.create_text_channel(name)
await ctx.send(f"Created a channel named {channel.mention}")```
ok
category (Optional[CategoryChannel]):
The category to place the newly created channel under. The permissions will be automatically synced to category if no overwrites are provided.
ctx.guild is enough
but you don't really have to create that guild variable
hi
When I enter the code in the channel nothing happens and there is no error.
https://paste.pythondiscord.com/xipajadifa.py
Where would I put that?
why self?
ok
import discord
from discord.ext import commands, tasks
from discord.ext.commands import MissingPermissions, CheckFailure, MemberNotFound
class kick(commands.Cog, name="kick"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.Cog.listener()
@commands.has_permissions(ban_members = True)
async def on_message(self, ctx, message):
if message.content.startswith("pa andrei"):
george_id = int('916469565024772096')
member = message.guild.get_member(george_id)
await member.kick()
await ctx.send(f'Andrei has been kicked!')
await member.send(f"ESTI VAI SOARTA TA INTRA INAPOI ")
def setup(bot: commands.Bot):
bot.add_cog(kick(bot))```
any ideas why i get this error
on_message doesn't take a ctx arg
so?
remove ctx
but if i remove ctx my bot cant send mesaages back
on_message does not take ctx, it wont work with it
And if you leave it the entire event won't work
you can do await message.channel.send instead
can a select menu option have an emoji
in the selectoption class?
yes
thanks
ew discord together
ok ty
hi sorry, now he dosent now receive the dm message
you wanted to send message to member?
await member.send(f"txt ")
oh wait.. is that a DM listener or smth?
one message in chat one in dm
well I don't really have time to explain it, sorry
Is there a way to trigger a command through the bot code and not just through discord messages with a prefix? Or would I just have to create a standard python def for the function and put it into the certain part of the code when I want it to be triggered?
@wanton veldt remove the server invite from your code
ik i m just dumb
can someone help me i have this code ```py
@commands.Cog.listener()
@commands.has_permissions(ban_members = True)
async def on_message(self, message):
if message.content.startswith("pa andrei"):
george_id = int('916469565024772096') # already casting to an integer
member = message.guild.get_member(george_id)
await member.send(f" txt ")
await member.kick()
await message.channel.send(f'Andrei has been kicked!')
and i get this errorpy
await member.send(f"txt ")
AttributeError: 'NoneType' object has no attribute 'send'```
finally, sorry
i believe get_member returns None if the member is not already in the bot's cache
But then, there's hardly any case when get member returns None. The only possible explanation is wrong ID
the id is fine
Also why not just do |george_id = id` instead of int() and all that?
member = message.guild.get_member(george_id) or await message.guild.fetch_member(george_id)
thats what i found on google bcz i dident know how to do it
ig
so what can i do?
I'm pretty sure u have to create a dm first
im confuzed rn the kick command is working but the dm dosent work
Yeah
Well it works now, I think the issue was that there were too many cogs to handle
I deleted 3 of cog files and now it works
I had 12, heard that it shouldnt be a issue
that's the first time I'm hearing that
wait now i get this error ```py
await member.send(f" txt ")
File "C:\Python310\lib\site-packages\discord\guild.py", line -1, in fetch_member
TypeError: can't send non-None value to a just-started coroutine
But maybe my raspberry wasn't powerful to handle them all
Possible that the cogs u deleted, were the ones causing the error
Wait wtf is that error 😐
Never saw that error before
The cogs I deleted, had like few completely seperated functions
line -1?
It is time to learn about classes though lol
thats what i m trying
do u have a cog for each command 💀
Line -1 
They are laughing at him. As if they knew Python since the first day.
I won't really comment on the msg since I don't wanna start a debate or smth here rn
Good choice 😉
Where’s your on_message code?
no
Anyways... could you show the on_message code.
.
import discord
from discord.ext import commands, tasks
from discord.ext.commands import MissingPermissions, CheckFailure, MemberNotFound
class kick(commands.Cog, name="kick"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.Cog.listener()
@commands.has_permissions(ban_members = True)
async def on_message(self, message):
if message.content.startswith("pa andrei"):
george_id = ('916469565024772096') # already casting to an integer
member = message.guild.fetch_member(george_id)
await member.send(f" txt")
await member.kick()
await message.channel.send(f'Andrei has been kicked!')
def setup(bot: commands.Bot):
bot.add_cog(kick(bot))```
that s andrei.py
Wait stop why is there a has_persmissions on a on_message event?
Are you trying to make commands?
to consider only messages from admins
@wanton veldtDo you have the members intent on?
yes
I wouldn’t use on_message for commands
@jaunty sparrow This is part of his code.
so when i type pa andrei (bye andrei) will appear a text message from bot in chat one in andrei's dm and after he will be kicked
Can you print guild.members?
You can't have this @commands.has_permissions(ban_members = True) here.
ok
You would need to make it a command for that not a listener.
I can't see where u casted the ID to int, i still see a string (I might be missing something)
sorry
We would also need to pass an int as the id not a tuple.
@commands.command()
async def on_message(self, message):
if message.content.startswith("pa andrei"):
george_id = ('916469565024772096') # already casting to an integer
member = message.guild.fetch_member(george_id)
await member.send(f"txt ")
await member.kick()
await message.channel.send(f'Andrei has been kicked!')
Anyone here uses pycord?
No
pycord is part of this channel yes.
Well dpy is dead..
@commands.command()
async def on_message(self, message):
if message.content.startswith("pa andrei"):
# George
member = message.guild.fetch_member(916469565024772096)
await member.send(f"txt ")
await member.kick()
await message.channel.send(f'Andrei has been kicked!')
Just asked, don't need any help rn.
Personally use Disnake but Pycord is almost the same.
Im planning on moving to it, bcz it has the most stars
and it's partnered.. yeah so why not
Disnake and Pycord are the 2 strongest contesters in the race yeah.
Command structured like an on_message event?
can i dm you?
No
how to dm someone using the bot?
!d discord.Member.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
my probleme is right there
everything is fine but line 15 dosent work
Is there an error?
no
What are you typing in to trigger the event?
pa andrei
You need to use your bots prefix since it's a command
can't I avoid using the prefix?
There's an invoke without prefix arg but I got to go
how do I make a certain argument in a command function optional?
Error:
Code:
for item in bag:
amount = item["amount"]
name = item["item"]
emote = item["emote"]
em.add_field(name=f"👜 Items\n {name}", value=amount, inline=False)
em.set_footer(text=f"💸 {ctx.author.name} 💸")
em.timestamp = datetime.now()
await ctx.send(embed=em)
I believe it's telling you that the emote variable isn't being used for anything, but make sure to get a second opinion
Yea that's it says. Not an error tho
You can do arg=None or something like that
I made a dm command and i want to make it so only users that have the Administrator permission can use it in a server
@commands.has_permissions([perm?]=True)
the [perm?] bit isn't the actual code
- A command is a function.
- You can set it to another value to make it optional
!e
def main(n="hi"):
print(n)
main()
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
hi
administrator
i think
!d discord.Permissions.administrator
Returns True if a user is an administrator. This role overrides all other permissions.
This also bypasses all channel-specific overrides.
what is my problem ? :|
its not working
U need to do from discord.ext import commands then use commands.Bot @mental wadi
im biggener
bot = commands.Bot(...)
i do that
bot is not working
Why do u even need to import bot tho
When the bot has sent the dm to a user, i want it to send "I've sent a dm to [member mention]"
Would this line of code work:
await ctx.send("I've sent a dm to" {member})```
!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.
@unkempt yacht
See what I wrote bro
oh ok
^^^
tyy
commands.Bot
how do i import commend
so like this
await ctx.send(f"I've sent a dm to {member}")```
from discord.ext import commands
U need to do {} around member
hunter told u above
Bro u never ran it
what do you mean
!e
def list(n=[1, 2, 3]):
print(n)
list()
@wheat stirrup :white_check_mark: Your eval job has completed with return code 0.
[1, 2, 3]
@wheat stirrup #bot-commands
oh thanks
How to get an Author ID correctly?
At the end of the channel topic there is an author ID and I need to get it, do not know how to do this?
do like inner.channel.topic.split(" Author ID - ")[1]
thanks you so much
I need help guys how do I connect my bot with the roblox group? So when I type /update it gives me the role that I have in the roblox group?
do you have previous experience with coding?
Yep.
Well- Im pretty new, but yeah.
so you know what OOP programming is as well as async code?
I do not.
let's split this up in more understandable parts
you know what classes are, attributes and methods?
if not, look more into python first, you'll get way faster in developing that bot your dreamed of if you know the basics
Thanks bud, Ill make sure to.
Appreciate it a lot.
When I started discord.py Id never touched Python before. 2019 me was an absolute madman 😩 it’s a wonder I maintained enough patience to continue coding
@maiden fable
you know the !d command this bot has
wanna make it?
with me
and turn it into a pypi package
like jishaku where you just load it
uwu he's asking you for a date
:3
panda wanna do it with me? <3
I would but i'm kinda busy this week being the end of the year and all.
Gotta work from tuesday to thursday then friday birthday with new year 🥳
disappointing smh
But i do want to make a new bot soon :)
If you are still active here i'll hit you up how about that?
my idea is that its extremely user friendly in the way that you just pip install it and load it to your bot and its a free docs command which would be otherwise pretty hard
if i havent done it by then ;)
Well if you want to do that also do !pypi
And the python info commands like !global
Handy stuff.
ill try
•
» args-kwargs
» async-await
» blocking
» botvar
» class
» classmethod
» codeblock
» comparison
» contribute
» customchecks
» customcooldown
» customhelp
» decorators
» defaultdict
!customhelp
Custom help commands in discord.py
To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000
:3
wha
Gm guys
Good evening okimii
Average American.
no i was on the road for 12hours last night and i was programming for atleast 2 hours it was 3am so i went to sleep its just my schedule
:incoming_envelope: :ok_hand: applied mute to @spare moon until <t:1640630048:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
Lol me when i want to finish something xd
still have a confusing error
!source docs
Look up documentation for Python symbols.
i cant really solve but i will solve it today hopefully
Today i saw this error in this channel ```py
File "C:\Python310\lib\site-packages\discord\guild.py", line -1, in fetch_member
TypeError: can't send non-None value to a just-started coroutine
what was the issue?
would py await ctx.send('Hello world!') and py await ctx.message.channel.send('Hello world!') do the same thing?
Why ctx if ure doing message.channel
Same outcome but different object.
alr then
!resourses
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
ctx is the context so it will send the msg where the context was invoked
alr
😭
#bot-commands
@cloud dawn im so tired i just popped a whole mountain dew can
danggg
infernum gonna hit us with the ot soon
i feel it in my code

Close one 😅
😭
good luck
you will need it
true🕴️ 
okimii: im gonna learn sql!
couple weeks later: i dont have motivation
facts
doe be like that tho 👀
seems about right🕴️
no...
SQL is fun, Just started using postgres
Yee 🥳
whos oki
u
mii
ot mii

yall not funny im leaving now smh 🕴️
making fun of my name after i wakeup so disrespectful 🕴️ 
good riddance
||still reacts after said he was leaving||
username*

i left guys but i have 2 monitors with discord open
🕴️
Pff flex on saying he got 2 monitors
no jk im always watching
He was just waiting for the opportunity
exactly
second monitor discord and main 144hz with pycharm 
good play
1440p 144hz all 
cap
ok i'll stop now
2080super, i wished lol
It can run everything i want so it's good enough
yeah all the 2000series gpus can probably run anything pretty well
only cyberpunk i don't max whatever
not even a 3000series can
my 4GB ram HP laptop… built: different 😩💪
runs discord bots fine though
but does your gpu have a cool rgb light you can customize 
16gb of ram
32 lol
pycharm eats hella ram tho
im gonna upgrade it on my bday
bro my rgb gives atleast +15fps
🕴️
Minecraft tekkit used 20gb so i had to.
when its off i get 15fps when its on i get 400+ fps
bro pycharm eats a whole 1gb of ram😳
Minecraft mod requiring 20gb of ram- I’m-
This is just the application i was also running the server lmao
Notepad++ is nice 😌✌️
i have 2 red sticks of ram when the setup is white😔
🕴️ 
Can somebody check this code for me?
jkjk
no why
Sure just paste it in here.
sure
requests isnt async btw
Hm, what do you mean?
Also, what cookie should I use?
