#Allgemeine Hilfe

1 messages · Page 47 of 1

tawdry leaf
#

Verstehe nd genau was dein Problem ist bzw. ob des Problem mit einen cmd zu tun hat etc

vernal rampart
tawdry leaf
#

Bot Owner ?

#

if commands.is_owner

urban glen
#

Timo hat darüber ein video

jade sapphire
#

würde dir empfehlen das video von timo oben an zu schauen, er erklärt es super

vernal rampart
#

wie nennt mann diesen fehler wenn man ihn im try except block einbauen will: in prepare
raise CheckFailure(
discord.errors.CheckFailure: The check functions for the command activity failed

blissful vale
vernal rampart
#

pycord

blissful vale
#

Slash command?

vernal rampart
#

ja aber weißt du wie der fehler heißt

blissful vale
#

Kannst du mir bitte den ganzen command schicken? Ich denke du hast da was in den params falsch 🙂

#

Warum baust du den check nicht einfach im command ein?

vernal rampart
# blissful vale Warum baust du den check nicht einfach im command ein?

danke ||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​|| _ _ _ _ _
https://cdn.discordapp.com/emojis/1069324604436398110.gif?size=64&quality=lossless

blissful vale
#

Kein problem 🙂

trim dagger
#

Kann wee Designen

urban glen
trim dagger
#

Ich meine ein Discord Banner für mein Cousin der ist auf dem server

urban glen
#

Wenn ihm ein Smiley als Banner reicht :D

trim dagger
#

Das Banner soll schön sein

urban glen
#

Meine Smileys sind schön

trim dagger
#

Zeig Mal ein Bild

urban glen
#

Ist doch gut :D

burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @past temple, du bist jetzt Level 42 🎉

Du hast insgesamt 11,388 Nachrichten geschrieben.

urban glen
#

xD

trim dagger
#

Hmmmmm

trim dagger
#

Hat wer die Discord Font?

urban glen
trim dagger
#

Thanks

trim dagger
#

Wie kann ich die Activity auf dnd setzten beim bot

thick haven
#

Hi, damit discord.abc.GuildChannel kann ja bei slash_command channel asuwählen aber da ist ja alles dabei kate voice und text channel kann man da noch irgentwie sagen nur voice oder text oder kates?

urban glen
blissful vale
urban glen
blissful vale
#

Muss ich mal nen crashkurs belegen 😂

rancid raven
# thick haven Hi, damit `discord.abc.GuildChannel` kann ja bei slash_command channel asuwähle...

Ja kannst die jeweiligen Channel Types als Union angeben.
Beispiel von py-cord

from typing import Union

@bot.slash_command(name="channel")
@option(
    "channel",
    Union[discord.TextChannel, discord.VoiceChannel],
    # You can specify allowed channel types by passing a union of them like this.
    description="Select a channel",
)
async def select_channel(
    ctx: discord.ApplicationContext,
    channel: Union[discord.TextChannel, discord.VoiceChannel],
):
    await ctx.respond(f"Hi! You selected {channel.mention} channel.")```
thick haven
urban glen
#

nur das

thick haven
#

okay dnaje

#

Wie kann ich ehrausfinde, wie viele boost ein user genutzt hat also bei einem server

trim dagger
#
@commands.command()
async def boost_count(self, ctx, member: discord.Member):
    boost_count = member.premium_subscription_count
    await ctx.send(f"{member.name} hat {boost_count} Boosts für den Server verwendet.")
#

@thick haven

#

Ohne cog

@bot.command()
async def boost_count(ctx, member: discord.Member):
    boost_count = member.premium_subscription_count
    await ctx.send(f"{member.name} hat {boost_count} Boosts für den Server verwendet.")
rancid raven
urban glen
#

Hey, ich will so ein Voice Support bot machen habe aber nun das problem das mein bot nur 1 voicekanal gleichzeitig beitreten kann? weis wer wie man das umgeht?

solid ingot
#

gar nicht, der bot kann pro server nur in einem voice channel sein

urban glen
solid ingot
#

mit mehreren bots nehme ich an

urban glen
urban glen
urban glen
urban glen
urban glen
urban glen
urban glen
ruby sparrow
#

mach einer hier mit was fivem ?

urban glen
urban glen
#

code:

    async def callback(self, interaction):
        now = datetime.now()
        timestamp = now.strftime("%A, %d. %B %Y %H:%M")
        abmelde_channel_id = 1112780297138876426

        channel_send = discord.Embed(
            title=f"Abmeldung - {timestamp}",
            description=f"**USER:** {interaction.user.mention}\n"
                        f"\n**GRUND:** {self.children[0].value}\n"
                        f"\n"
                        f"**Für was ist die Abmeldung:** {self.children[2].value}\n"

        )
        await abmelde_channel_id.send_message(embed=channel_send)

fehlercode:

Ignoring exception in modal <cogs.ab.AbmeldeView object at 0x000001D7A4BF1A10>:
Traceback (most recent call last):
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\modal.py", line 341, in dispatch
    await value.callback(interaction)
  File "C:\Users\melvi\PycharmProjects\frakbotprp\cogs\ab.py", line 65, in callback
    await abmelde_channel_id.send(embed=channel_send_embed)
          ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'send'
urban glen
urban glen
urban glen
# urban glen `abmelde_channel_id` ist eine Id, und kein Channel

ok habe jetzt geändert aber es geht immer noch nicht

Ignoring exception in modal <cogs.ab.AbmeldeView object at 0x00000246587B86D0>:
Traceback (most recent call last):
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\modal.py", line 341, in dispatch
    await value.callback(interaction)
  File "C:\Users\melvi\PycharmProjects\frakbotprp\cogs\ab.py", line 66, in callback
    await log_channel.send(embed=channel_send)
          ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send'
#
        log_channel = interaction.client.get_channel(123456789012345678)
        channel_send = discord.Embed(
            title=f"Abmeldung - {timestamp}",
            description=f"**USER:** {interaction.user.mention}\n"
                        f"\n**GRUND:** {self.children[0].value}\n"
                        f"\n"
                        f"**Für was ist die Abmeldung:** {self.children[2].value}\n"
        )
        await log_channel.send(embed=channel_send)
urban glen
#

Sieht auch nicht aus, wie eine gültige Id, i mean 1234567890 und dann nochmal 12345678.. hm

ruby sparrow
#

für fivem

urban glen
#

Für dich?
Ne lass mal

vivid sky
#

💀

urban glen
vivid sky
#

Jetzt Nachricht löschen weil gemerkt das es peinlich geworden ist

jade sapphire
#

@solid ingot 4/4? :D

safe tendon
solid ingot
jade sapphire
solid ingot
#

4/4?

jade sapphire
#

Ich mein ob du den call um 1 user erhöhen könntest

solid ingot
#

achsoo bin nicht channel owner, aber dieser kanal ist nur für coding fragen

jade sapphire
#

Uy ja dann

#

code gerade nicht haha

solid ingot
#

also ich meine diesen textkanal hier

jade sapphire
#

Achso hahahahahahahaha

#

Hab ich garnicht gemerkt lmao

tawdry leaf
jade sapphire
jade sapphire
#

Deine Aussage ist nicht ernst zu nehmen 😆

native plume
#

Weiß jmd ob es für Interactions auch sowas wie ctx.defer() gibt? Also das der Bot mehr Zeit zum üverlegen hat?

urban glen
native plume
#

Ok danke

tawdry leaf
jade sapphire
tawdry leaf
safe tendon
#
    @commands.Cog.listener()
    async def on_audit_log_entry(self, entry: discord.AuditLogEntry) -> None:
        if (await self.db.antinuke_get(guild_id=entry.guild.id)) == None:
            return

        if (await self.db.antinuke_get(guild_id=entry.guild.id))[1] == 0:
            return
        
        if (await self.db.whitelist_get(guild_id=entry.guild.id)) == None:
            return

        antinuke_data = await self.db.antinuke_get(entry.guild.id)
        if antinuke_data is None:
            limit_role_create = antinuke_data[3]
            limit_channel_create = antinuke_data[2]
            limit_channel_delete = antinuke_data[4]
            limit_role_delete = antinuke_data[5]

            if entry.action == discord.AuditLogAction.role_create:
                if limit_role_create is not None:
                    if len(entry.guild.roles) > limit_role_create:
                        await self.db.antinuke_extra_add(
                            guild_id=entry.guild.id, user_id=entry.user.id
                        )

            elif entry.action == discord.AuditLogAction.channel_create:
                if limit_channel_create is not None:
                    if len(entry.guild.channels) > limit_channel_create:
                        await self.db.antinuke_extra_add(
                            guild_id=entry.guild.id, user_id=entry.user.id
                        )

            elif entry.action == discord.AuditLogAction.channel_delete:
                if limit_channel_delete is not None:
                    if len(entry.guild.channels) < limit_channel_delete:
                        await self.db.antinuke_extra_add(
                            guild_id=entry.guild.id, user_id=entry.user.id
                        )

            elif entry.action == discord.AuditLogAction.role_delete:
                if limit_role_delete is not None:
                    if len(entry.guild.roles) < limit_role_delete:
                        await self.db.antinuke_extra_add(
                            guild_id=entry.guild.id, user_id=entry.user.id
                        )

wie kann ich sagen if (await self.db.whitelist_get(guild_id=entry.guild.id)) == None:
return
das das alles abrechen soll

limpid wolf
solid ingot
#

was funktioniert denn nicht? ich empfehle dir erst den wert aus der db zu holen, und dann mit der variable die if bedingungen zu machen. dann kannst du deinen eigenen code besser verstehen

#

außerdem musst du dann nicht dieselbe DB anfrage 3 mal machen

safe tendon
safe tendon
solid ingot
#

doch

jade sapphire
safe tendon
#

beim ersten fragt der ob das was überhaupt in der db ist beim 2 guckt ob es aktive ist beim dritten will ich gucken ob der user es aktive hat und dann soll das alles abrechen

jade sapphire
#

Ich bin selber nicht der profi sorry peepothink

solid ingot
safe tendon
#

ne ist nd die selbe timo

#

sind verschiedene abfragen

jade sapphire
solid ingot
#

wenn du meinst 😄

jade sapphire
#

Ich möchte dir helfen Ryzmpeepothink

safe tendon
#

aber wie breche diesen ganzen code ab nach der if bedinung?

solid ingot
#

mit return

#

aber das hast du ja schon so

jade sapphire
safe tendon
#

aber danach macht aber weiter oder peepothink

jade sapphire
#

Ich strenge mich anpeepothink

burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @jade sapphire, du bist jetzt Level 15 🎉

Du hast insgesamt 1,534 Nachrichten geschrieben.

Du hast <@&1024276907136663562> erhalten!

limpid wolf
#

du machst halt echt 3x die gleiche db abfrage, Hier: if (await self.db.antinuke_get(guild_id=entry.guild.id)) == None:, if (await self.db.antinuke_get(guild_id=entry.guild.id))[1] == 0: und antinuke_data = await self.db.antinuke_get(entry.guild.id)

jade sapphire
limpid wolf
#

einfach einmal am anfang und dann kannst du es ja einfach als variable nutzen

safe tendon
#

aber bin zu faul

jade sapphire
#

Faul peepothink

limpid wolf
#

Deine Sache, mir egal

safe tendon
#

ok

jade sapphire
#

Meine Sache peepothink

vernal rampart
#
void initialize() {

    // Initialisierungscode

    displayMessage("Willkommen beim Arcade1337!");

    insertCoin();

}

void insertCoin() {

    displayMessage("Bitte Münze einwerfen.");

    // Code zum Einwerfen der Münze

    boolean coinInserted = false;

    int coinCount = 0;

    while (!coinInserted) {

        // Überprüfe, ob eine Münze eingeworfen wurde

        // ...

        if (coinInserted) {

            coinCount++;

            displayMessage("Münze eingeworfen (" + coinCount + "/1)");

        } else {

            // Bitte den Spieler, eine Münze einzulegen

            // ...

        }

        // Überprüfe, ob genügend Münzen eingeworfen wurden

        if (coinCount >= 1) {

            playGame();

            break;

        }

    }

}

void playGame() {

    displayMessage("Spiel gestartet. Viel Spaß!");

    // Code für das eigentliche Spiel

    boolean gameRunning = true;

    while (gameRunning) {

        // Spiele das Spiel und aktualisiere den Spielzustand

        // ...

        // Überprüfe, ob das Spiel beendet ist

        if (/* Bedingung, um das Spiel zu beenden */) {

            gameRunning = false;

            displayMessage("Spiel beendet.");

void checkCode(String userInput) {

    String codeToCheck = "";

    for (int i = 0; i < userInput.length(); i++) {

        char c = userInput.charAt(i);

        if (Character.isDigit(c)) {

            codeToCheck += code[Character.getNumericValue(c)];

        } else if (Character.isLetter(c)) {

            codeToCheck += alphabet[(int) c - 97];

        } else {

            codeToCheck += specialChars[(int) c];

        }

    }

    if (codeToCheck.contains("open_drawer")) {

        displayMessage("Code korrekt!");

        // Schublade öffnet sich.

        // ...

    } else {

        displayMessage("Falscher Code. Bitte erneut versuchen.");

    }

}

        }

    }

}
#

weiß jenad wie der code ist der beschrieben wird?

urban glen
vernal rampart
#

aber weiß jemad was der code ist?

limpid wolf
vernal rampart
#

nein

#

eine pin

limpid wolf
#

Also die Sprache müsste Kotlin sein wenn ich mich nicht irre

vernal rampart
#

die pin die man braucht für den code

limpid wolf
#

hmm

limpid wolf
vernal rampart
limpid wolf
#

Warte ich schau mal aber idk ob ich es schaffe

limpid wolf
limpid wolf
#

Müsste klappen

thick haven
# trim dagger ```python @commands.command() async def boost_count(self, ctx, member: discord.M...

Ignoring exception in command boost_count:
Traceback (most recent call last):
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 124, in wrapped
ret = await coro(arg)
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 978, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "/home/container/cogs/commands.py", line 366, in boost_count
boost_count = member.premium_subscription_count
AttributeError: 'Member' object has no attribute 'premium_subscription_count'
The above exception was the direct cause of the following exception:

solid ingot
#

member.premium_subscription_count gibt es nicht, das geht nur bei guild

odd kiteBOT
thick haven
solid ingot
#

nicht wirklich, höchstens indem du die boost nachrichten trackst

#

aber die kann ein server auch ausschalten

thick haven
#

hm okay das doof gut danke

restive herald
tawdry leaf
solid ingot
#

aber man hat dieselbe rolle egal wie oft man geboostet hat

tawdry leaf
urban glen
#

Einer hat mal hier so ein link gesendet mit discord farben? hat den noch wer

solid ingot
urban glen
#

danke

fierce dove
#

Darf man ab 17 ne vape kaufen weil man da doch halb volljährig ist?

urban glen
fierce dove
#

OK darf man ab 17 ne kaufen

urban glen
fierce dove
#

17 und 18 macht kein Unterschied

urban glen
#

doch

#

Kurze frage, wenn ich meinen command ausführe funktioniert er nicht mehr also das 1 mal funktioniert er noch aber beim 2 mal wird er mir gar nicht mehr angezeigt?

solid ingot
#

stelle sicher dass dein bot nicht mehrmals läuft

urban glen
#

Wenn du damit nicht einverstanden bist, dann hast du halt pech

urban glen
urban glen
tawdry leaf
solid ingot
blissful vale
urban glen
#

weis wer warum der nichts macht? ```py
import discord
from discord.ext import commands

class ChannelManagementCog(commands.Cog):
def init(self, bot):
self.bot = bot

@commands.Cog.listener()
async def on_voice_state_update(self, member, before, after):
    target_channel_id = 1144010832125112431 
    if after.channel and after.channel.id == target_channel_id:
        new_channel = await member.guild.create_voice_channel(f'kanal-test')
        await new_channel.set_permissions(member, connect=True, move_members=True, manage_channels=True)

        await member.move_to(new_channel)

def setup(bot):
bot.add_cog(ChannelManagementCog(bot))

#

bzw wenn ich in den kanal gehe passiert nichts

#

habs schon trz danke

tawdry leaf
#

xD fühle des so

urban glen
#

wos

novel ore
#

Mach das after.channel and weg

tawdry leaf
#

xDDDD

opal basin
#

Hat wer zufällig ein command mit dem ich alle emojis auf meinem server löschen kann

rancid raven
odd kiteBOT
opal basin
#

top danke

rancid raven
#

Falls es probleme gibt kannst ja nachfragen

novel ore
opal basin
#

Also ich zähle das als Hilfe

#

Und für dumme Kommentare ist der Channel auch nicht

#

Nikos schreibt bin gespannt 😂

limpid wolf
fierce dove
opal basin
solid ingot
#

@opal basin Fragen nach fertigen Codes ist hier nicht erlaubt, bitte reagiere freundlicher wenn dich jemand darauf hinweist

opal basin
#

Kann mich noch vor 3monaten oder so erinnern da hab ich auch gefragt niemand hat es gejuckt

fierce dove
#

@opal basin

import discord
from discord.ext import commands
from discord.commands import slash_command

class EmojiCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @slash_command()
    async def delete_emojis(self, ctx):
        guild = ctx.guild
        emojis = await guild.fetch_emojis()
        
        for emoji in emojis:
            await emoji.delete()
        
        await ctx.send("Alle Emojis wurden gelöscht!")

def setup(bot):
    bot.add_cog(EmojiCog(bot))
opal basin
#

gibt doch noch nette leute

fierce dove
#

Oke

#

🙂

tawdry leaf
opal basin
opal basin
fierce dove
tawdry leaf
jaunty jasper
#

Code:


intents = discord.Intents.default()
intents.message_content = True
intents.members = True

bot = discord.Bot(intents=intents)

@bot.command(description="Sends the bot's latency.")
async def ping(ctx):
    await ctx.respond(f"Pong! Latency is {bot.latency}")


bot.run("TOKEN")

Error:
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\test\main.py", line 7, in <module>
bot = discord.Bot(intents=intents)
^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'Bot'

#

Und ich habe die neuste Pycordversion installiert

fierce dove
#

mach from discord.ext import commands

jaunty jasper
#

Macht nichts

#

dieses .Bot bleibt immernoch Gelb untersctrichen

#

und als Fehler in der Konsole ausgegeben

urban glen
# jaunty jasper Macht nichts
import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.message_content = True
intents.members = True

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

@bot.command(description="Sends the bot's latency.")
async def ping(ctx):
    await ctx.send(f"Pong! Latency is {bot.latency}")


bot.run("TOKEN")
jaunty jasper
urban glen
#

@bot.command macht preifx commans, und da du es so geschickt hast, bin ich davon ausgegangen das du Prefix Commands haben willst

jaunty jasper
#

wenn ich aber

#

@bot.slash_command(description="Sends the bot's latency.")

urban glen
jaunty jasper
#

mache kommt das

Traceback (most recent call last):
File "C:\Users\fabian2\PycharmProjects\ballas\main.py", line 10, in <module>
@bot.slash_command(description="Sends the bot's latency.")
^^^^^^^^^^^^^^^^^
AttributeError: 'Bot' object has no attribute 'slash_command'. Did you mean: 'add_command'?

jaunty jasper
urban glen
#

Soll ich für dich vielleicht den ganzen Bot Code schreiben??

jaunty jasper
#

Nein, aber mir erklären wie der Slashcommand funktioniert

#

Da meine Version nicht mehr klappt

urban glen
jaunty jasper
#

Bruh
Ok

odd kiteBOT
jaunty jasper
#

Das ist nicht mehr aktuell

urban glen
#

@jaunty jasper klick auf vorschau

jaunty jasper
#

Also hatte nicht funktioniert

urban glen
jaunty jasper
#

Weil bei mir funktioniert dieses bot.slash_command net

urban glen
#
import discord
from discord.commands import Option

intents = discord.Intents.default()

bot = discord.Bot(
    intents=intents
)


@bot.event
async def on_ready():
    print(f"{bot.user} ist online")


@bot.slash_command()
async def test(ctx):
    await ctx.respond(f"TEST")


bot.run("")
#

Versuchs so

solid ingot
jaunty jasper
#
  File "C:\Users\user\PycharmProjects\testing\main.py", line 2, in <module>
    from discord.commands import Option
  File "C:\Users\user\venv\Lib\site-packages\discord\commands\__init__.py", line 27, in <module>
    from .core import *
  File "C:\Users\user\venv\Lib\site-packages\discord\commands\core.py", line 49, in <module>
    from ..enums import MessageType, SlashCommandOptionType, try_enum
ImportError: cannot import name 'SlashCommandOptionType' from 'discord.enums' (C:\Users\user\venv\Lib\site-packages\discord\enums.py)```
#

Error in der Konsole gesehen

solid ingot
#

das ist sehr wahrscheinlich ein installationsfehler, weil du evtl noch discord.py installiert hast. eine schritt für schritt anleitung um den error zu beheben findest du in #🔍・pycord-help

jaunty jasper
urban glen
#

Oha Timo wird gesiezt

#

Also wir Diggern Timo meistens

tawdry leaf
#

pycord auch deinstallieren

solid ingot
urban glen
#

hahaha

tawdry leaf
#

brauchst py-cord

twin slate
#

ich habe ein view class und in der view class habe ich mehrere buttons mit @discord.ui.button gemacht. aber es werden nur 3 von 6 oder 7 oder so angezeigt. weiß jemand warum das so ist? fehler gibt es keinen code kann ich gleich schicken.

solid ingot
#

hast du die callback methoden auch unterschiedlich genannt?

urban glen
#

Und verschiedene custom ids

twin slate
tawdry leaf
#

xD

urban glen
#

Wie frage ich ab ob mein Bot eine bestimmte Permission hat?
(in einer if abfrage)

solid ingot
#

serverweit oder für einen channel?

urban glen
#

Serverweit

solid ingot
#

ich denke mit guild.me.guild_permissions

#

guild.me ist der bot aber nicht als user sondern als member

novel ore
#

also if guild.me.guild_permissions.kick_members

damit schau ich ob der bot member kicken kann also von denn berecchtigungen

jade sapphire
#

Moin hat timo ein video zu random gif generator?

#

wenn ja könnte es einer hier verlinken oder mal den command benutzen und es anzeigen lassen

jade sapphire
#

Danke Timo

solid ingot
#

das wäre jetzt der code für die main.py

rancid raven
# opal basin gibt doch noch nette leute

Ich hatte dir ja schon die Lösung gegeben, ich gehe erstmal davon aus das User basics in python beherrschen und wissen was for-schleifen sind etc
Also erwarten das da fertiger code kommt musst du nicht bei sowas

fierce dove
#
  • Event: on_ready
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/client.py", line 399, in _run_event
    await coro(*args, **kwargs)
  File "/storage/emulated/0/Timo/Dev/Discord/Bot/Falci/cogs/Events/OnStatus.py", line 26, in on_ready
    await self.bot.loop.create_task(self.on_status())
  File "/storage/emulated/0/Timo/Dev/Discord/Bot/Falci/cogs/Events/OnStatus.py", line 19, in on_status
    await self.bot.change_presence(status=discord.Status.dnd, activity=discord.CustomActivity(name=f"Cogs {len(self.bot.cogs)}"))
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/client.py", line 1383, in change_presence
    await self.ws.change_presence(activity=activity, status=status_str)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/gateway.py", line 682, in change_presence
    await self.send(sent)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/gateway.py", line 642, in send
    await self.socket.send_str(data)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/aiohttp/client_ws.py", line 151, in send_str
    await self._writer.send(data, binary=False, compress=compress)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 690, in send
    await self._send_frame(message, WSMsgType.TEXT, compress)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 601, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
solid ingot
#

code?

opal basin
fierce dove
#
import discord
import asyncio
from discord.ext import commands

class OnStatus(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.dev = ".InvalidTimo"
        
        
    async def on_status(self):
        while True:
            await self.bot.change_presence(status=discord.Status.dnd, activity=discord.CustomActivity(name=f"{len(self.bot.guilds)} Servern"))
            await asyncio.sleep(10)
            await self.bot.change_presence(status=discord.Status.dnd, activity=discord.CustomActivity(name=f"Developer: {self.dev}"))
            await asyncio.sleep(10)
            await self.bot.change_presence(status=discord.Status.dnd, activity=discord.CustomActivity(name=f"Made in: ezcord/pycord"))
            await asyncio.sleep(10)
            await self.bot.change_presence(status=discord.Status.dnd, activity=discord.CustomActivity(name=f"Cogs {len(self.bot.cogs)}"))
            await asyncio.sleep(10)
            await self.bot.change_presence(status=discord.Status.dnd, activity=discord.CustomActivity(name=f"{len(self.bot.commands)} Commands"))
            await asyncio.sleep(10)
            
    @commands.Cog.listener()
    async def on_ready(self):
        await self.bot.loop.create_task(self.on_status())
        
def setup(bot):
    bot.add_cog(OnStatus(bot))
solid ingot
#

mach das am besten mit einem task loop

fierce dove
#

Muss ich das asyncio raus nehmen

jade sapphire
#

Moin, wann benutze ich @bot.event und wann @commands.Cog.listener ?

urban glen
native plume
jade sapphire
#

Stimmt, danke

jade sapphire
#

Jungs ich finde selbst den fehler nicht, könnte einer mir helfen

#
from discord.commands import slash_command, Option
from discord.ext import commands


class Welcome(commands.Cog):
    def __int__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_member_join(self,
                             member
):
        embed = discord.Embed(
            title="Ein neuer Biker!",
            description=f"Willkommen {member.mention} auf BikersLife | DE, wir freuen uns das du da bist! Schau gerne in",
            color=discord.Color.blue()
        )
        embed.set_footer("BikersLife Community Bot")


        channel = await self.bot.fetch_channel(1141257045413220392, 1137078889244545034)
        await channel.send(embed=embed)


def setup(bot):
    bot.add_cog(Welcome(bot))```
solid ingot
#

was geht denn nicht, bzw was ist der error?

jade sapphire
#

Der bot startet ganz normal, nur es schickt die Willkommens nachricht nicht. Ich habe die einrückung etc. nochmal gecheckt, jedoch sendet er die nachricht nicht

solid ingot
#

member intent aktiviert?

jade sapphire
#

genau jetzt gehts irgendwie nicht mehr

#

obwohl ich sowas schon 2-3 mal gecodet habe

native plume
fierce dove
#

Hilfe @solid ingot

solid ingot
#

was gibts

urban glen
fierce dove
#

Irgendwie verbindet es sich nicht

#

Mit dem panel

#

Auf handy

#

Keine Ahnung warum es nicht geht

urban glen
#

ist keine valide ip adress

fierce dove
#

Warum

urban glen
#

woher soll ich das wissen

#

wie ist denn die ip

fierce dove
#

sftp://node.keksbot.xyz

urban glen
#

ist keine ip

fierce dove
#

Oh

#

Was muss ich dann machen

urban glen
#

die von pterodactyl

fierce dove
#

Unter der console wo Adresse steht

urban glen
#

ja die soweit ich weiß

fierce dove
#

Ok

jade sapphire
#

Ich habe nur das bezüglich den Cogs

urban glen
#

schick mal deinen code (was welcome angeht)

jade sapphire
#
from discord.commands import slash_command, Option
from discord.ext import commands


class Welcome(commands.Cog):
    def __int__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_member_join(self,
                             member
):
        embed = discord.Embed(
            title="Ein neuer Biker!",
            description=f"Willkommen {member.mention} auf BikersLife | DE, wir freuen uns das du da bist! Schau gerne in",
            color=discord.Color.blue()
        )
        embed.set_footer("BikersLife Community Bot")


        channel = await self.bot.fetch_channel(1141257045413220392, 1137078889244545034)
        await channel.send(embed=embed)


def setup(bot):
    bot.add_cog(Welcome(bot))```
solid ingot
#

er hatte den member intent nicht an

jade sapphire
native plume
jade sapphire
#

Ne geht immernoch nicht, member intent hab ich jetzt im code hinzugefügt geht immernoch nicht

native plume
jade sapphire
#

Ja

solid ingot
#

zeig mal wie du den intent im code hinzugefügt hast

jade sapphire
solid ingot
#

okay die intents sind jetzt schonmal richtig, jetzt musst du nur noch init richtig schreiben

#

hier fehlt ein i

def __int__(self, bot):
jade sapphire
#

uyyy danke

native plume
#

Funktioniert es?

jade sapphire
#

Habs endlich geschafft... da waren mehrere fehler haha

vivid sky
#

Was ist das den fürn Fehler?

'NoneType' object has no attribute 'sequence'
aiohttp.client_exceptions.ClientOSError: [WinError 64] Der angegebene Netzwerkname ist nicht mehr verfügbar

During handling of the above exception, another exception occurred:

  File "C:\Users", line 35, in main
    bot.run(bot.config["token"])
  File "C:\Users", line 41, in <module>
    main()
AttributeError: 'NoneType' object has no attribute 'sequence'
#

noch nie bekommen

vivid sky
urban glen
vivid sky
#

hä habe token geresetet aufeinmal geht, aber trotzdem danke das du helfen wolltest.

native plume
#

Hey Leute ich krieg bei meinen Buttons diesen Error:

discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0.emoji.name: Invalid emoji

Habe beim Emoji Parameter "🙋‍♂️" benutzt. Ist aber nur bei manchen EMojis. z.B., bei ⛔ funktioniert alles xD

Hier der Code:

class WhiteListButton(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)

    @discord.ui.button(label="Join Queue", style=discord.ButtonStyle.blurple, emoji="�", custom_id="joinq")
    async def button_callback(self, button, interaction):

Hab eig alles richtig gemacht, also \Emoji und dann schicken und kopieren und einfügen

urban glen
#

#

hm...

#

Versuch nochmal nh anderes emoji

tawdry leaf
native plume
#

Ist auch bei dem 😳 Emoji so also wird auch so geschrieben mit der Raute und dem Fragezeichen

tawdry leaf
#

kopierst du des emoji aus discord?

native plume
#

ALso das was TImo benutzt hatte. Bei dem muss ich noch gucken, ob da auch der Fehler kommt

native plume
tawdry leaf
#

dann würde aber nicht es so sein wie bei dir

#

\🙋‍♂️

#

das ist der emoji dann oder?

native plume
#

Jo

#

Wird bei mir in VS Codeserver direkt als ? Gepastet

unkempt karma
#

\🙋‍♂️

unkempt karma
#

also mit \ davor dann

native plume
#

Also emoji="\ �" ?

unkempt karma
#

ne

#

mach am besten windows + . und dann so

native plume
#

Hatte das ja so schon im code mit dem Fragezeichen

tawdry leaf
#

bei windows + . ist der emoji nd

#

also der geht in vsc

🙋‍♂️

native plume
#

Den siehst du in VSC ?

tawdry leaf
#

ja

tawdry leaf
#

den du kopieren kannst

native plume
#

Meinst du es macht einen UNterschied, dass ich VSC im Browser benutze. Eben um mit Mate an einem Projekt zu coden

tawdry leaf
#

sollte es nicht

urban glen
native plume
#

Wird halt auch schon wenn ich es kopiere als � gepastet

#

Ah maybe weil ich Dc Web benutze?

tawdry leaf
#

geb einf \:man_raising_hand: ein

#

in discord

native plume
#

\🙋‍♂️

#

Geht

#

ABer wenn ich wieder paste ist es wieder �

#

Ich lad mir kurz Dc runter

#

Nop hilft nichts xD'

#

Ich raff es nicht

tawdry leaf
#

ja deswegen immer custom emojis benutzen xD

native plume
#

Ey das ist so weird man

#

Ok hat sich geklärt xD Muss es per Windows + . einsetzen

novel ore
urban glen
#

Wie sendet man Nachrichten in Threads SA_catBruh

solid ingot
solid ingot
novel ore
solid ingot
#

ich würd's ohne Herr machen, du musst ja alle ein Mal durchgehen

#

also je nachdem wie du das system gemacht hast

novel ore
#

wieso wird nicht true geprintet die sind beie 10 in der if abfrage

solid ingot
#

printe dir doch einfach zahlen und eingabe, dann siehst du ja wieso es nicht true ist

solid ingot
#

vielleicht ist das eine ja ein string und das andere ein integer

urban glen
#

Bräuchte mal hilfe bei den fehlercode: Traceback (most recent call last): File "f:\trapster-setupper\self-writer.py", line 46, in <module> code = file.read() ^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 870: character maps to <undefined>

urban glen
urban glen
urban glen
#

mit dem file.read

#
import requests
import subprocess


url = input("Enter webhook URL: ")

with open("ttt.py", "r") as file:
    code = file.read()
    code = code.replace("PLACEHOLDER_WEBHOOK", url)

with open("ttt.py", "w") as file:
    file.write(code)

subprocess.call(["pyinstaller", "--onefile", "ttt.py"])

ip = requests.get('https://api.ipify.org').text

Main.py

#

bei der ttt.py

webhook_url = "PLACEHOLDER_WEBHOOK"```
 Habe ich es so gemacht
#

mach bei dem with blah blah das r zu einem w

#
  File "f:\trapster-setupper\self-writer.py", line 46, in <module>
    code = file.read()
           ^^^^^^^^^^^
io.UnsupportedOperation: not readable``` neuer fehlercode
urban glen
#

Das die Datei geladen wurde oder das ein Command ausgeführt wurde

urban glen
#

Zeig mal, wie du deine cogs lädst

#

Einfach nach bot.load_extension ein Print hinzufügen, wo dann einfach steht das du es geladen hast

urban glen
urban glen
urban glen
#

Dann keine ahnung, du könntest auch eine json nehmen, da würde ich es wissen

urban glen
#

und wie geht das mit der json?

urban glen
urban glen
twin slate
#

Bei mir findet der bot eine guild nicht. Hat jemand eine idee was ich falsch mache? Ich will das in einer variable speichern abeer die ist die ganze zeit leer. um die guild zu kriegen nehme ich einfach guild = bot.get_guild(id)

twin slate
#
async def quests_done(user_id):
    guild = bot.get_guild(1100400326240124978)
    async with aiosqlite.connect('quests.db') as db:
        async with db.execute(
                "SELECT user_id, easy_quests, hard_quests, ultimate_quests FROM general_quests WHERE user_id = ?", (user_id,)) as cursor:
            result = await cursor.fetchone()
        print(result[0])
        print(result[1])
        print(result[2])
        print(result[3])
        if '250 Messages' and '2h Voice' and 'Feedback' and '25 Gifs' in str(result[1]):
            print('1')
            member = await guild.get_member(user_id)
            role = await guild.get_role(1144629352261242941)
            await member.add_roles(role)
            return True
        elif '450 Messages' and '6h Voice' and '15 Sticker' and 'Werbung' in str(result[2]):
            print('2')
            member = await guild.get_member(user_id)
            print('2,1')
            role = await guild.get_role(1144629610647138436)
            print('2,2')
            await member.add_roles(role)
            print('2,3')
            return True
        elif '750 Messages' and '12h Voice' and '40 Emojis' and '10 Images' and '30 Zahlen' in str(result[3]):
            print('3')
            member = await guild.get_member(user_id)
            role = await guild.get_role(1144629642444157119)
            await member.add_roles(role)
            return True
        else:
            print('4')
            return False
#

ich hab da ein paar print sachen drin um zu gucken was der fehoer ist

urban glen
#

Wenns None ist, ist die ID vermutlich falsch

twin slate
#

es kommt none

#

die id ist aber richtig

#

hab die 3 mal überprüft

jade sapphire
#

Moin ich habe ein kleines problem beim printen und bei meinem Bot. Undzwar ich habe mir das video von timo bezüglich der APIs geschaut und ich wollte auch die API anfragen jedoch bekomme ich im terminal nur Process finished with exit code 0 und nicht die informationen der API.

#

Wo könnte der fehler liegen?

solid ingot
#

startest du auch deine Main Datei?

jade sapphire
#

Wie meinst du?

solid ingot
#

zeig Mal den Code den du startest

jade sapphire
#

Also ich drücke immer auf den run knopf

solid ingot
#

dann startest du wahrscheinlich die falsche datei

#

du musst die main datei starten

jade sapphire
#

yooo nvm hast recht

#

habs jetzt auch bemerkt, danke

#

Jetzt führt er den Command nicht aus

#

"Anwendung reagiert nicht"

#
from discord.commands import slash_command, Option
from discord.ext import commands
import os
import requests

from pprint import pprint
import random

class Punch(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @slash_command(name="punch", description="Schlage einen User!")
    async def punch(self,
                    ctx,
                    member: Option(discord.Member)
):
        key = os.getenv("API_KEY")

        result = requests.get("https://tenor.googleapis.com/v2/search?q=motorcycle&key={key}&limit=10")
        data = result.json()
        pprint(data)

        number = random.randint(0, 9)
        url = data["results"][number]["media_formats"]["gif"]["url"]

        embed = discord.Embed(
            title="Wruuum Wruuuuuum",
            color=discord.Color.blue()
        )
        
        embed.set_image(url=url)
        await ctx.respond(embed=embed)


def setup(bot):
    bot.add_cog(Punch(bot))
#

Das ist mein Code

fierce dove
#
  • Command: /docs
  • Guild: Test server - 1092452726484508734
  • User: .invalidtimo (.InvalidTimo✓) - 1078242409495932969
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/commands/core.py", line 131, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/commands/core.py", line 1000, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "/storage/emulated/0/Timo/Dev/Discord/Bot/Falci/cogs/Owner/falci.py", line 56, in docs
    [f"{index}. {value}" for index, value in list(self.targets.keys())]
  File "/storage/emulated/0/Timo/Dev/Discord/Bot/Falci/cogs/Owner/falci.py", line 56, in <listcomp>
    [f"{index}. {value}" for index, value in list(self.targets.keys())]
                             ^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)
jade sapphire
#

discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'results'

fierce dove
#
import discord
from discord.commands import slash_command, Option
from discord.ext import commands
import os
import requests

from pprint import pprint
import random

class Punch(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @slash_command(name="punch", description="Schlage einen User!")
    async def punch(self,
                    ctx,
                    member: Option(discord.Member)
):
        key = os.getenv("API_KEY")

        results = requests.get("https://tenor.googleapis.com/v2/search?q=motorcycle&key={key}&limit=10")
        data = result.json()
        pprint(data)

        number = random.randint(0, 9)
        url = data["results"][number]["media_formats"]["gif"]["url"]

        embed = discord.Embed(
            title="Wruuum Wruuuuuum",
            color=discord.Color.blue()
        )
        
        embed.set_image(url=url)
        await ctx.respond(embed=embed)


def setup(bot):
    bot.add_cog(Punch(bot))
#

Probiere Mal das

jade sapphire
#

Was hast du da denn geändert?

fierce dove
#

Ich habe das

result = requests.get

Zu

results = requests.get
jade sapphire
#

Nope geht immernoch nicht

fierce dove
#

Ok

odd kiteBOT
#

Mein Discord Server
https://discord.gg/zfvbjTEzv6

Links aus diesem Video
Reddit ► https://www.reddit.com/prefs/apps/
KeksBot ► https://keksbot.xyz

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Mein Hosting* ► https://tidd.ly/3gJufg6
Code auf Github ► https://github.com/tibue99/tutorial-bot

PYCORD
Docs ► https://docs.pycord.dev/
Guide ► https://guide.pycord.dev/in...

▶ Play video
fierce dove
#

Dieses Video

jade sapphire
#

benutze nicht die reddit api, sondern die tenor api. Auch wenn ich hab mit dem video gearbeitet als ich es gecodet habe

fierce dove
jade sapphire
#
{'error': {'code': 400,
           'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo',
                        'domain': 'googleapis.com',
                        'metadata': {'service': 'tenor.googleapis.com'},
                        'reason': 'API_KEY_INVALID'}],
           'message': 'API key not valid. Please pass a valid API key.',
           'status': 'INVALID_ARGUMENT'}}```
#

API Key not valid

fierce dove
#

Ok

#

Ich kann mal bei meinen bot schauen

#

@jade sapphire das ist mein Punch command

@slash_command(description="Schlage einen User")
    async def punch(self, ctx, member: Option(discord.Member, "wem möchtest du schlagen?")):
        user = member
        key = os.getenv("tenor_api")
        
        params = {
            "q": "punch",
            "key": key,
            "limit": "10",
            "client_key": "discord_bot",
            "media_filter": "gif"
        }
        async with aiohttp.ClientSession() as cs:
            async with cs.get("https://tenor.googleapis.com/v2/search", params=params) as r:
                data = await r.json()
        number = random.randint(0, 9)
        url = data["results"][number]["media_formats"]["gif"]["url"]
        embed=discord.Embed(
            title=f"<@{ctx.author.id}> hat <@{user.id}> geschlagen!",
            color=discord.Color.blue()
        )
        embed.set_image(url=url)
        embed.set_footer(icon_url=self.bot.user.avatar.url)
        await ctx.respond(embed=embed)
#

Du darfst den Benutzen

jade sapphire
#

nö nö alles gut ich code alles lieber selber für meinen bot

fierce dove
#

OK wenn du willst kannst du den Benutzen weil er geht mein command

jade sapphire
fierce dove
#

Ich habe noch

Imports

import aiohttp
import os
import json
import asyncpraw
#

Diese imports habe ich

jade sapphire
#

discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'results'

#

Immernoch results fehler

fierce dove
#

Bei welchen Code

jade sapphire
#

Bei dem da oben

fierce dove
#

Bei meinen

jade sapphire
#

Ne bei meinem

fierce dove
#

Mache mal pip install requests

fierce dove
jade sapphire
#

Nope geht immernoch nicht

fierce dove
#

Hmmm

jade sapphire
#
           'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo',
                        'domain': 'googleapis.com',
                        'metadata': {'service': 'tenor.googleapis.com'},
                        'reason': 'API_KEY_INVALID'}],
           'message': 'API key not valid. Please pass a valid API key.',
           'status': 'INVALID_ARGUMENT'}}
Ignoring exception in command punch:
Traceback (most recent call last):
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\cogs\punch.py", line 27, in punch
    url = data["results"][number]["media_formats"]["gif"]["url"]
          ~~~~^^^^^^^^^^^
KeyError: 'results'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'results'```
fierce dove
#

Probiere Mal mein Code in Ner extra datei

#

Sonst habe ich keine Ahnung mehr

solid ingot
cloud cedar
#

Moin, was muss ich für pycord installieren? Bin auf Linux und hab keine ahnung wie das da geht haha

wind finch
cloud cedar
trim dagger
#

Das ist für linux

cloud cedar
#

linux ist ne komische sache

burnt prairieBOT
#
Ghost Ping

@fierce dove hat @cloud cedar gepingt.

fierce dove
solid ingot
fierce dove
#

Er muss eine andere API key nehmen weil seine Nicht geht

jade sapphire
#
           'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo',
                        'domain': 'googleapis.com',
                        'metadata': {'service': 'tenor.googleapis.com'},
                        'reason': 'API_KEY_INVALID'}],
           'message': 'API key not valid. Please pass a valid API key.',
           'status': 'INVALID_ARGUMENT'}}```
jade sapphire
#

Ja ich versuche jetzt mal was

cloud cedar
wind finch
#

Musste dann die disk erweitern

fierce dove
#

Vielleicht geht das

#

Kenne mich nicht aus mit Linux

jade sapphire
#

Hab nen neuen API Key generated und es geht immernoch nicht

tawdry leaf
#

😐

wind finch
fierce dove
cloud cedar
solid ingot
fierce dove
#

Schick Mal deine env

solid ingot
#

zb mit einem print

jade sapphire
#

man.. hab ich doch schon timo

cloud cedar
#

Wie kann ich code copy pasten wenn ich von vscode zum remotedesktop will? bitte sagt nicht ich muss linux benutzen 😢

jade sapphire
#

print("API_KEY")

#

oder?

solid ingot
#

naja das ist einfach nur ein string den du printest, das bringt dir nix

fierce dove
#
print(API_KEY)
```@jade sapphire
jade sapphire
#

