Questions tagged [disnake]

53 questions
3
votes
3 answers

disable a button after being used

Recently i decided to rewrite my discord bot and add buttons also. the main problem i encountered about this so far, i can't a disable a button just after being pressed people told be about button.disabled=True and in deed, it will disabling the…
Ares
  • 157
  • 1
  • 17
2
votes
1 answer

How to make a ckeck of user permissions in disnake or discord.py

I've got a code with permissions. I need to check a member permissions and if member don`t have such permissions send a message Main code: @commands.slash_command(name = "addrole", description="Додати користувачу…
1
vote
1 answer

Disnake.py | Private Voice Channel - continuation of work

CODE TASK: When entering the main channel, the bot creates a new private voice channel with its own rights. If you exit the channel for 10 seconds, the channel is automatically deleted, BUT if you return to this channel during these 10 seconds, the…
Mike
  • 17
  • 5
1
vote
1 answer

Taking action after some time. discord.py or disnake

Question: How can I perform actions after a while? Let's say: if 60 seconds have passed, then the message is deleted, and something is also deleted in the database. Possible Solutions: Make a message delete in the same slash_command, and then use…
Deprool
  • 75
  • 8
1
vote
1 answer

Basics - How do I output random.sample to newlines for a Discord bot?

My first time doing any coding, so apologies in advance. I'm making a Discord bot for fun and am trying to get random.sample to output each selection to a new line. Currently looks like this Need it to look like: Seed the Rebellion Wreck the…
1
vote
1 answer

How to make a Disnake Slash Command private

My Code: import disnake from disnake.ext import commands intents = disnake.Intents.default() intents.members = True intents.message_content = True bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"),…
1
vote
0 answers

Disnake/Discord.py Button is not responding, with my callback function

So I've been trying to get disnake buttons to get to work, for a good amount of time, and I am ending up with "This Interaction Failed", and it doesn't even execute the callback function i defined within the derived class of disnake.ui.button. There…
Anonymous
  • 528
  • 3
  • 17
0
votes
1 answer

Answer | Code for translator in disnake.py

I just want to share and help others with my code that translates any sentences. This code is written in cog, so it looks the way it looks. In the console of your computer, add this: pip install googletrans==4.0.0-rc1 Then just create a cog…
Mike
  • 17
  • 5
0
votes
0 answers

how can I keep a database connection in the bot?

I am writing a discord bot and it needs access to 2 databases, but after a while the connection closes and the commands stop working. I wrote a code that executes this line every 100 seconds, but I think it's wrong. @Cog.listener() async def…
ANTI
  • 3
  • 1
0
votes
1 answer

How to make a slash command without specifying the server ID (disnake)

I need to make a slash command available on all servers (disnake library). Now I have such code, but it doesn't work: @bot.slash_command(name="хост", description="Состояние хостинга ботихи") async def хост(inter): emb = disnake.Embed( …
zont
  • 1
0
votes
0 answers

Disnake Bot Adding buttons to a message

Please tell me how to add buttons to a message that will be sent to another channel. Example: a user writes a command !nick [name] to change the name. After that, a message with buttons is sent to the administration channel with a request to change…
0
votes
1 answer

Discord bot on Disnake. How do I make the button inactive after clicking?

I'm writing a diskord bot on Disnake. How would it be correct to add disabled to the code so that the buttons are inactive after clicking on them? The button lights up active @bot.slash_command() async def buttons(inter:…
0
votes
0 answers

The Discord bot responds 2 times. Disnake Python

When writing a command 2 times, even on different servers until the buttons disappear, when clicking on one of the "Remove warning" buttons, the bot responds 2 times instead of one, but at the same time only one warning is removed. Sometimes there…
reToster0
  • 1
  • 1
0
votes
1 answer

How to fix 'YouTube' object has no attribute 'streams' error while using pytube in a discord bot?

I am using pytube to write my own discord bot that will play youtube music. The line below gives me an error: Line: video_stream = video.streams.filter(only_audio=True).first() Error: 'YouTube' object has no attribute 'streams' I have tried…
Ander
  • 3
  • 2
0
votes
0 answers

Decoding troubles

import disnake from disnake.ext import commands import re import asyncio from disnake import Intents bot = commands.Bot(command_prefix="*", intents=disnake.Intents.all()) player_ku = {} isConsole = False isChat = True isId =…
Fanky
  • 1
  • 1
1
2 3 4