so i'm sure many people in the discord py community know of robotic nation on youtube, alexa makes great tutorials i had folower their first music bot tutorial using youtubedl but as it now violated youtube terms of service they made a new tutorial using wavelink and lavalink with java 13, i’ve set it all up to spec per the tutorial but for some reason i keep getting errors about no nodes in pool even after the node pool should be configured correctly to spec from the video
i'm hosting my bot via a rpi4 compute and have java 13.0.1 installed along with wavelink for this project bellow are the codes used i’ve messaged alexa and tried to trouble shoot with them multiple times but they cant even spot the error either hopefully someomne here can spot it
lavalink.jar is a dependency used
application.yml
server: # REST and WS server
port: 2333
address: 0.0.0.0
lavalink:
server:
password: "youshallnotpass"
sources:
youtube: true
bandcamp: true
soundcloud: true
twitch: true
vimeo: true
http: true
local: false
bufferDurationMs: 400 # The duration of the NAS buffer. Higher values fare better against longer GC pauses
frameBufferDurationMs: 5000 # How many milliseconds of audio to keep buffered
youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
playerUpdateInterval: 5 # How frequently to send player updates to clients, in seconds
youtubeSearchEnabled: true
soundcloudSearchEnabled: true
gc-warnings: true
#ratelimit:
#ipBlocks: ["1.0.0.0/8", "..."] # list of ip blocks
#excludedIps: ["...", "..."] # ips which should be explicit excluded from usage by lavalink
#strategy: "RotateOnBan" # RotateOnBan | LoadBalance | NanoSwitch | RotatingNanoSwitch
#searchTriggersFail: true # Whether a search 429 should trigger marking the ip as failing
#retryLimit: -1 # -1 = use default lavaplayer value | 0 = infinity | >0 = retry will happen this numbers times
metrics:
prometheus:
enabled: false
endpoint: /metrics
sentry:
dsn: ""
environment: ""
# tags:
# some_key: some_value
# another_key: another_value
logging:
file:
max-history: 30
max-size: 1GB
path: ./logs/
level:
root: INFO
lavalink: INFO
bot.py (section in question)
#bot.command()
async def connect(ctx):
vc = ctx.voice_client
print("----begin debug log ??connect----")
print("vc variable: "+str(vc))
try:
print("attempt to fetch channel author")
channel = ctx.author.voice.channel
print("channel author: "+str(channel))
print("after attempt to fetch channel author")
except:
print("attept to fetch exception AtributeError")
return await ctx.send("please join a voice channel to connect.")
print("after attept to fetch exception AtributeError")
if not vc:
print("before not vc")
await ctx.author.voice.channel.connect(cls=CustomPlayer())
print("after not vc")
else:
print("before else not vc")
await ctx.send("the bot is already connected to a voice channel")
print("after else not vc")
print("----end connect debug log----")
the class that also seems to have shown issues in debug
class CustomPlayer(wavelink.Player):
def __init__(self):
super().__init__()
self.queue = wavelink.Queue()
the error code produced
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/bot.py", line 1347, in invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 986, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 199, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ZeroConnectedNodes: There are no connected Nodes on this pool.
after fixing the code a bit and accommodating the fact that loop is deprecated i still get this error log, i'm not sure why it just wont create nodes this is becoming quite frustrating
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/discord/client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "/home/pi/bot/bot.py", line 79, in on_ready
asyncio.run(main())
File "/usr/lib/python3.9/asyncio/runners.py", line 33, in run
raise RuntimeError(
RuntimeError: asyncio.run() cannot be called from a running event loop
/usr/local/lib/python3.9/dist-packages/discord/client.py:416: RuntimeWarning: coroutine 'on_ready.<locals>.main' was never awaited
pass
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
[2022-09-18 16:54:14] [ERROR ] discord.ext.commands.bot: Ignoring exception in command connect
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 190, in wrapped
ret = await coro(*args, **kwargs)
File "/home/pi/bot/bot.py", line 234, in connect
await ctx.author.voice.channel.connect(cls=CustomPlayer())
File "/home/pi/bot/bot.py", line 29, in __init__
super().__init__()
File "/usr/local/lib/python3.9/dist-packages/wavelink/player.py", line 89, in __init__
node = NodePool.get_node()
File "/usr/local/lib/python3.9/dist-packages/wavelink/pool.py", line 452, in get_node
raise ZeroConnectedNodes("There are no connected Nodes on this pool.")
wavelink.errors.ZeroConnectedNodes: There are no connected Nodes on this pool.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/bot.py", line 1347, in invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 986, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 199, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ZeroConnectedNodes: There are no connected Nodes on this pool.
fixed code in question
async def connect_nodes():
await bot.wait_until_ready()
await wavelink.NodePool.create_node(
bot=bot,
host='192.168.1.81',
port=2333,
password='JnG-330-qrsd')
async def main():
await connect_nodes() # again, no need to run with AbstractLoopEvent if you can await
await bot.start(TOKEN)
asyncio.run(main())
on another attempt on my current code i'm getting this error trying to launch the bot.py
[H[2J[3J[1;33m launching...[0m
Traceback (most recent call last):
File "/home/pi/bot/bot.py", line 739, in <module>
asyncio.run(main())
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/pi/bot/bot.py", line 83, in main
await connect_nodes() # again, no need to run with AbstractLoopEvent if you can await
File "/home/pi/bot/bot.py", line 75, in connect_nodes
await bot.wait_until_ready()
File "/usr/local/lib/python3.9/dist-packages/discord/client.py", line 1108, in wait_until_ready
raise RuntimeError(
RuntimeError: Client has not been properly initialised. Please use the login method or asynchronous context manager before calling this method
[1;33m closed....[0m
i'm at a loss
You need to create a node with wavelink that handles the connection to Lavalink
import wavelink
from discord.ext import commands
bot = commands.Bot(command_prefix='?')
#bot.event
async def on_ready():
await wavelink.NodePool.create_node(bot=bot,
host='0.0.0.0',
port=2333,
password='YOUR_LAVALINK_PASSWORD')
bot.run('token')
Related
I'm trying to write a bot using py-cord 2.3.2 under Python 3.9. When the /pin command is used, the bot should pin the user's message.
I have this code:
#bot.slash_command(name="pin", description="Make a pinned message.")
#default_permissions(manage_messages=True)
async def pin(ctp, arg):
message = arg
await message.pin()
print ('Used used the command ""/pin"')
I get an error which says:
Ignoring exception in command pin:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-
packages/discord/commands/core.py", line 124, in wrapped
ret = await coro(arg)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-
packages/discord/commands/core.py", line 980, in _invoke
await self.callback(ctx, **kwargs)
File "/Users/fk/Downloads/amiebot (no config)/tweescord.py", line 46, in pin
await message.pin()
AttributeError: 'str' object has no attribute 'pin'
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-
packages/discord/bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-
packages/discord/commands/core.py", line 375, in invoke
await injected(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-
packages/discord/commands/core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception:
AttributeError: 'str' object has no attribute 'pin'
Why does this happen, and how can I fix it?
You can't get a message directly as a slash command argument. But you can get a message-id as a slash command argument.
The only thing you need to change in the function declaration is changing arg to message_id. After that, you can verify if the message with the specified ID exists.
try:
message = await ctp.channel.fetch_message(int(message_id))
except discord.Forbidden:
print("bot is missing permissions to get message")
except discord.NotFound:
print("message was not found, it doesn't exist in this channel")
else:
print("message found")
await message.pin()
You can read these two little sections for more detailed documentation:
channel.fetch_message: await fetch_message(id, /)
How can you create slash commands? Slash Commands
I am creating a discord bot in pyCharm. This is the following code I have:
# bot.py
import os
import discord
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
client = discord.Client()
#client.event
async def on_ready():
for guild in client.guilds:
if guild.name == GUILD:
break
print(
f'{client.user} is connected to the following guild:\n'
f'{guild.name}(id: {guild.id})'
)
client.run(TOKEN)
When I run it the following errors are produced:
Traceback (most recent call last):
File "C:\Users\elrod\venv\lib\site-packages\discord\http.py", line 300, in static_login
data = await self.request(Route('GET', '/users/#me'))
File "C:\Users\elrod\venv\lib\site-packages\discord\http.py", line 254, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\elrod\OneDrive\Desktop\Assignments\CPSC\Python\HextchLibraryApp\HextechLibrary.py", line 25, in <module>
client.run(TOKEN)
File "C:\Users\elrod\venv\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "C:\Users\elrod\venv\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Users\elrod\venv\lib\site-packages\discord\client.py", line 665, in start
await self.login(*args, bot=bot)
File "C:\Users\elrod\venv\lib\site-packages\discord\client.py", line 511, in login
await self.http.static_login(token.strip(), bot=bot)
File "C:\Users\elrod\venv\lib\site-packages\discord\http.py", line 304, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000022950CEF160>
Traceback (most recent call last):
File "C:\Users\elrod\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\elrod\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\elrod\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 751, in call_soon
self._check_closed()
File "C:\Users\elrod\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Process finished with exit code 1
Now, what I find interesting is this:
I can assure you that I have a .env file set up as such:
DISCORD_TOKEN={my-token-here}
DISCORD_GUILD={my-server-here}
and it is the correct information
I know this because when I take the same token out of the .env file and just paste it directly into client.run() it works without issue, but of course this is private information!
So, the issue is that my file isnt being read properly? I would disagree because in testing I find that the string in DISCORD_GUILD is being read in properly without issue
I also tried the ole turn it off and back on trick by resetting to a new token but no luck
This is my last resort to understanding this error. Does anyone know what could be causing this error and ho to fix it?
Your .env file should look like this:
# .env
DISCORD_TOKEN = ADASIUHFOAka12312jsdfhpAFDA.GnTdIh.dOU0fjmz-WhfDebLN7x8ncuGbLVWyPXNftirGA
Should not contain the {}, if you included them (taking literally as you wrote in your question).
Also, you should set your intents under Discord Developers - Applications and declare them when defining client.
So this worked yesterday and now its popping up alot of errors since ive tried to update do a version of discord.py that will work for slash command and continue being developed.
Here's the code:
import discord
from discord.ext import commands
from apikeys import *
client = commands.Bot(command_prefix=['!', '$', '_', '*', '$', '&'])
#client.event
async def on_ready():
print('the bot is ready!')
print('------------------')
#client.event
async def hello(ctx):
await ctx.send('Hello!')
#client.event
async def on_member_joined(member):
with open('my_image.png', 'rb') as f:
picture = discord.File(f)
channel = client.get_channel(883152435357548596)
await channel.send('Hello! Its not safe to go alone! Here take this!', file=picture)
#client.event
async def goodbye(ctx):
await ctx.send('Bye! Have a good one!')
#client.event
async def selfdestruct(ctx):
with open('explosion-boom.gif', 'rb') as f:
gif = discord.File(f)
await ctx.send('We going boom!!!', file=gif)
client.run(BOTTOKEN)
Its a rather easy bit of code to have the bot do some basic commands in discord. So I was extremally confused when it started shooting errors out in the dozens. If anyone knows what is happening here and how to fix it. Can you please explain to me what I did wrong and what the next course of action should be? I've tried moving code in and out of the document and editing my main.py but as far as I can tell I haven't done anything wrong on it
and here is what happens when I try to run the code:
Traceback (most recent call last):
File "E:\Python Projects\lib\site-packages\discord\http.py", line 349, in static_login
data = await self.request(Route('GET', '/users/#me'))
File "E:\Python Projects\lib\site-packages\discord\http.py", line 302, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\ccarr\PycharmProjects\pythonProject\Discord Bot\main.py", line 40, in <module>
client.run(BOTTOKEN)
File "E:\Python Projects\lib\site-packages\discord\client.py", line 631, in run
return future.result()
File "E:\Python Projects\lib\site-packages\discord\client.py", line 610, in runner
await self.start(*args, **kwargs)
File "E:\Python Projects\lib\site-packages\discord\client.py", line 573, in start
await self.login(*args)
File "E:\Python Projects\lib\site-packages\discord\client.py", line 424, in login
await self.http.static_login(token.strip())
File "E:\Python Projects\lib\site-packages\discord\http.py", line 353, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000197FC310040>
Traceback (most recent call last):
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000197FC310040>
Traceback (most recent call last):
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000197FC310040>
Traceback (most recent call last):
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users\ccarr\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Process finished with exit code 1
As a new guy to python this is very intimidating.If you need any of the other documents that show up in the error section i will be more then happy to post them for review!
Are you sure you typed correctly your discord token, and are you define "BOTTOKEN" in client.run()?
Error 401 Unauthorized:
The 401 Unauthorized Error is an HTTP response status code indicating that the request sent by the client could not be authenticatedThis means that the TOKEN you entered is not valid or has been entered incorrectly.
hi i will help you step by step:
First you have to put instead of
#client.event
async def hello
this:
#client.command()
async def hello("ctx"):
await ctx.send("hi")
or if you want to be an event try this :
#client.event
async def on_message(message):
if message.content == "hello":
await message.send("hi")
note: not all commands are events !
second help :
you just put a on_member_joined event. This event doesn't exist.. the real event is
#client.event
async def on_member_join(ctx):
with open('my_image.png', 'rb') as f:
picture = discord.File(f)
channel = client.get_channel(883152435357548596)
await channel.send('Hello! Its not safe to go alone! Here take this!', file=picture)
third help:
i really dont know what you tried to do but i will try to help you in the 2 times:
if you want to do:
an event that detect when the user leave:
#client.event
async def on_member_leave(ctx)
channel = client.get_channel("id of the channel")
await ctx.channel.send ("bye !")
and if you want that to be a command you just have to put this but not client.event but client.command() like this:
#client.command()
async def goodbye(ctx):
await ctx.send('Bye! Have a good one!')
same error you put #client.event instead of #client.command()
just put it like this:
#client.command()
async def selfdestruct(ctx):
with open('explosion-boom.gif', 'rb') as f:
gif = discord.File(f)
await ctx.send('We going boom!!!', file=gif)
and the last error (im not sure thats an error)
just put instead of client.run(BOTTOKEN) put `client.run("the token")
I am trying to make a command in mcoc.py cog -
#commands.command()
async def mcoc(self, ctx, tier_str:int,*,champname:str):
champname = champname.strip()
champname = champname.lower()
if champname == "bwcv":
champname=="blackwidow_timely"
url = f"https://auntm.ai/champions/{champname}/tier/{tier_str}"
session = AsyncHTMLSession()
r = await session.get(url)
await r.html.render(sleep=1, keep_page=True, scrolldown=1)
information = await r.html.find("div.sc-hiSbYr.XqbgT")
sig = await r.html.find('div.sc-fbNXWD.iFMyOV')
name = await r.html.find('div.sc-cxFLnm.izBVou')
tier_access = information[0]
self.tier = tier_access.text
async with ctx.typing:
embed = discord.Embed(title=f"{self.name_of_champ}",description=f"More Information about {self.name_of_champ} can be found (here)[{self.url_page}]")
await ctx.send(embed=embed)
But continuesly I am getting the error-
Ignoring exception in on_command_error
Traceback (most recent call last):
File "/home/indo/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/indo/Documents/Python/LoB/cogs/mcoc.py", line 119, in mcoc
await r.html.render(sleep=1, keep_page=True, scrolldown=1)
File "/home/indo/.local/lib/python3.9/site-packages/requests_html.py", line 598, in render
content, result, page = self.session.loop.run_until_complete(self._async_render(url=self.url, script=script, sleep=sleep, wait=wait, content=self.html, reload=reload, scrolldown=scrolldown, timeout=timeout, keep_page=keep_page))
File "/usr/lib/python3.9/asyncio/base_events.py", line 618, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 578, in _check_running
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/indo/.local/lib/python3.9/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: RuntimeError: This event loop is already running
Even after continues attempts, I am still getting the error, What's the reason and how can I fix this?
To resolve the error <RuntimeError: This event loop is already running>
, which seems to be specific for Jupyter Notebook and Jupyter Lab,
do this:
pip install nest_asyncio
you may also need this in your python app
import nest_asyncio
nest_asyncio.apply()
For complete patch info refence:
https://github.com/psf/requests-html/issues/402
https://github.com/erdewit/nest_asyncio
I want to change permissions of all channels of a server from Read messages = True to False. Basically I don't want users with default-role to be able to see any of the channel.
What I wrote:
#bot.command()
async def maintainance(ctx):
channel = ctx.guild.channels
perms = channel.overwrites_for(ctx.guild.default_role)
perms.read_messages=False
for channel in ctx.guild.channels:
await channel.set_permissions(ctx.guild.default_role, overwrite=perms)
await ctx.message.add_reaction(emoji="<a:tick:748476262640779276>")
error I get:
Ignoring exception in command maintainance:
Traceback (most recent call last):
File "C:\Users\Rohit\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\Rohit\Desktop\discord bots\tutorial bot\bot.py", line 23, in maintainance
perms = channel.overwrites_for(ctx.guild.default_role)
AttributeError: 'list' object has no attribute 'overwrites_for'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Rohit\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\bot.py", line 892, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Rohit\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 797, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Rohit\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 92, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'list' object has no attribute 'overwrites_for'
I don't know what I did wrong.
Overwrites are per channel so you need to do the get_overwrites inside the for loop, some psuedocode would look like
for every channel:
overwrites = get_overwrites()
overwrites.send_message = False
channel.set_permissions(default_role, overwrites=overwrites)
Another thing is that you should do ctx.message.add_reaction() outside the loop to avoid trying to add the same reaction multiple times