ja hab es korriegiert

#
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'results'
{'error': {'code': 400,
           'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo',
                        'domain': 'googleapis.com',
                        'metadata': {'service': 'tenor.googleapis.com'},
                        'reason': 'API_KEY_INVALID'}],
           'message': 'API key not valid. Please pass a valid API key.',
           'status': 'INVALID_ARGUMENT'}}```
#

drecks API key wirklich regt mich auf

fierce dove
#

Hast du es so in der env

API_KEY = dein API key

jade sapphire
#

hab ich

#
API_KEY = API KEY```
#

So hab ich es in meinem .env datei

fierce dove
#

OK dann bei dein API KEY dein API key einfügen

jade sapphire
#

hab ich ja...

#

hab da halt nur API KEY geschrieben damit ihr wisst wie ich es da rein getan hab

fierce dove
#

Ok

tawdry leaf
#

lost xD

jade sapphire
tawdry leaf
jade sapphire
solid ingot
#

mach den api key am besten direkt in deine datei statt ihn aus der .env zu laden

jade sapphire
#

ja keine ahnung das ist halt das was raus kommt

jade sapphire
#

Geht immernoch nicht

#
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'results'
{'error': {'code': 400,
           'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo',
                        'domain': 'googleapis.com',
                        'metadata': {'service': 'tenor.googleapis.com'},
                        'reason': 'API_KEY_INVALID'}],
           'message': 'API key not valid. Please pass a valid API key.',
           'status': 'INVALID_ARGUMENT'}}```
solid ingot
#

code?

jade sapphire
#
from discord.commands import slash_command, Option
from discord.ext import commands
import os
import requests

from pprint import pprint
import random


class Punch(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @slash_command(name="punch", description="Schlage einen User!")
    async def punch(self,
                    ctx,
                    member: Option(discord.Member)
                    ):
        key = os.getenv("hier ist die API Key")

        results = requests.get("https://tenor.googleapis.com/v2/search?q=motorcycle&key={key}&limit=10")
        data = results.json()
        pprint(data)

        number = random.randint(0, 9)
        url = data["results"][number]["media_formats"]["gif"]["url"]

        embed = discord.Embed(
            title="Wruuum Wruuuuuum",
            color=discord.Color.blue()
        )

        embed.set_image(url=url)
        await ctx.respond(embed=embed)


def setup(bot):
    bot.add_cog(Punch(bot))```
