Discord Bot – die neusten Beiträge

Python discord NonType Error?

Ich habe einen Error in meinem Code:

async def on_submit(self, interaction2: discord.Interaction):
    response = await sendRequests(str(self.username), str(self.email), str(self.password))
    if response == "email":
        await interaction2.response.send_message("Incorrect email format", ephemeral=True)
        return
    if response == "password":
        await interaction2.response.send_message("Incorrect password format. The password must meet these requirements: \nOne Uppercase letter \nOne lowercase letter \nOne number\n A special character ", ephemeral=True)
        return
    if response == "maintenance":
        await interaction2.response.send_message("The system is currently under maintenance. Please look in #news for more infos.", ephemeral=True)
    query = "INSERT INTO users VALUES (?, ?, ?, ?)"
    main.cursor.execute(query, (interaction2.user.id, str(self.username), str(self.email), str(self.password)))
    main.database.commit()
    await interaction2.response.send_message("You are now in the registration process. This can take up to one hour.", ephemeral=True)
    channel = main.bot.get_channel(1309925591146958933)
    await channel.send("make a recaptcha, registration from user : " + str(interaction2.user.name) + " with id: " + str(interaction2.user.id))

Error:
[2024-11-23 19:32:43] [ERROR  ] discord.ui.modal: Ignoring exception in modal <RegisterModal timeout=None children=3>:

Traceback (most recent call last):

 File ".venv\Lib\site-packages\discord\ui\modal.py", line 189, in _scheduled_task

   await self.on_submit(interaction)

 File "TestButton.py", line 41, in on_submit

   await channel.send("make a recaptcha, registration from user : " + str(interaction2.user.name) + " with id: " + str(interaction2.user.id))

         ^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'send'

Bot, Code, Programmiersprache, Python, Webentwicklung, Python 3, Pycharm, Discord, Discord Bot

discord server bot der musik abspielt die auf dem pc gespeichert ist?

guten frühen morgen

ich habe einen server der 24/7 an ist und habe dc drauf gemacht (system: windows 10), habe es micht chat gpt versucht das dass mir das erklärt, hat aber nicht funktioniert. daher frage ich hir mal nach. ich bin die ganze zeit daren stehen geblieben wenn ich den in den chat !join (damit der den sprach chat brtritt(der bot ist auch auf dem server hinzugefügt mit den passenden berechtigungen)) reagirt der nicht, es passiert garnix. kann mir bitte jemand helfen.

hir ist den pyton code:

import discord

from discord.ext import commands

import os

intents = discord.Intents.default()

intents.voice_states = True

intents.messages = True # Falls du auch auf Nachrichten reagieren möchtest

bot = commands.Bot(command_prefix='!', intents=intents)

@bot.event

async def on_ready():

   print(f'We have logged in as {bot.user}')

@bot.command(name='!join', help='Tritt einem Sprachkanal bei')

async def join(ctx):

   if ctx.author.voice:

       channel = ctx.author.voice.channel

       await channel.connect()

@bot.command(name='!leave', help='Verlässt den Sprachkanal')

async def leave(ctx):

   if ctx.voice_client:

       await ctx.guild.voice_client.disconnect()

@bot.command(name='!play', help='Spielt Musik ab')

async def play(ctx, *, query):

   if ctx.voice_client:

       source = discord.FFmpegPCMAudio(query)

       ctx.voice_client.play(source)

@bot.command(name='!stop', help='Stoppt die Musik')

async def stop(ctx):

   if ctx.voice_client:

       ctx.voice_client.stop()

bot.run (' das token ist auch richtig ')

MFG nick

Bot, Discord Server, Discord Bot

Meistgelesene Beiträge zum Thema Discord Bot