tawdry leaf
#

from pprint import pprint wozu?

jade sapphire
#

discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'results' Was ist denn mit Results? Da ist doch ja auch was falsch

tawdry leaf
#
import discord
from discord.commands import slash_command, Option
from discord.ext import commands
import os
import requests
import random


class Punch(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @slash_command(name="punch", description="Schlage einen User!")
    async def punch(self,
                    ctx,
                    member: Option(discord.Member)
                    ):
        key = os.getenv("hier ist die API Key")

        results = requests.get("https://tenor.googleapis.com/v2/search?q=motorcycle&key={key}&limit=10")
        data = results.json()
        print(data)

        number = random.randint(0, 9)
        url = data["results"][number]["media_formats"]["gif"]["url"]

        embed = discord.Embed(
            title="Wruuum Wruuuuuum",
            color=discord.Color.blue()
        )

        embed.set_image(url=url)
        await ctx.respond(embed=embed)


def setup(bot):
    bot.add_cog(Punch(bot))```
solid ingot
tawdry leaf
#

bei dir steht in der .env

API_KEY also muss da auch "API_KEY" stehen

jade sapphire
solid ingot
tawdry leaf
jade sapphire
#
from discord.commands import slash_command, Option
from discord.ext import commands
import os
import requests
import random


class Punch(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @slash_command(name="punch", description="Schlage einen User!")
    async def punch(self,
                    ctx,
                    member: Option(discord.Member)
                    ):
        key = ("mein key")

        results = requests.get("https://tenor.googleapis.com/v2/search?q=motorcycle&key={key}&limit=10")
        data = results.json()
        print(data)

        number = random.randint(0, 9)
        url = data["results"][number]["media_formats"]["gif"]["url"]

        embed = discord.Embed(
            title="Wruuum Wruuuuuum",
            color=discord.Color.blue()
        )

        embed.set_image(url=url)
        await ctx.respond(embed=embed)


def setup(bot):
    bot.add_cog(Punch(bot))```
#

PY```
BikersCommunity#2180 ist online
{'error': {'code': 400, 'message': 'API key not valid. Please pass a valid API key.', 'status': 'INVALID_ARGUMENT', 'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'API_KEY_INVALID', 'domain': 'googleapis.com', 'metadata': {'service': 'tenor.googleapis.com'}}]}}
Ignoring exception in command punch:
Traceback (most recent call last):
File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 978, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "C:\Users\yildi\PycharmProjects\BikersCommunity\cogs\punch.py", line 25, in punch
url = data["results"][number]["media_formats"]["gif"]["url"]
~~~~^^^^^^^^^^^
KeyError: 'results'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
await injected(ctx)
File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'results'```

wind finch
jade sapphire
jade sapphire
tawdry leaf
#

sus

fierce dove
#

Er hat ein api Key von mir

jade sapphire
#

deine geht irgendwie auch nicht haha

fierce dove
tawdry leaf
#

der api key geht nur results macht jz probleme siehe neusten error oben

jade sapphire
#
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\cogs\punch.py", line 26, in punch
    url = data["results"][number]["media_formats"]["gif"]["url"]
          ~~~~^^^^^^^^^^^
KeyError: 'results'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'results'```
fierce dove
#

Mach mal result

jade sapphire
#
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'result'```
burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @jade sapphire, du bist jetzt Level 16 🎉

Du hast insgesamt 1,702 Nachrichten geschrieben.

jade sapphire
#

@solid ingot kannst du mir helfen

solid ingot
#

wenn du dir data printest kannst du einfach sehen wieso es probleme gibt

tawdry leaf
#

wir schauen gerade das wir des bisschen wie bei dein video machen

#

jz geht es

fierce dove
#

Ok

jade sapphire
#

Es geht endlich

fierce dove
#

👏👏👏👏👏

jade sapphire
#

dank @tawdry leaf

#

er hat mich auf etwas wichtiges aufmerksam gemacht

fierce dove
#

Sag einfach wenn du API Keys besuchst

tawdry leaf
#

paramter 👀

fierce dove
tawdry leaf
#

wo ist denn deiner 👀

fierce dove
#
@slash_command(description="Schlage einen User")
    async def punch(self, ctx, member: Option(discord.Member, "wem möchtest du schlagen?")):
        user = member
        key = os.getenv("tenor_api")
        
        params = {
            "q": "punch",
            "key": key,
            "limit": "10",
            "client_key": "discord_bot",
            "media_filter": "gif"
        }
        async with aiohttp.ClientSession() as cs:
            async with cs.get("https://tenor.googleapis.com/v2/search", params=params) as r:
                data = await r.json()
        number = random.randint(0, 9)
        url = data["results"][number]["media_formats"]["gif"]["url"]
        embed=discord.Embed(
            title=f"<@{ctx.author.id}> hat <@{user.id}> geschlagen!",
            color=discord.Color.blue()
        )
        embed.set_image(url=url)
        embed.set_footer(icon_url=self.bot.user.avatar.url)
        await ctx.respond(embed=embed)
tawdry leaf
#

das ist doch zu 80% von timo xD

fierce dove
tawdry leaf
wind finch
fierce dove
tawdry leaf
fierce dove
#

Es kommt. Noch was hinzu beim code

jade sapphire
#

Was ich damit sagen wollte ist das ich es lieber eigenständig lernen möchte und keine anderen codes benutzen will...

fierce dove
#

Ok

fierce dove
tawdry leaf
#

besuchst xD

wind finch
tawdry leaf
#

lass mal deine token api besuchen 😄

fierce dove
#

Hab's verbessert @tawdry leaf

tawdry leaf
jade sapphire
#

@tawdry leaf Wieso bist du raus?

tawdry leaf
jade sapphire
#

junge... komm doch wieder rein man ahhaha

#

Kann mir kurz noch einer erklären was "limit": "10", und number = random.randint(0, 9) bedeutet? Heißt es einfach das 0-9 random gifs ausgewählt werden sollten?

tawdry leaf
#

nein

#

0-9 sind insgesamt 10 und aus den 10 wählt er einen

fierce dove
tawdry leaf
jade sapphire
tawdry leaf
jade sapphire
#

Sorry 0-9

tawdry leaf
#

jo

jade sapphire
#
    def __init__(self, bot):
        self.bot = bot

    @slash_command(name="meme", description="Lasse dir Memes anzeigen")
    async def meme(self, ctx):
        key = os.getenv("API_KEY")

        params = {
            "q": "meme",
            "key": key,
            "limit": "10",
            "client_key": "discord_bot",
            "media_filter": "gif"
        }
        result = requests.get("https://tenor.googleapis.com/v2/search", params=params)
        data = result.json()
        # pprint(data)

        number = random.randint(0, 10)
        url = data['results'][number]['media_formats']['gif']['url']

        embed = discord.Embed(
            title="Der Meme:",
            color=discord.Color.blue()
        )
        embed.set_image(url=url)
        embed.set_footer(text="Offizieller BikersLife Discord Bot")
        await ctx.respond(embed=embed)


def setup(bot):
    bot.add_cog(memes(bot))``` Wieso funktioniert der Code nicht?
fierce dove
#
  • Command: /docs
  • Guild: Test server - 1092452726484508734
  • User: .invalidtimo (.InvalidTimo✓) - 1078242409495932969
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/commands/core.py", line 131, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/commands/core.py", line 1000, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "/storage/emulated/0/Timo/Dev/Discord/Bot/Falci/cogs/Owner/falci.py", line 56, in docs
    [f"{index}. {value}" for index, value in list(self.targets.keys())]
  File "/storage/emulated/0/Timo/Dev/Discord/Bot/Falci/cogs/Owner/falci.py", line 56, in <listcomp>
    [f"{index}. {value}" for index, value in list(self.targets.keys())]
                             ^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)
jade sapphire
#

Bzw. wird der nicht angezeigt

fierce dove
#

Wie

#

Das sollte ein py-cord doc command werden

tawdry leaf
fierce dove
#

Ok

tawdry leaf
#

aber wenn du da jz discord suchst bei den docs hast du zu viele ergebnisse

#

da musst du des eben mit mehreren seiten machen wie hier bei den docs command

fierce dove
#

Aber wie soll ich es machen

tawdry leaf
#

erstmals musst wissen wie viele values in ein embed es sein dürfen

#

und wenn du des weißt eben abfragen

fierce dove
#

Keine Ahnung wie

#

Darum Frage ich

#

@tawdry leaf

#

Keine Ahnung wie es geht

tawdry leaf
#

Also Limits siehst du hier

fierce dove
#

Aber wie kann ich es festlegen

fierce dove
tawdry leaf
#

if len(embed) > 5900:

#

if len(embed.fields) >= 25:

fierce dove
#

Wo muss ich es dann hin setzen

tawdry leaf
#

ich weiß es nd genau vllt antwortet bald jmd der sich da besser auskennt 😄

fierce dove
#

Ok

jade sapphire
#

Jungs ich möchte als value public_flag bestimmen, hab ich in der dokumentation gefunden. Ist das richtig?

public_flags = discord.user.public_flags

limpid wolf
#

Probier es aus

#

Wir wissen auch nicht alles auswendig

jade sapphire
#

naja... ich weiß es jetzt auch nicht wirklich da mein code schon wieder einmal anwendung reagiert nicht

#

schickt

tawdry leaf
#

xD

urban glen
#

Error?

jade sapphire
urban glen
#

Schick mal Code

limpid wolf
#

dann gibts das wohl nicht beim discord.member

jade sapphire
#

hmmm....

tawdry leaf
#

discord.user ist auch falsch

jade sapphire
#

wasn richtig?

tawdry leaf
#

discord.User

#

member.public_flags.all

jade sapphire
#

eigentlich ist es richtig...

urban glen
#

nein

#

Siehst du ja

#

brauchst ein member / user objekt, um display_avater zu nutzen

jade sapphire
#

embed.set_thumbnail(discord.display_avatar.url)

urban glen
#

Ja falsch

jade sapphire
#

Wieson das...

urban glen
#

Von wem willst du denn das avatar anzegen lassen?

vivid sky
#

discord?

jade sapphire
urban glen
urban glen
jade sapphire
#

Und wie genau soll ich es bestimmen? bspw?

urban glen
#

Kennst du die Dokumentationen?
oder die Suchmaschine google?

jade sapphire
#

urban glen
#

Tja, dann haste pech :D

jade sapphire
#

ich schau mal nach

#

ich bin dumm? wieso habe ich da discord hin geschrieben...

urban glen
#

Das fragen wir uns alle hier

jade sapphire
#

ja gut... verständlich haha

tawdry leaf
#

@jade sapphire wolltest du nd alleine des versuchen wieso fragst dann bei sowas 🤔

jade sapphire
#

wo hab ich denn gemeint das ich nichts fragen werde?

#

unterlass mal die anschuldigungen...

urban glen
#

@tawdry leaf statement?

tawdry leaf
#

Habe wohl seine Nachricht oben mit ich nehm keine Codes von anderen falsch verstanden?

#

oder ist es Doppelmoral von ihm 🤔

#

ist keine Anschuldigung meinerseits

jade sapphire
#

Hmm sieht gut aus

urban glen
#

Außer du hast schon code geschrieben um es zu verhindern xD

restive herald
urban glen
restive herald
#

lol

urban glen
#

Wenn man die id hat

#

Zum beispiel wie bei <@&1018360496396714076>

#

Kann man sonst eig nd pingen, wenn man @ macht

#

Aber ich meine, wenn jemand zu viele rollen hat, und dann das embed field zu lang ist, dann kommt ein error

restive herald
#

das stimmt

jade sapphire
jade sapphire
#

Internet ist scheiße

tawdry leaf
#

einf ein extra button nur für userrollen 😮

jade sapphire
urban glen
#

Sei ein Alpha

tawdry leaf
#

schau mal whoami xD

jade sapphire
#

Ich sag mal so die Rollen erscheinen automatisch wenn ein User die Rolle besitzt, falls es das ist was du meinst

jade sapphire
tawdry leaf
jade sapphire
#

Naja ich hoffe mal das niemand soviele Rollen besitzen wird das da ein error erscheint xd

tawdry leaf
#

denke ich auch nd

#

Kann man es einstellen das alle emojis in einer reihe sind xD

fierce dove
#

Kann mir jemand helfen wegen dem Limit

restive herald
#

welchem limit?

#

zeichenlimit?

tawdry leaf
restive herald
#

also dein problem is, dass manchmal zu viele felder da sind oder was

fierce dove
#

Ja aber keine Ahnung wie ich das jetzt weg mache

restive herald
restive herald
#

Man kann bei Message Commands keine options verwenden oder?

fierce dove
#

Aber keine Ahnung wie ich es einbinde

fierce dove
solid ingot
#

gar nicht

#

bei message commands hat man nur die message als parameter

fierce dove
#

Aber wie hast du das gemacht

solid ingot
fierce dove
solid ingot
#

probiers aus

fierce dove
#

Ok

urban glen
restive herald
ruby sparrow
#

Wie kann man alles beenden was hat man gestartet über #1046779655065174157 Weil ich da ein fivem server gemacht hab es start jetzt nicht mehr neu! @solid ingot

ruby sparrow
wind finch
ruby sparrow
#

Nein

#

hab schon versucht

#

@wind finch

ruby sparrow
jade sapphire
#

Jungs

#
    async def on_member_join(self,
                             member,
                             button: discord.ui.button(label="Grüße", style=discord.ButtonStyle.green, emoji="✌"),
                             interaction
                             ):
        embed = discord.Embed(
            title="Ein neuer Biker!",
            description=f"Willkommen {member.mention} auf BikersLife | DE, wir freuen uns das du da bist!",
            color=discord.Color.blue()
        )
        embed.set_footer(text="BikersLife Community Bot")
        channel = await self.bot.fetch_channel(1141257045413220392)
        await channel.send(embed=embed)```
wind finch
#

Ja?

jade sapphire
#

Ich möchte ein Button an mein Welcome Nachricht hängen, aber ich weiß nicht wie es geht. Ich habs mal so probiert. Hab mir mal Timos video angeschaut aber der erklärt es nur mit slash commands

urban glen
jade sapphire
urban glen
#

Einfach view=dieView() an die Nachricht hängen

jade sapphire
#

Also class ... ?

#
    async def on_member_join(self,
                             member
                             ):
        embed = discord.Embed(
            title="Ein neuer Biker!",
            description=f"Willkommen {member.mention} auf BikersLife | DE, wir freuen uns das du da bist!",
            color=discord.Color.blue()
        )
        embed.set_footer(text="BikersLife Community Bot")
        channel = await self.bot.fetch_channel(1141257045413220392)
        await channel.send(embed=embed, view=WillView)

def setup(bot):
    bot.add_cog(Welcome(bot))


class WillView(discord.ui.View):
    @discord.ui.button(label="Grüße", style=discord.ButtonStyle.green, emoji="✌")
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("Hey!")```
#

Also ich hab es jetzt mal so gemacht weiß jedoch nicht ob es richtig ist

vivid sky
jade sapphire
#
    def __init__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_member_join(self,
                             member
                             ):
        embed = discord.Embed(
            title="Ein neuer Biker!",
            description=f"Willkommen {member.mention} auf BikersLife | DE, wir freuen uns das du da bist!",
            color=discord.Color.blue()
        )
        embed.set_footer(text="BikersLife Community Bot")
        channel = await self.bot.fetch_channel(1141257045413220392)
        await channel.send(embed=embed, view=WillView(self.bot))

def setup(bot):
    bot.add_cog(Welcome(bot))


class WillView(discord.ui.View):
    @discord.ui.button(label="Grüße", style=discord.ButtonStyle.green, emoji="✌")
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("Hey!")```
#

Also ich habe es jezzt so, jedoch schickt er die Welcome Nachricht nicht wenn ein neuer User joint.

fierce dove
#
    def __init__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_member_join(self,
                             member
                             ):
        embed = discord.Embed(
            title="Ein neuer Biker!",
            description=f"Willkommen {member.mention} auf BikersLife | DE, wir freuen uns das du da bist!",
            color=discord.Color.blue()
        )
        embed.set_footer(text="BikersLife Community Bot")
        channel = await self.bot.get_channel(1141257045413220392)
        await channel.send(embed=embed, view=WillView(self.bot))

def setup(bot):
    bot.add_cog(Welcome(bot))


class WillView(discord.ui.View):
    @discord.ui.button(label="Grüße", style=discord.ButtonStyle.green, emoji="✌")
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("Hey!")```
#

Hier

jade sapphire
#

Ist etwas kompliziert mit den Buttons, ich habe nicht wirklich verstanden wie ich buttons zu nachricht hinzufügen sollte, ohne wirklich einen ganzen /slash command zu erstellen...

jade sapphire
fierce dove
jade sapphire
#

Okay... ich versuchs mal

fierce dove
#

Ok

solid ingot
jade sapphire
#

Hab ich mir schon angeguckt

fierce dove
#

Ok

jade sapphire
jade sapphire
solid ingot
jade sapphire
#

Ich konnte mich glaube ich nicht ausdrücken... ganz kurz.

obtuse estuary
#

Das mit dem Slash command war nur ein beispiel

solid ingot
#

der button ist unabhängig vom slash command, du kannst immer wenn du eine nachricht sendest den buttons als parameter angeben

jade sapphire
#

Hmm… also in deinem video hab ich es nicht wirklich verstanden wie ich es tun sollte. Ist der Class button die parameter?

obtuse estuary
#

Also im prinzip ist ja die Button class unabhängig vom Slash command. Der slash command ist nur nützlich dafür das du den button aufrufst.

odd kiteBOT
solid ingot
#

@jade sapphire schau dir das hier mal in den docs an, da kannst du auch einen view festlegen

jade sapphire
#

Alles klar danke!

obtuse estuary
#

Also kannst du das auch mit interaction.respond machen oder halt auch in einem channel.send

hard pivot
#

Hallo weiß wer wie ich überprüfen kann ob ein channel in einer spezifischen Kategorie ist?

solid ingot
#

@hard pivot das geht mit channel.category, also zb if channel.category.id == 123

old ore
#

weiß jmdn wie man blaue schrift in dc auch mit buchstaben machnt? wenn ich des mit css so mache css 1234 text

#

werden nur zahlen blau

urban glen
#
test
old ore
urban glen
old ore
#
test```
#

ah danke dir

trim dagger
#
- Hi Mentos
old ore
trim dagger
urban glen
old ore
#

: .。. o(≧▽≦)o .。.:

urban glen
trim dagger
#

°°°°°

vivid sky
#

weiß jemand wie ich das fixxe?

TypeError: informationbuttons.button_callback3.<locals>.dropdown_callback() missing 1 required positional argument: 'selected_values'
trim dagger
#

°_°

vivid sky
# urban glen Code?
    @discord.ui.button(
        label="Partner",
        style=discord.ButtonStyle.blurple,
        emoji="👑",
        custom_id="partner"
    )
    async def button_callback3(self, button, interaction):
        embed = discord.Embed(title=f"RLG's  Partners", description="""
        Hier findest du unsere Partner im dropdown


         """, color=0x5c00c7)
        embed.set_thumbnail(url=f"{interaction.guild.icon.url}")

        dropdown = discord.ui.Select(placeholder="Wähle einen Partner...", custom_id="partner_dropdown")
        dropdown.add_option(label="Moon Family 🌙", description="Mitglieder: 4957", value="partner1")
        dropdown.add_option(label="Team Mind", description="Mitglieder: 13044", value="partner2")

        view = discord.ui.View()
        view.add_item(dropdown)

        async def dropdown_callback(dropdown_interaction, selected_values):
            selected_partner = selected_values[0]

            if selected_partner == "partner1":
                embed = discord.Embed(title=f"Moon Family", description="""
                
                
                ➥ *
                ➥ Kontakt : @MoonLight 🌙 
                ➥ Themen: Freunde finden, zocken, reden und Musik hören*


                 """, color=0x5c00c7)
                await dropdown_interaction.response.send_message(embed=embed, ephemeral=True)
            elif selected_partner == "partner2":
                embed = discord.Embed(title=f"Team Mind", description="""
                Über uns: 
                :: Wir sind eine Fortnite basierte Organisation, in Zusicht auf ein RL Bereich bei uns!
                :: Wir sind ein Server mit fast 13000 stolzen Mitgliedern.
                :: Das Management kümmert sich stets um die Probleme und Vorschläge, die hinzugefügt werden.
                 
                
                Was wir bieten:
                
                :: Direkte Arbeit zwischen unserem Management und unseren Spielern
                :: Direkter Support Kontakt
                :: Eigene Team Erstellungen
                :: Coachings/Spieler Förderung, 2x wöchentliches Training, jeder im Team kann mitmachen
                :: Spieler mit viel Interesse
                :: Aktive Mitglieder
                :: Teilnahme bei E-Sport Events z.B. Nitro League
                
                Was wir von euch erwarten:
                
                :: Kompetenter Umgang miteinander
                :: Einen Rang von mindestens Champion 2 für CW Team, ab GC1 CW Main Team
                :: Ein Mindestalter von 14
                :: Geistige Reife
                :: Absagen und Zusagen bei Besprechungen
                :: Zusammenhalt und Loyalität
                :: Aktives Verhalten
                
                Wir freuen uns auf dich und wünschen dir einen schönen Aufenthalt bei uns!


                 """, color=0x5c00c7)
                await dropdown_interaction.response.send_message(embed=embed, ephemeral=True)

        dropdown.callback = dropdown_callback
        await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
urban glen
#

Hääää, warum machst du ein dropdown in einem Button?

Mach doch eine View klasse, mit dem Dropdown und danns schick es einfach beim button drücken ab

jade sapphire
# obtuse estuary Also kannst du das auch mit interaction.respond machen oder halt auch in einem c...
    async def on_member_join(self,
                             member
                             ):
        embed = discord.Embed(
            title="Ein neuer Biker!",
            description=f"Willkommen {member.mention} auf BikersLife | DE, wir freuen uns das du da bist!",
            color=discord.Color.blue()
        )
        embed.set_footer(text="BikersLife Community Bot")
        channel = await self.bot.get_channel(1141257045413220392)
        await channel.send(embed=embed, view=WillView(self.bot))

def setup(bot):
    bot.add_cog(Welcome(bot))


class WillView(discord.ui.View):
    @discord.ui.button(label="Grüße", style=discord.ButtonStyle.green, emoji="✌")
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("Hey!")```
#

Also sollte es so aussehen?

urban glen
#

try it and see

jade sapphire
#
    def __init__(self):
        super().__init__()

        self.add_item(discord.ui.button(label="Klick mich!", custom_id="welcome_button"))

    @discord.ui.button(label="Klick mich!", custom_id="welcome_button")
    async def welcome_button(self, button, interaction, member):
        await interaction.response.send_message(f"{interaction.user} grüßt {member.mention}!")```
#

Unresolved reference 'View'

urban glen
#
    @commands.Cog.listener()
    async def on_member_join(self, member: discord.Member):
        embed = discord.Embed(
            title="Ein neuer Biker!",
            description=f"Willkommen {member.mention} auf BikersLife | DE, wir freuen uns das du da bist!",
            color=discord.Color.blue()
        )
        embed.set_footer(text="BikersLife Community Bot")
        channel = self.bot.get_channel(1141257045413220392)
        await channel.send(embed=embed, view=WillView(member))

def setup(bot):
    bot.add_cog(Welcome(bot))


class WillView(discord.ui.View):
    def __init__(self, member):
        self.member = member

    @discord.ui.button(label="Klick mich!", custom_id="welcome_button")
    async def welcome_button(self, button, interaction):
        await interaction.response.send_message(f"{interaction.user.mention} begrüßt {self.member.mention}")

@jade sapphire

#

Versuchs so

jade sapphire
#

discord.errors.ExtensionFailed: Extension 'cogs.welcome' raised an error: TypeError: module() takes at most 2 arguments (3 given)

#
Traceback (most recent call last):
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\yildi\PycharmProjects\BikersCommunity\cogs\welcome.py", line 20, in on_member_join
    channel = await self.bot.get_channel(1141257045413220392)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object TextChannel can't be used in 'await' expression```
solid ingot
#

ohne await

urban glen
#

Weiß er

#

Hab ihm im call schon gesagt

jade sapphire
#
    def __init__(self, member):
        super().__init__()
        self.member = member

    @discord.ui.button(label="Grüße", custom_id="welcome_button")
    async def welcome_button(self, button, interaction, member):
        await interaction.message.edit(view=self)
        await interaction.response.edit_message(f"{interaction.member.mention} grüßt {self.member.mention}!")```
urban glen
#
class WillView(discord.ui.View):
    def __init__(self, member):
        super().__init__(timeout=None)
        self.member = member

    @discord.ui.button(label="Grüße", custom_id="welcome_button")
    async def welcome_button(self, button, interaction):
        button.disabled = True
        await interaction.message.edit(view=self)
        await interaction.response.send_message(f"{interaction.user.mention} grüßt {self.member.mention}!")
hard pivot
#
      for check_channel in check_channel_blacklist:
            
            if check_channel[1]:
            
                channel = bot.get_channel(check_channel[1])
                if channel.category.id == category.id:
                    
                    channel_list = [f"{Emojis.dot_emoji} <#{channel.id}>" if bot.get_channel(channel).category.id == category.id else None for channel in check_channel[1]]
                    channels = "\n".join(channel_list)```

Error:

Traceback (most recent call last):
File "C:\Users\larsl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\larsl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\commands\core.py", line 375, in invoke
await injected(ctx)
File "C:\Users\larsl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\commands\core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: 'int' object is not iterable
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000002B4C3C4C1F0>```
weiß wer was das Problem ist

last depot
#
Traceback (most recent call last):
  File "c:\Users\felix\Desktop\Ticket Bot Felix\main.py", line 58, in <module>
    bot.load_cogs("cogs")
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ezcord\bot.py", line 213, in load_cogs
    self.load_extension(f"{'.'.join(path.parts)}.{name}")
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\cog.py", line 910, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\cog.py", line 783, in _load_from_module_spec
    raise errors.NoEntryPointError(key)
discord.errors.NoEntryPointError: Extension 'cogs.ticket' has no 'setup' function.
#

was heißt das ?

urban glen
last depot
urban glen
#

Du hast keine setup function in deinem cog wie es aussieht

last depot
#

ah jetzt gehts danke hab ich vergessen

urban glen
burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @severe citrus, du bist jetzt Level 20 🎉

Du hast insgesamt 2,254 Nachrichten geschrieben.

Du hast <@&1032922136068763718> erhalten!

last depot
#
@slash_command(guild_ids = servers, name="ticket-sendembed", description="🎫 Ticket Command | Sends the ticket embed")
@commands.has_permissions(administrator=True)
async def ticketsend(ctx, channel: Option(discord.TextChannel, description="In which channel should the embed be send?", required=False)):
    if channel is None:
        channel = ctx.channel

    embed = discord.Embed(title="\🎫 Create ticket", description="Here you can create an ticket and get support.", color=0x1067a3)
    embed.set_author(name="Side Roleplay", icon_url="https://cdn.discordapp.com/avatars/1132346221827194920/d54f7d70d2302e49278219c214554950.png?size=1024")
    embed.set_footer(text="Made by Felix", icon_url="https://cdn.discordapp.com/avatars/1132346221827194920/d54f7d70d2302e49278219c214554950.png?size=1024")
    embed.set_thumbnail(url="https://cdn.discordapp.com/avatars/1132346221827194920/d54f7d70d2302e49278219c214554950.png?size=1024")
    embed.set_image(url="https://cdn.discordapp.com/attachments/1132436690955403425/1132748384726437978/Side_Crimelife_Tickets_Banner.png")
    await channel.send(embed=embed, view=TicketOptions())
    await ctx.respond(f"> The ticket embed was successfully sent in {channel.mention}", ephemeral=True)

@ticketsend.error
async def error(ctx, error):
    if isinstance(error, MissingPermissions):
        await ctx.respond(f"> You don't have the perms for that! Missing Permissions: ``Administrator``", ephemeral=True)
    else:
        await ctx.respond("There was an error. Please contact the server owner!", ephemeral=True)
        raise error
#

der slash command wird nicht angezeigt

solid ingot
#

ist er richtig eingerückt?

last depot
#

ah stimmt

#

ich gucke mal

silk slate
#

Boys brauche dringend Hilfe. Kann keine Slash commands mehr verwenden. Ganz normale Prefix commands gehen. Ich konnte sie bis eben problem frei benutzen, aber jetzt eben nicht mehr

vivid sky
silk slate
#

Ja

#

die Prefix schon

restive herald
silk slate
#

aber Slash commands gehen sowie in der Main als auch in cogs nicht..

vivid sky
silk slate
#

gibt eben kein Fehler.

#

Also ja natürlich aber nur im Discord. ("Die Anwendung reagiert nicht")

#

Ich habe einen Command, in dem etwas in eine Json datei geschrieben wird. (Slash Command) Aber selbst da , schreibt er garnicht in die Json was... Also ich weiß wirklich nicht wo das Problem liegt

last depot
ruby sparrow
jade sapphire
#

Jungs eine frage undzwar mein Code erkennt nicht mehr die random XP die man durch 1 nachricht bekommt

#
    def get_level(xp):
        lvl = 1


        while True:
            xp -=100
            if xp < 0:
                return lvl
            lvl += 1


    @commands.Cog.listener()
    async def on_ready(self):
        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                """
                CREATE TABLE IF NOT EXISTS users (
                user_id INTEGER PRIMARY KEY,
                msg_count INTEGER DEFAULT 0,
                xp INTEGER DEFAULT 0
                )
                """
            )

    @commands.Cog.listener()
    async def on_message(self, message):
        xp = random.randint(10, 20)

        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                "INSERT OR IGNORE INTO users (user_id) VALUES (?)", (message.author.id,)
            )
            await db.execute(
                "UPDATE users SET msg_count = msg_count + 1,xp = xp + ? WHERE user_id = ?", (xp, message.author.id,)
            )
            await db.commit()

    @slash_command()
    async def rang(self, ctx):
        async with aiosqlite.connect(self.DB) as db:
            async with db.execute("SELECT msg_count, xp FROM users WHERE user_id = ?", (ctx.author.id,)) as cursor:
                result = await cursor.fetchone()
                if result is None:
                    await ctx.respond("Du bist noch nicht im System", ephemeral=True)
                    return
                msg_count, xp = result


                xp = result[0]
                lvl = self.get_level(xp)


            await ctx.respond(f"Du hast {msg_count} Nachrichten verschickt und hast {xp} XP gesamt. Du  bist zurzeit Level {lvl}")
#

Das ist mein code

solid ingot
#

was meinst du mit "nicht erkennen"? schick den code am besten als python codeblock

jade sapphire
#

Es gibt nun nurnoch 1 XP pro nachricht

solid ingot
jade sapphire
#

Ja

#
@staticmethod
    def get_level(xp):
        lvl = 1


        while True:
            xp -=100
            if xp < 0:
                return lvl
            lvl += 1


    @commands.Cog.listener()
    async def on_ready(self):
        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                """
                CREATE TABLE IF NOT EXISTS users (
                user_id INTEGER PRIMARY KEY,
                msg_count INTEGER DEFAULT 0,
                xp INTEGER DEFAULT 0
                )
                """
            )

    @commands.Cog.listener()
    async def on_message(self, message):
        xp = random.randint(10, 20)

        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                "INSERT OR IGNORE INTO users (user_id) VALUES (?)", (message.author.id,)
            )
            await db.execute(
                "UPDATE users SET msg_count = msg_count + 1,xp = xp + ? WHERE user_id = ?", (xp, message.author.id,)
            )
            await db.commit()

    @slash_command()
    async def rang(self, ctx):
        async with aiosqlite.connect(self.DB) as db:
            async with db.execute("SELECT msg_count, xp FROM users WHERE user_id = ?", (ctx.author.id,)) as cursor:
                result = await cursor.fetchone()
                if result is None:
                    await ctx.respond("Du bist noch nicht im System", ephemeral=True)
                    return
                msg_count, xp = result


                xp = result[0]
                lvl = self.get_level(xp)


            await ctx.respond(f"Du hast {msg_count} Nachrichten verschickt und hast {xp} XP gesamt. Du  bist zurzeit Level {lvl}")
jade sapphire
solid ingot
#

das mit der staticmethod hat gar nichts mit den XP zu tun

#

die XP werden bei on_message berechnet

last depot
#

eine kurze frage was bedeutet das

#
Ignoring exception in view <TicketOptions timeout=None children=1> for item <Ticket type=<ComponentType.string_select: 3> placeholder='Choose your ticket reason here.' min_values=1 max_values=1 options=[<SelectOption label='Teambewerbung' value='Teambewerbung' description='Open an Teambewerbungs ticket here.' emoji=<PartialEmoji animated=False name='ps_support' id=1120008742256251051> default=False>, <SelectOption label='Support' value='Support' description='Open an support ticket here' emoji=<PartialEmoji animated=False name='ps_buy' id=1120009767272845323> default=False>, <SelectOption label='Fraktionsantrag' value='Fraktionsantrag' description='Open an fraktionsantrag ticket here' emoji=<PartialEmoji animated=False name='ps_ipchange' id=1120009768757637183> default=False>] channel_types=[] disabled=False>:
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\felix\Desktop\Ticket Bot Felix\cogs\ticket.py", line 90, in callback
    category = self.get_channel(int(get_config("Buy_Category")))
AttributeError: 'Ticket' object has no attribute 'get_channel'
safe tendon
#

hmm

solid ingot
#

self ist immer die aktuelle klasse, in der du dich befindet. diese klasse hat aber keine get_channel methode. du möchtest wahrscheinlich sowas wie bot.get_channel. in einem cog geht das zb mit self.bot.get_channel

safe tendon
#

abow timo oder was

last depot
#
Ignoring exception in view <TicketOptions timeout=None children=1> for item <Ticket type=<ComponentType.string_select: 3> placeholder='Choose your ticket reason here.' min_values=1 max_values=1 options=[<SelectOption label='Teambewerbung' value='Teambewerbung' description='Open an Teambewerbungs ticket here.' emoji=<PartialEmoji animated=False name='ps_support' id=1120008742256251051> default=False>, <SelectOption label='Support' value='Support' description='Open an support ticket here' emoji=<PartialEmoji animated=False name='ps_buy' id=1120009767272845323> default=False>, <SelectOption label='Fraktionsantrag' value='Fraktionsantrag' description='Open an fraktionsantrag ticket here' emoji=<PartialEmoji animated=False name='ps_ipchange' id=1120009768757637183> default=False>] channel_types=[] disabled=False>:
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\felix\Desktop\Ticket Bot Felix\cogs\ticket.py", line 127, in callback
    category = self.bot.get_channel(int(get_config("Support_Category")))
AttributeError: 'Ticket' object has no attribute 'bot'
#

jz kommt das

odd kiteBOT
#

Mein Discord Server
https://discord.gg/zfvbjTEzv6

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Mein Hosting* ► https://tidd.ly/3gJufg6
Code auf Github ► https://github.com/tibue99/tutorial-bot

PYCORD
Docs ► https://docs.pycord.dev/
Guide ► https://guide.pycord.dev/introduction/
Discord Server ► https://discord.gg/pycord

Discord Developer Portal ► https://discord...

▶ Play video
ruby sparrow
#

@last depot

urban glen
last depot
urban glen
solid ingot
#

wenn du self.bot nutzen willst, musst du den bot erst an die klasse übergeben. ansonsten kannst du interaction.client nutzen

urban glen
solid ingot
#

in den meisten fällen ist interaction.client ausreichend, ja

jade sapphire
last depot
#

wie definiere ich das?

fierce dove
#

Hast du self.bot definiert

urban glen
fierce dove
#

oben in der init Methode

self.bot = bot

last depot
# urban glen Hm? Schick mal deinen Code#
from pydoc import describe
import discord
import asyncio
import json
import os
from discord.ext import commands
from discord.commands import Option
from discord.ext.commands import MissingAnyRole
from discord.ext.commands import MissingPermissions
from discord.commands import slash_command, Option


import io
import requests
import chat_exporter

def get_config(name):
    with open("config.json", "r") as f:
        json_file = json.load(f)
        return json_file[name]
    
intents = discord.Intents.all()
intents.members = True
intents.messages = True





servers = [int(get_config("Guild_ID"))]



class TicketDropCommand(commands.Cog):
    def init(self, bot):
        self.bot = bot
        self.bot.add_view(TicketOptions(self))
        self.bot.add_view(CloseButton(self))
        self.bot.add_view(ReopenButton(self))
        self.bot.add_view(SelectView(self))





#----------------------------------------------TICKET SYSTEM----------------------------------------------#

    @slash_command(
        name="ticket-sendembed",
        description="🎫 Ticket Command | Sends the ticket embed",
    )
    @commands.has_permissions(administrator=True)
    async def ticketsend(ctx, channel: Option(discord.TextChannel, description="In which channel should the embed be send?", required=False)):
        if channel is None:
            channel = ctx.channel

        embed = discord.Embed(
            title="\🎫 Create ticket",
            description="Here you can create a ticket and get support.",
            color=0x1067a3
        )
        embed.set_author(name="Side Crimelife", icon_url="https://example.com/your_icon.png")
        embed.set_footer(text="Made by Felix", icon_url="https://example.com/your_footer_icon.png")
        embed.set_thumbnail(url=self.bot.user.display_avatar.url)
        embed.set_image(url=self.bot.user.display_avatar.url)

        await channel.respond(embed=embed, view=TicketOptions())
     

    @ticketsend.error
    async def ticketsend_error(self, ctx, error):
        if isinstance(error, MissingPermissions):
            await ctx.send(f"> You don't have the permissions for that! Missing Permissions: ``Administrator``", ephemeral=True)
        else:
            await ctx.send("There was an error. Please contact the server owner!", ephemeral=True)
            raise error
urban glen
#

Du hast das self in der ticketsend function vergessen

jade sapphire
#

    @staticmethod
    def get_level(xp):
        lvl = 1
        amount = 100

        while True:
            xp -= amount
            if xp < 0:
                return lvl
            lvl += 1
            amount += 100


    @commands.Cog.listener()
    async def on_ready(self):
        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                """
                CREATE TABLE IF NOT EXISTS users (
                user_id INTEGER PRIMARY KEY,
                msg_count INTEGER DEFAULT 0,
                xp INTEGER DEFAULT 0
                )
                """
            )

    @commands.Cog.listener()
    async def on_message(self, message):
        xp = random.randint(10, 20)

        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                "INSERT OR IGNORE INTO users (user_id) VALUES (?)", (message.author.id,)
            )
            await db.execute(
                "UPDATE users SET msg_count = msg_count + 1 WHERE user_id = ?", (message.author.id,)
            )
            await db.execute(
                "UPDATE users SET xp = xp + ? WHERE user_id = ?",(xp, message.author.id)
            )
            await db.commit()

    @slash_command()
    async def rang(self, ctx):
        async with aiosqlite.connect(self.DB) as db:
            async with db.execute("SELECT msg_count, xp FROM users WHERE user_id = ?", (ctx.author.id,)) as cursor:
                result = await cursor.fetchone()
                if result is None:
                    await ctx.respond("Du bist noch nicht im System", ephemeral=True)
                    return
                msg_count, xp = result

            xp = result[0]
            lvl = self.get_level(xp)




            await ctx.respond(f"Du hast {msg_count} Nachrichten verschickt und hast {xp} XP gesamt. Du bist zurzeit Level {lvl}")


def setup(bot):
    bot.add_cog(Levelsystem(bot))```
#

Leute ich habe ein kleines problem undzwar im code habe ich bestimmt das pro nachricht der User immer 10-20 XP bekommen sollte. Das klappt auch wenn ich im Datenbank nachschaue, jedoch zeigt mir Discord an, wenn ich /rang ausführe, dass der User pro nachricht immer nur 1 XP bekommt. Hier ist mein Code: Woran kann es liegen?

solid ingot
#

du zeigst in discord den message count an statt den XP

novel ore
#

Bin mir nicht sicher glaub aber bei XP = result[0] muss result[1]

jade sapphire
fierce dove
#
    @staticmethod
    def get_level(xp):
        lvl = 1
        amount = 100

        while xp >= amount:
            xp -= amount
            lvl += 1
            amount += 100

        return lvl

    @commands.Cog.listener()
    async def on_ready(self):
        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                """
                CREATE TABLE IF NOT EXISTS users (
                user_id INTEGER PRIMARY KEY,
                msg_count INTEGER DEFAULT 0,
                xp INTEGER DEFAULT 0
                )
                """
            )

    @commands.Cog.listener()
    async def on_message(self, message):
        if message.author.bot:
            return

        xp = random.randint(10, 20)

        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                "INSERT OR IGNORE INTO users (user_id) VALUES (?)", (message.author.id,)
            )
            await db.execute(
                "UPDATE users SET msg_count = msg_count + 1 WHERE user_id = ?", (message.author.id,)
            )
            await db.execute(
                "UPDATE users SET xp = xp + ? WHERE user_id = ?", (xp, message.author.id)
            )
            await db.commit()

    @commands.slash_command()
    async def rang(self, ctx):
        async with aiosqlite.connect(self.DB) as db:
            async with db.execute("SELECT msg_count, xp FROM users WHERE user_id = ?", (ctx.author.id,)) as cursor:
                result = await cursor.fetchone()
                if result is None:
                    await ctx.respond("Du bist noch nicht im System", ephemeral=True)
                    return
                msg_count, xp = result

            lvl = self.get_level(xp)

            await ctx.respond(f"Du hast {msg_count} Nachrichten verschickt und hast {xp} XP gesamt. Du bist zurzeit Level {lvl}")


def setup(bot):
    bot.add_cog(Levelsystem(bot))
#

Hier

solid ingot
#

du solltest auf @novel ore hören

novel ore
jade sapphire
#

Basti was hast du denn beim code verändert?

fierce dove
# fierce dove ```python @staticmethod def get_level(xp): lvl = 1 amoun...

In der Metode get_level() habe ich die Bedingung in der Schleife geändert um sicherzustellen das das XP-Threshold richtig berechet wird

In der Methode on_message() habe ich ein Überprüfung hinzugefügt um sicherzustellen dass die XP nicht für Nachrichten von Bots gezählt werden

In der Methode rang() habe ich den Variablennamen xp korrigiert um auf das XP-Attribut aus der datenbank zuzugreifen

storm seal
#

!

urban glen
#

!

jade sapphire
fierce dove
#

!

urban glen
last depot
urban glen
#

Du brauchst self als ersten parameter in deiner ticketsend function

last depot
urban glen
#

Nein

#
async def ticketsend(self, ctx, channel: Option(discord.TextChannel, description="In which channel should the embed be send?", required=False)):
#

So schwer is es nicht

last depot
#

ahhhhhhhhhhhh

urban glen
#

Wie heißt nochmal die "sprache" beim Codeblock womit die schrift in hellblau ist?

last depot
#

lua`?

urban glen
#
rawr
#

danke

#

rawr
#

ne bei lua wirds nicht

urban glen
last depot
#

ka

urban glen
#

yo

last depot
#
dkjsdik
urban glen
#

Ich weiß durch text kopieren yk

last depot
#
    @slash_command(
        name="ticket-sendembed",
        description="🎫 Ticket Command | Sends the ticket embed",
    )
    @commands.has_permissions(administrator=True)
    async def ticketsend(self, ctx, channel: Option(discord.TextChannel, description="In which channel should the embed be send?", required=False)):
        if channel is None:
            channel = ctx.channel

        embed = discord.Embed(
            title="\🎫 Create ticket",
            description="Here you can create a ticket and get support.",
            color=0x1067a3
        )
        embed.set_author(name="Side Crimelife", icon_url="https://example.com/your_icon.png")
        embed.set_footer(text="Made by Kawi", icon_url="https://example.com/your_footer_icon.png")
        embed.set_thumbnail(url=self.bot.user.display_avatar.url)
        embed.set_image(url=self.bot.user.display_avatar.url)

        await channel.respond(embed=embed, view=TicketOptions(),  ephemeral=True)
#
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 1167, in on_interaction
    await self.process_application_commands(interaction)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 848, in process_application_commands   
    await self.invoke_application_command(ctx)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 1118, in invoke_application_command    
    await ctx.command.dispatch_error(ctx, exc)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 412, in dispatch_error       
    await injected(cog, ctx, error)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 112, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: Messageable.send() got an unexpected keyword argument 'ephemeral'
#

was ist das problem ?

novel ore
#

Das ephemeral=True

urban glen
#

Und du kannst in einen channel nix responden

#

wenn nur senden. und wenn du was in einen channel schickst kann es nd ephemeral sein nur wenn du respondest

#

wenn du mich fragst wie dann ist mein kopf kaputt 💀

last depot
#

stimmt ich responde eine andere nachricht

novel ore
#

Einfach das channel mit ctx austauschen dann geht es

jade sapphire
#

bist auch nicht der beste, ich auch nicht andere auch nicht. Manchmal hat man schon fragen also chill dich mal, er hat nur was gefragt egal ob dev, anfänger oder profi

urban glen
safe tendon
urban glen
#

weis wer welches modul ich dazu benötige? util.plugins.common

tawdry leaf
urban glen
#

python

jade sapphire
#

@solid ingot Gibt es ein Tutorial für KeksHosting? Und nh frage, ist es kostenlos?

solid ingot
#

eine anleitung findest du in #💻・cookie-hosting

last depot
#
 @slash_command(
        name="ticket-sendembed",
        description="🎫 Ticket Command | Sends the ticket embed",
    )
    @commands.has_permissions(administrator=True)
    async def ticketsend(self, ctx, channel: Option(discord.TextChannel, description="In which channel should the embed be send?", required=False)):
        if channel is None:
            channel = ctx.channel

        embed = discord.Embed(
            title="\🎫 Create ticket",
            description="Here you can create a ticket and get support.",
            color=0x1067a3
        )
        embed.set_author(name="Side Crimelife", icon_url="https://example.com/your_icon.png")
        embed.set_footer(text="Made by Kawi", icon_url="https://example.com/your_footer_icon.png")
        embed.set_thumbnail(url=self.bot.user.display_avatar.url)
        embed.set_image(url=self.bot.user.display_avatar.url)

        erfolg = discord.Embed(
            title="Ticket System erfolgreich erstellt!"
        )

        await channel.send(embed=embed, view=TicketOptions())
        await ctx.respond(embed=erfolg, ephemeral=True)
       
#

was ist da falsch

#
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 1167, in on_interaction
    await self.process_application_commands(interaction)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 848, in process_application_commands   
    await self.invoke_application_command(ctx)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 1118, in invoke_application_command    
    await ctx.command.dispatch_error(ctx, exc)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 412, in dispatch_error       
    await injected(cog, ctx, error)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 112, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: Messageable.send() got an unexpected keyword argument 'ephemeral'
#

bekomm eimmer noch den error

jade sapphire
#

Soll ich meinen ganzen Code da rein tun? Oder wie

jade sapphire
#

ohaaaaa

#

wie? soll ich dann direkt auf der webseite coden oder was

fierce dove
#

Hab ich auch

jade sapphire
#

ja dann muss ich jedes mal wenn ich etwas verbessere oder code es in die webseite eintragen?

novel ore
#

kannst du talk denn erklär ich es

jade sapphire
#

kann grad nicht

novel ore
#

ok

jade sapphire
#

kannste später?

novel ore
#

muss schauen

tawdry leaf
jade sapphire
tawdry leaf
# jade sapphire wasn?

Also der bot läuft über das panel da auf der website dann und da musst du eveb deb code immer aktualisieren

last depot
tawdry leaf
#

schau auf die Schreibweise

fierce dove
#

Wie kann man ein choice setzen in ezcord bin gerade dumm

odd kiteBOT
tawdry leaf
#

anscheinend gibt es des nd

#

also wie normal in py-cord

last depot
#
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 1167, in on_interaction
    await self.process_application_commands(interaction)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 848, in process_application_commands   
    await self.invoke_application_command(ctx)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 1118, in invoke_application_command    
    await ctx.command.dispatch_error(ctx, exc)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 412, in dispatch_error       
    await injected(cog, ctx, error)
  File "C:\Users\felix\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 112, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: Messageable.send() got an unexpected keyword argument 'ephemeral'
fierce dove
#
@Option("timee", description="gebe die zeit an", choices["60 Sekunden", "5 Minuten", "1 Stunde", "1 Tag", "1 Woche", "14 Tage"])
                                                                                                                                   ^
SyntaxError: positional argument follows keyword argument

The above exception was the direct cause of the following exception:
#
@slash_command()
    @Option("grund", description="Warum wird der User getimeoutet")
    @Option("user", description="Warum wird der User getimeoutet")
    @Option("timee", description="gebe die zeit an", choices["60 Sekunden", "5 Minuten", "1 Stunde", "1 Tag", "1 Woche", "14 Tage"],)
    async def timeout(self, ctx, member: discord.Member, grund: str, timee: str):
limpid wolf