#Allgemeine Hilfe

1 messages · Page 32 of 1

dense magnet
#

ik

vivid sky
#

ja

dense magnet
#

Aber ist schon ironisch nach der aussage xd

urban glen
#

dann warte weiter

#

Oder hat das grad was mit help zutun?

vivid sky
#

Cric Eartman

urban glen
vivid sky
#

ok Cric Eartman

tawdry leaf
#

sowas schreibst du dann und brauchst dabei hilfe xD

vivid sky
urban glen
tawdry leaf
#

wait

vivid sky
#

Link button?

urban glen
#

In wiefern, "ins on ready"?

Du machst nen link button und schickst ihn irgendwo halt ab

tawdry leaf
#

Link Button weiß man was gemeint ist Bobby

urban glen
vivid sky
urban glen
vivid sky
#

ja macht der doch sowieso

#

ein "Link button"

tawdry leaf
#
server = discord.ui.Button(label="Support Server", url="link")```
#

und eben dann noch view.add_item(server)

#

ja ich auch xD

urban glen
#

Asso persistent

tawdry leaf
#

🤔

solid ingot
#

url buttons sind automatisch persistant

urban glen
#

Idk ignorier das

tawdry leaf
#

ein easteregg zum 1.april

urban glen
#

Also, wie timo sagte, sind die Buttons wohl automatisch persistent

Aber wenn du andere Buttons hast, die du persistent machen möchtest, kannst du dich hier orientieren

tawdry leaf
#

wow

vivid sky
burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @vivid sky, du bist jetzt Level 12 🎉

Du hast insgesamt 607 Nachrichten geschrieben.

urban glen
#

Maschine 💪

tawdry leaf
#
urban glen
ruby sparrow
obtuse estuary
#

Leuudeee nicht hier

ruby sparrow
#

weiss einer die mehr button machen

umbral goblet
ruby sparrow
#

also wie kann man bei ein code mehr button machen

umbral goblet
#

einfach mehrere buttons in ein view machen

crude heath
#

Und die view dann in die msg packen

urban glen
#

geht bei mir nicht

ruby sparrow
urban glen
#

,,

#

hat nicht bei dir gunktioniert brd

#

kann ich irgendiwe mehr als ein bot auf einem server hosten?

#

z.B. bei .env :

TOKEN = ASIJDIUASHDJOUAI SHDUHASVZDHASCZDNZSCD, ASUDHAUHSDUAIHSDUOAHUSIDHAS

#

halt ein komma machen

#

Du kannst mit deinem Coden nur einen Bot runnen

umbral goblet
umbral goblet
crude heath
umbral goblet
#

weiss jeamdn was da los ist? ```Traceback (most recent call last):
File "C:\Users\Pfist\PycharmProjects\NoePixel\venv\lib\site-packages\discord\cog.py", line 774, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\Pfist\PycharmProjects\NoePixel\cogs\ticket.py", line 90, in <module>
class UserChoiceView(discord.ui.View()):
File "C:\Users\Pfist\PycharmProjects\NoePixel\venv\lib\site-packages\discord\ui\view.py", line 183, in init
loop = asyncio.get_running_loop()
RuntimeError: no running event loop

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

Traceback (most recent call last):
File "C:\Users\Pfist\PycharmProjects\NoePixel\main.py", line 21, in <module>
bot.load_extension(f"cogs.{filename[:-3]}")
File "C:\Users\Pfist\PycharmProjects\NoePixel\venv\lib\site-packages\discord\cog.py", line 910, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\Pfist\PycharmProjects\NoePixel\venv\lib\site-packages\discord\cog.py", line 777, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.ticket' raised an error: RuntimeError: no running event loop```

urban glen
urban glen
#

Wie mache ich das so das in ein ModalTextFeld nur zahlen geschrieben werden?

solid ingot
#

das kannst du leider nur prüfen, nachdem der user auf senden gedrückt hat

urban glen
#

Code:

   @slash_command(description="make the bot say something")
    @commands.has_permissions(administrator=True)
    async def say(self, ctx, Title, Text):
    embed = discord.Embed(
            title=f"{Title}",
            description=f"{Text}",
            color=discord.Color.red()
        )

        await ctx.respond(embed=embed)```
Error:
```IndentationError: expected an indented block after function definition on line 12
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/main.py", line 21, in <module>
    bot.load_extension(f"cogs.{filename[:-3]}")
  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 910, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 777, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.Custom' raised an error: IndentationError: expected an indented block after function definition on line 12 (Custom.py, line 13)```
umbral goblet
#

@commands.has_permissions(administrator=True) ist falsch eingerückt

urban glen
#

ups

#

nein

#

sieht nur so bei discord aus

umbral goblet
#

ah ok

urban glen
crude heath
#

Das embed ein tab nach rechts

umbral goblet
#

ja stimmt

crude heath
#

Bzw alles bei embed

ruby sparrow
umbral goblet
#

alles nach say() eins rechts

urban glen
crude heath
#

Also von embed = bis await Ctx.respond nach rechts

#

Des is kein Tab ig

umbral goblet
crude heath
umbral goblet
urban glen
#

okay danke

crude heath
#

Jmd Bock mir zu erklären wir Modals funktionieren?

#

Also wie man die Codes und auf das was die beinhaltet bekommt? Xd

urban glen
#

Wieso wird das callback vom modal nd respondet?

    @discord.ui.button(label="Loslegen", style=discord.ButtonStyle.gray, emoji=f"🎈", custom_id="loslegen", row=2)
    async def button_callback3(self, button, interaction):
        with open('accounts.json', 'r', encoding='utf-8') as f:
            accounts = json.load(f)
        if str(interaction.user.id) in accounts:
            await interaction.response.send_message("Du hast bereits einen Account.", ephemeral=True)
            return
        else:
            await interaction.response.send_modal(accountmodal(title="Account erstellen"))
ruby sparrow
# urban glen
import discord
from discord.ext import commands
from discord.commands import slash_command


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

    @slash_command(description="make the bot say something")
    @commands.has_permissions(administrator=True)
    async def text(self, ctx, title, text):
        embed = discord.Embed(
            title=f"{title}",
            description=f"{text}",
            color=discord.Color.red()
        )

        await ctx.respond(embed=embed)


def setup(bot):
    bot.add_cog(Test(bot))``` hier ist er fix
umbral goblet
#

da kannst du runterkopieren und auf deine bedürfnisse anpassen du musst dann ein paar zusammenhänge knüpfen und dann kannst du machen was du willst

crude heath
urban glen
ruby sparrow
umbral goblet
ruby sparrow
umbral goblet
#

aber probier doch einfach mal ein bisschen rum und frag wen etwas nicht geht

crude heath
burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @crude heath, du bist jetzt Level 11 🎉

Du hast insgesamt 653 Nachrichten geschrieben.

urban glen
urban glen
crude heath
#

Hatte ich auch… haste in der view davor noch mehr Button? Also in der class

ruby sparrow
urban glen
urban glen
crude heath
urban glen
crude heath
ruby sparrow
ruby sparrow
urban glen
crude heath
#

Samma warum ist dein about fast so wie meins? @ruby sparrow

#

Das seh ich jtzt nd ein

tawdry leaf
crude heath
#

Du hast 1 Wort verändert sussypeepo

umbral goblet
#

wie kann ich einen user permissions zu einem channel geben?

crude heath
umbral goblet
#

ne später

tawdry leaf
umbral goblet
#

ok danke

crude heath
urban glen
umbral goblet
#

hat sich erledigt

tawdry leaf
#

Ok

urban glen
#

wie kann man auf die jetzige zeit zugreifen?

tawdry leaf
#

datetime.datetime.now()

urban glen
#

muss ich dafür was importieren?

crude heath
#

Ja datetime

#

Also eif import datetime

urban glen
#

jo danke mach ich dann morgen 👍

tawdry leaf
#

Und wenn du es dir leichter machen magst noch From datetime Import datetime dann musst du nur Datetime.now schreiben

tawdry leaf
#

kd 🙂

solid ingot
#

unterstrich statt .

ruby sparrow
#
import discord
from discord.ext import commands
from discord.commands import slash_command

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


    @slash_command(name="bosttime", descriptime="zeigt dir die Boostzeit an!")
    async def boostime(self, ctx):
        boostzeit = ctx.author.premium_since
        if boostzeit is None:
            await ctx.respond(content="du hast keinen Boost!")
        else:
            boostzeit = ctx.author.premium_since
            boostzeit = boostzeit.strftime("%d.%m.%Y %H:%M:%S")
            await ctx.respond(content=f"dein Boost läuft bis zun:{boostzeit}")

def setup(bot):
    bot.add_cog(Boostime(bot))``` hier hab dem code gefix
#

weiss ein wie kann man so was in embeds machen

normal sundial
#
        if result2 == 0:
            @commands.has_permissions(administrator=True)
            embed = discord.Embed(
                title="Level system Deaktiviert!",
                description="Aktiviere das Levelsystem für den Befehl.",
                color=discord.Color.red()

            )
            embed.set_thumbnail(url=self.bot.user.avatar.url)
            await ctx.respond(embed=embed)

        if result2 == 1:
            desc = ""
            counter = 1
            async with aiosqlite.connect(self.DB) as db:
                async with db.execute(
                        "SELECT user_id, guild_name, xp FROM users WHERE msg_count > 0 ORDER BY xp DESC LIMIT 3"
                ) as cursor:
                    async for user_id, guild_name, xp in cursor:
                        if guild_name == ctx.guild:
                            desc += f"{counter}.<@{user_id}> - {xp} XP\n"
                            counter += 1
                        else:
                            print("keine rankings gefunden")

            embed = discord.Embed(
                title="Rangliste",
                description=desc,
                color=discord.Color.yellow()

            )
            embed.set_thumbnail(url=self.bot.user.avatar.url)
            await ctx.respond(embed=embed)

Expected function or class declaration after decorator

tawdry leaf
#

wann ist result 0 oder 1

urban glen
solid ingot
#

mit einer if bedingung

#

zB mit .isdigit

tawdry leaf
#

ob es integer ist oder wenn nur Zahlen

normal sundial
# tawdry leaf wann ist result 0 oder 1

wenn du mich meinst das wird asu der datenbank gelsen und über buttons eingestellt aber das ist ja nciht der punkt sondern das nach dem @commands... die funktion erwartet wird

tawdry leaf
#

🤨

normal sundial
tawdry leaf
normal sundial
#

naja der result null ist ein wert aus der datenbank und ich möchte wenn er null ist das user den befehl nicht ausführen können

tawdry leaf
#

Und wieso kommt der Wert aus der db kannst den doch einf mit if member.has_permissions machen 🤨

normal sundial
#

der wert hat mit den permissions nichts direkt zu tun der ist für einen allgemeinen check nötig aber der has permissions ist die frage gewesen

normal sundial
normal sundial
#

weil passiert gar nichts ausser das member keine has_permissions hat

tawdry leaf
#

Hm eig schon

normal sundial
#

hast du in den docs eine nverweis drauf grade zur hand?

tawdry leaf
#

Ne ich gehe schlafen

normal sundial
#

na dann nicht nacht.

#

kann mir wer anderes helfen?

solid ingot
#

schau evtl mal hier

normal sundial
#

da ist es immernoch nicht so drinnen wie ich es brauche hatten wir gestern ja schonmal das thema xD

#

es soll nach der if abfrage im slash command asugeführt werden xD

#

denn wenn die andere bedingung erfüllt wird soll code ausgeführt werden xD

solid ingot
#

gibt mehrere Möglichkeiten, schau Mal in den Docs bei member (guild_permission) oder bei permission_for

normal sundial
#

also bei guild permission werdeichnicht schlau was die id ziffern sind die als ausgabe zurück kommen xD also wüsste ich nicht wie ich die abgleichen soll xD

solid ingot
#

schau dir Mal an von welchen Typ die Rückgabe ist

normal sundial
#

permissions zummindes im permission_for

#

aber im guild_permissions steht nichts bei

solid ingot
#

zur not kannst du dir den Typ auch immer Printen lassen in Python

#

dann kannst du in den Docs nachschauen, was du mit diesem Typ machen kannst

normal sundial
#

aber was ich nicht ganz verstehe ist wie würde ich das nun prüfen

solid ingot
#

schau Mal in den Docs was du alles mit dem Typ "permission" machen kannst

normal sundial
#

naja könnte sie abgleichen aber da steht mir nich eindeutig genug wie ich das prüfe denn es bringt mir ja nichts wenn da random buchstaben abgeglichen werden muss ja wissen wie die gegenseite auszusehen hat

solid ingot
#

wieso random Buchstaben? ich bin nicht ganz sicher, welche Gegenseite du meinst, aber schau Mal was es dort alles für Attribute gibt, die kannst du alle nutzen

normal sundial
#

also ich bekomme angezeigt das es diese klasse gibt bei permissions . class discord.Permissions(permissions=0, **kwargs)

#

da gehen diese vergleiche x == y Checks if two permissions are equal.

#

aber das bringt mir nichts da ich nicht weiss was ich vor dem fragezeichen eingeben soll da egal was ich wie eingebe nichts klappt

solid ingot
#

welches Fragezeichen? schau dir lieber die Attribute an

normal sundial
#

sorry meinte gleichzeichen

#

ich versteh einfach nicht was x sein soll und was y

solid ingot
#

nanana

#

Attribute anschauen

#

nicht die Vergleiche

#

das ist nur wenn du 2 permission Objekte vergleichen willst

#

so bin aber jetzt auch schlafen, gute Nacht peepowave

normal sundial
#

gute nacht

#

besteht die möglichkeit wenn ein user eine gewisse permission nicht erfüllt den befehl unsichtbar zu machen also dass er ihn nicht angezeigt bekommt? also per code nicht integration.

umbral goblet
#

Kann man in einem modal als input einen user verlangen?

urban glen
umbral goblet
urban glen
#

nein das geht nicht

umbral goblet
#

schade

ruby sparrow
#

weiss wie geht das ?

obtuse estuary
#

Das macht discord bei viel benutzen Befehlen selber

#

Glaub ich

solid ingot
solid ingot
ruby sparrow
solid ingot
#

ab 75 servern

ruby sparrow
normal sundial
solid ingot
#

nur wenn der User die Berechtigung nicht hat

normal sundial
#

genau und dass soll ja nicht immer so sein weil ich müsste ja mit berechtigungen arbeiten die nicht für normale user gedacht sind verstehst du wie ich meine

#

ok anders es soll so sein das der status aus der datenbank genommen wird ist er 0 soll der befehl unsichtbar sein und nur admins können den sehen und wenn der1 ist sollen ihn die user nutzen können.

solid ingot
#

wüsste nicht wie das geht

normal sundial
#

ok mies schade danke

urban glen
#

Brauch ich für nen musik command Youtube api oder so?

#

Oder Youtube generel importen?

burnt prairieBOT
#

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
ruby sparrow
urban glen
#

error:

  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 774, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/container/cogs/Custom.py", line 6, in <module>
    class Test(commands.Cog):
  File "/home/container/cogs/Custom.py", line 22, in Test
    @command.has_permissions(administrator=True)
NameError: name 'command' is not defined. Did you mean: 'commands'?
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/main.py", line 22, in <module>
    bot.load_extension(f"cogs.{filename[:-3]}")
  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 910, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 777, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.Custom' raised an error: NameError: name 'command' is not define```

Code: 
```py
   @slash_command(description="Clear an amount of messages")
    @command.has_permissions(administrator=True)
    async def clear(self, ctx, amount):
     
         await ctx.channel.purge(limit=amount)
         await ctx.respond(f"Cleared {amount} messages")
#

ups hab bei den permissions ein s vergessen

#

Application Command raised an exception: TypeError: '>' not supported between instances of 'str' and 'int'

#

hm

umbral goblet
ruby sparrow
urban glen
ruby sparrow
#
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\cog.py", line 774, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 936, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1074, in get_code
  File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\Rysii\OneDrive\Desktop\ZyroFN bot\cogs\AutoDelete.py", line 14
    if isinstance(message.author, discord.Member):
    ^
IndentationError: expected an indented block after 'if' statement on line 12

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

Traceback (most recent call last):
  File "C:\Users\Rysii\OneDrive\Desktop\ZyroFN bot\main.py", line 149, in <module>
    bot.load_extension(f"cogs.{filename[:-3]}")
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\cog.py", line 910, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\cog.py", line 777, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.AutoDelete' raised an error: IndentationError: expected an indented block after 'if' statement on line 12 (AutoDelete.py, line 14)
#
import asyncio

import discord
from discord.ext import commands

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

    @commands.Cog.listener()
    async def on_message(self, message):
        if message.channel.id == (108779928507829871):
        if isinstance(message.author, discord.Member):
            # Überprüfen, ob das Mitglied eine bestimmte Rolle hat
            role = discord.utils.get(message.guild.roles, name='[Community]')
            if role in message.author.roles:
                # Löschen der Nachricht
                await asyncio.sleep(3)
                await message.delete()

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


#

kann wer helfen

solid ingot
#

schau dir am besten ein grundlegendes Tutorial zu If Bedingungen in Python an, bzw schau dir die einrückung bei python an

crude heath
urban glen
#

Ignoring exception in on_connect
Traceback (most recent call last):
File "C:\Users\mahzz\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 378, in _run_event
await coro(*args, **kwargs)
File "C:\Users\mahzz\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1164, in on_connect
await self.sync_commands()
File "C:\Users\mahzz\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 738, in sync_commands
app_cmds = await self.register_commands(
File "C:\Users\mahzz\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 531, in register_commands
prefetched_commands = await self._bot.http.get_guild_commands(
File "C:\Users\mahzz\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 365, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access

solid ingot
#

du hast wahrscheinlich bei debug_guilds eine server ID angegeben, auf die der bot keinen zugriff hat

urban glen
#

ups hast recht timo 👍

urban glen
#

code ist im error

#

Hast du dem Bot eine Dm geschrieben?

#

Weil wenn du ihm eine Dm Nachricht schickst, dann gibt es keine message.guild

urban glen
urban glen
urban glen
#

Richtig. Überprüfen ob es dms sind

urban glen
#

Wie

#

das tutorial zu den pycord docs hat mir wenig geholfen sry

#

Denk mal bisschen nach...

#
if not message.guild:
    return

Ist das so schwer? lmao

solid ingot
umbral goblet
tawdry leaf
#

reicht einmal xD

umbral goblet
urban glen
#

immer noch der gleiche error 💀

umbral goblet
urban glen
tawdry leaf
urban glen
urban glen
urban glen
#

So schwer is des nd zu googlen manchmal

tawdry leaf
umbral goblet
urban glen
urban glen
urban glen
# tawdry leaf ne brauche den ganzen

hier:

    @commands.Cog.listener()
    async def on_message(self, message):
        if not message.guild:
            return
        lvl5 = discord.utils.get(message.guild.roles, id=1034925220002017280)
        lvl10 = discord.utils.get(message.guild.roles, id=1034925534523695215)
        lvl20 = discord.utils.get(message.guild.roles, id=1034925953434001489)
        lvl30 = discord.utils.get(message.guild.roles, id=1034926492112654417)
        lvl40 = discord.utils.get(message.guild.roles, id=1034926920481112095)
        lvl50 = discord.utils.get(message.guild.roles, id=1034927048902320148)
        if message.author.bot:
            return
        with open('accounts.json', 'r', encoding='utf-8') as f:
            accounts = json.load(f)
        if message.author.id in accounts and message.author.id not in data:
            data[str(message.author.id)]["credits"] = 0
            data[str(message.author.id)]["message_count"] = 0
urban glen
umbral goblet
tawdry leaf
#

aua

urban glen
umbral goblet
#

@urban glen mach mal am anfang py try: dummy = message.guild except: #den code, den du ausführen willst, wenn eine dm kommt #den code wenn keine dm kommt

urban glen
#

try & excepts pepecry
Ich heule gleich

tawdry leaf
urban glen
#

Meiner Meinung nach sollte man try / except's so oft vermeiden, wie möglich xD

urban glen
urban glen
umbral goblet
urban glen
#

if & else ist doch eig. das gleiche oder

#

hab keine ahnung weil ich try & except noch nie eingesetzt hab

umbral goblet
#

@urban glen mach mal das was ich geschickt habe oben

umbral goblet
umbral goblet
urban glen
#

Gibt halt sehr viele Menschen die try und except blöcke falsch verwenden

#

also lvl5 = discord.utils.get(dummy.guild.roles, id=1034925220002017280)
... so oder? @umbral goblet

umbral goblet
#

ja aber in diesem kontext sind sie sehr sinnvoll

urban glen
#

Vorallem ```py
except:
pass

urban glen
solemn musk
urban glen
umbral goblet
#
 @commands.Cog.listener()
    async def on_message(self, message):
        try:
          dummy = message.guild
        except:
          # code der ausgeführt werden soll wenn eine dm gesendet wurde und nicht eine nachricht auf dem server
          return
        lvl5 = discord.utils.get(message.guild.roles, id=1034925220002017280)
        lvl10 = discord.utils.get(message.guild.roles, id=1034925534523695215)
        lvl20 = discord.utils.get(message.guild.roles, id=1034925953434001489)
        lvl30 = discord.utils.get(message.guild.roles, id=1034926492112654417)
        lvl40 = discord.utils.get(message.guild.roles, id=1034926920481112095)
        lvl50 = discord.utils.get(message.guild.roles, id=1034927048902320148)
        if message.author.bot:
            return
        with open('accounts.json', 'r', encoding='utf-8') as f:
            accounts = json.load(f)
        if message.author.id in accounts and message.author.id not in data:
            data[str(message.author.id)]["credits"] = 0
            data[str(message.author.id)]["message_count"] = 0```
urban glen
#

danke probier ich jz aus

umbral goblet
#

aber message.guild existiert nicht

urban glen
tawdry leaf
#

Noe logischerweise ist es dann false true

#

weil not guild true ist

#

bis eine guild es ist

urban glen
#

@urban glen probierst du den Code auch auf nem Server?

umbral goblet
#

oder verstehe ich da was falsch

urban glen
#

Einiges.

umbral goblet
urban glen
#

if not message.guild:
-> true (wenn eine guild nicht existiert / NoneType zurückgegeben wird)
-> false (wenn eine guild existiert)

urban glen
umbral goblet
umbral goblet
urban glen
#

Wenn none ist, dann existiert keine Guild
Sein on_message wird noch irgendwo anders getriggert, außerhalb eines servers

urban glen
urban glen
#

@umbral goblet hat tatsächlich funktioniert danke 👑

urban glen
#

weiß immer noch nicht wozu dieses dummy dienen soll aber ja

        try:
          dummy = message.guild
umbral goblet
urban glen
#

okay

#

✅ if & else
❌ try & except

umbral goblet
#

andersrum

umbral goblet
urban glen
umbral goblet
#

genau

solid ingot
#

datetime

urban glen
#

danke

solid ingot
#

mcdonalds peeposhy

tawdry leaf
#

oder aufm Stück Salami 😮

urban glen
#
                zeit = datetime.now()
                accounts[str(interaction.user.id)] = {"username": self.children[0].value, "password": self.children[1].value, "created_at": f"{zeit}"}
tawdry leaf
#

from datetime import datetime

urban glen
solemn musk
#

weiss wer was ich mit ein discord bot und api machen kann

solemn musk
vivid sky
cloud cedar
#
PS C:\Users\Ich\Downloads\Files\Bot> & C:/Users/Ich/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/Users/Ich/Downloads/Files/Bot/main.py
Traceback (most recent call last):
  File "c:\Users\Ich\Downloads\Files\Bot\main.py", line 2, in <module>
    from discord.commands import Option
  File "C:\Users\Ich\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\__init__.py", line 27, in <module>
    from .core import *
  File "C:\Users\Ich\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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\Ich\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\enums.py)```
Was hab ich da falsch installiert?
Mit pip krieg ich`s nicht gefixt
quiet socket
#

Filtere ich so nach Tags?

mental hamlet
#

müsste bei discord.Thread irgendwo in den docs stehen

#

.applied_tags

silk gulch
#

Wie kann ich denn einen zweiten Button definieren? Mit await channel.send(embed=embed, view=DeleteButton(), Button2()) geht es ja leider nicht.
Bitte Ping bei Antwort 🙂

#

Danke, hat sich schon wer gemeldet. 😄

mental hamlet
#

musst die in ein View machen

urban glen
#

fortnite

#

fortntie

urban glen
#

fortnite

mystic flower
#
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: no such column: user```
#
async def addwarn(ctx, reasom, user, mod):
    db = await aiosqlite.connect("warns.db")
    async with db.cursor() as cursor:
        await cursor.execute("INSERT INTO warns VALUES (?, ?, ?, ?), (user, reason, time, mod)")
    await db.commit()```
#

Kann mir da wer helfen ?

solid ingot
#

deine tabelle hat keine user-spalte

mystic flower
#

Ok

mystic flower
#
async def addwarn(ctx, reason, user, mod):
    db = await aiosqlite.connect("warns.db")
    async with db.cursor() as cursor:
        await cursor.execute("INSERT INTO warns VALUES (?, ?, ?, ?), (user_id, reason, time, mod_id)", (user.id, reasom, datetime.datetime.now().timestamp(), mod.id))
    await db.commit()```
solid ingot
#

schau dir die syntax vom insert befehl nochmal genau an

mystic flower
#

OKAY

mystic flower
#
        db = await aiosqlite.connect("warns.db")
        async with db.cursor() as cursor:
            await cursor.execute("SELECT reason FROM warns WHERE user_id = ?", (member.id))
            data = await cursor.fetchone()```
```sql
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near "=": syntax error```
mystic flower
solid ingot
#

es muss auf jeden fall ein komma hinter member.id

safe tendon
ruby sparrow
ruby sparrow
cloud cedar
ruby sparrow
#

ne

#

sry

#

timo hat da aus ein yt video gemacht

ruby sparrow
solid ingot
#

stell am besten direkt deine frage, wenn du nur so etwas fragst weiß niemand ob er dir helfen kann oder nicht

burnt prairieBOT
cloud cedar
ruby sparrow
urban glen
#

fortnite

ruby sparrow
solemn musk
solemn musk
#

und zeig den output

cloud cedar
#

sekunde

#

hab dir gesendet

mental hamlet
#

ja

#

ig.

solemn musk
#

@cloud cedar Shreib hier weiter

cloud cedar
#

was jetzt

solemn musk
urban glen
cloud cedar
#

Code: ```py
import discord
from discord.ext import commands
from discord.commands import slash_command, Option
import aiosqlite
class warn(commands.Cog):
def init(self, bot):
self.bot = bot

@commands.Cog.listener()
async def on_ready(self):
    async with aiosqlite.connect("warns.db") as db:
        await db.execute(
            """
            CREATE TABLE IF NOT EXISTS users(
            user_id INTEGER PRIMARY KEY,
            warn_count INTEGER DEFAULT 0
            )
            
            
            
            
            """
        )
@slash_command(description = "Warne einen User")
async def warn(self, ctx, message, user: Option(discord.member), reason: Option(str, "Warum?")):
    async with aiosqlite.connect("warns.db") as db:
        await db.execute(
            "INSERT OR IGNORE INTO users (user_id) VALUES (?)", (user.id,)
            )
        await db.execute(
            "UPDATE users SET warn_count = warn_count + 1 WHERE user_id = ?", (user.id)
        )
        await db.commit()
    embed = discord.Embed(title="Verwarnung", color=discord.Color.brand_red(), description=(f"{user} wurde verwarnt!"))
    ctx.respond(embed = embed, ephemeral = True)

def setup(bot):
bot.add_cog(warn(bot))```

ERROR:
angehängte.txt

solid ingot
#

gar nicht, du kannst aber mehrere elemente zu einem view hinzufügen

solid ingot
cloud cedar
#

JA ER IST ONLINE!!! danke

burnt prairieBOT
#
Keks-Überweisung

@cloud cedar hat @solid ingot 10 keks geschenkt!

Teemo hat jetzt 13,096 keks

solid ingot
mystic flower
#
async def addwarn(ctx, reason, user, mod):
    db = await aiosqlite.connect("warns.db")
    async with db.cursor() as cursor:
        await cursor.execute("INSERT INTO warns (user_id, reason, time, mod_id) VALUES (?, ?, ?, ?)", (user.id, reason, datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), mod.id))
        await cursor.execute("UPDATE warns SET warn_count = warn_count + 1 WHERE user_id = ?", (user.id))
    await db.commit()```

```py
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: ValueError: parameters are of unsupported type```
umbral goblet
mystic flower
#

warte

#
Ignoring exception in on_application_command_error
Traceback (most recent call last):
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "E:\Community Bots\Own Community\cogs\warns.py", line 28, in warn
    await addwarn(ctx, reason, member,  ctx.author)
  File "E:\Community Bots\Own Community\cogs\warns.py", line 71, in addwarn
    await cursor.execute("UPDATE warns SET warn_count = warn_count + 1 WHERE user_id = ?", (user.id))
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\cursor.py", line 37, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\cursor.py", line 31, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 137, in _execute
    return await future
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 110, in run
    result = function()
ValueError: parameters are of unsupported type

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

Traceback (most recent call last):
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\ezcord\bot.py", line 183, in _error_event
    raise error
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: ValueError: parameters are of unsupported type
umbral goblet
#
async def addwarn(ctx, reason, user, mod):
    db = await aiosqlite.connect("warns.db")
    async with db.cursor() as cursor:
        await cursor.execute("INSERT INTO warns (user_id, reason, time, mod_id) VALUES (?, ?, ?, ?)", (user.id, reason, datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), mod.id))
        await cursor.execute("UPDATE warns SET warn_count = warn_count + 1 WHERE user_id = ?", (user.id,))
    await db.commit()```das komma muss noch hin nach user.id
mystic flower
#

ok

#

ne geht ned

umbral goblet
#

neuer error?

mystic flower
#

nope

#
async def addwarn(ctx, reason, user, mod):
    db = await aiosqlite.connect("warns.db")
    async with db.cursor() as cursor:
        await cursor.execute("INSERT INTO warns (user_id, reason, time, mod_id) VALUES (?, ?, ?, ?)", (user.id, reason, datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), mod.id))
        await cursor.execute("UPDATE warns SET warn_count = warn_count + 1 WHERE user_id = ?", (user.id),)
    await db.commit()```

Ignoring exception in on_application_command_error
Traceback (most recent call last):
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 124, in wrapped
ret = await coro(arg)
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 978, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "E:\Community Bots\Own Community\cogs\warns.py", line 28, in warn
await addwarn(ctx, reason, member, ctx.author)
File "E:\Community Bots\Own Community\cogs\warns.py", line 71, in addwarn
await cursor.execute("UPDATE warns SET warn_count = warn_count + 1 WHERE user_id = ?", (user.id),)
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\cursor.py", line 37, in execute
await self._execute(self._cursor.execute, sql, parameters)
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\cursor.py", line 31, in _execute
return await self._conn._execute(fn, *args, **kwargs)
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 137, in _execute
return await future
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 110, in run
result = function()
ValueError: parameters are of unsupported type

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

Traceback (most recent call last):
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 378, in _run_event
await coro(*args, **kwargs)
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\ezcord\bot.py", line 183, in _error_event
raise error
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 375, in invoke
await injected(ctx)
File "C:\Users\pogod\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: ValueError: parameters are of unsupported type

umbral goblet
#

das komma muss eins weiter links

mystic flower
#

ohh habe das nicht gesehen

#

aber jetzt ist das so aber ich will das der nur den count updatet wie mache ich das ?

umbral goblet
#

du musst nur das untere statment ausführen weil das ober macht jedes mal eine neue zeile. also beim ersten war dann nur das erste und bei den anderen malen das 2

mystic flower
#

ok

umbral goblet
#

nein falsch beim ersten musst du

#

warte

mystic flower
#

jo

umbral goblet
#

INSERT OR IGNORE machen

mystic flower
#

ne macht immernoch mehr

umbral goblet
#

error

mystic flower
mystic flower
umbral goblet
#

code?

mystic flower
#
async def addwarn(ctx, reason, user, mod):
    db = await aiosqlite.connect("warns.db")
    async with db.cursor() as cursor:
        await cursor.execute("INSERT OR IGNORE INTO warns (user_id, reason, time, mod_id) VALUES (?, ?, ?, ?)", (user.id, reason, datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), mod.id))
        await cursor.execute("UPDATE warns SET warn_count = warn_count + 1 WHERE user_id = ?", (user.id,))
    await db.commit()```
umbral goblet
#

hast du die user_id als primary key festgelegt?

mystic flower
#

ne

umbral goblet
#

dann mach das

#

nur dann funktioniert es

mystic flower
umbral goblet
#

code

mystic flower
#

async def addwarn(ctx, reason, user, mod):
db = await aiosqlite.connect("warns.db")
async with db.cursor() as cursor:
await cursor.execute("INSERT OR IGNORE INTO warns (user_id, reason, time, mod_id) VALUES (?, ?, ?, ?)", (user.id, reason, datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), mod.id))
await cursor.execute("UPDATE warns SET warn_count = warn_count + 1 WHERE user_id = ?", (user.id,))
await db.commit()

umbral goblet
#

kannst du in dings machen

mystic flower
#

warte ich mache nochmal die db neu

umbral goblet
mystic flower
#

doch geht jetzt

#

danke

burnt prairieBOT
#
Keks-Überweisung

@mystic flower hat @umbral goblet 20 keks geschenkt!

Noé hat jetzt 3,606 keks

umbral goblet
# mystic flower danke

und nur noch das mit den reason funktioniert so nicht weil du kannst dan nur eine reason speichern

umbral goblet
mystic flower
#

ja

umbral goblet
mystic flower
#

ne jason ist dumm

#

dann egal

umbral goblet
umbral goblet
mystic flower
#

okay

ruby sparrow
#
Traceback (most recent call last):
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\bot.py", line 1164, in on_connect
    await self.sync_commands()
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\bot.py", line 719, in sync_commands
    registered_commands = await self.register_commands(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\bot.py", line 599, in register_commands
    registered = await register("bulk", data, _log=False)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 371, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 48: Application command names must be unique
``` weiss ein wo ist er error
umbral goblet
#

code?

ruby sparrow
#

es ist in kein code error

ruby sparrow
umbral goblet
#

ah du hast 2 commands mit dem selben namen

umbral goblet
ruby sparrow
umbral goblet
ruby sparrow
umbral goblet
#

er sagt ja application names must be unique

umbral goblet
ruby sparrow
umbral goblet
#

ja warte

ruby sparrow
#

denn zeig ich dir

umbral goblet
ruby sparrow
umbral goblet
#

scheisse

#

ey sry geht nicht

#

schau am besten einfach nochmal ob es irgendwelche funktionen gibt, die gleich heissen

ruby sparrow
#

💀

umbral goblet
#

ok aber jetzt gehts oder?

ruby sparrow
#

ja

umbral goblet
#

nice

ruby sparrow
#

junge aber warum

#

💀

umbral goblet
#

was warum

ruby sparrow
#

seit wann hatte ich mal dem gliech commad

#

🥲

umbral goblet
#

passiert machmal halt ausversehen

ruby sparrow
#

ja

#

stimmt

novel ore
#

wie heißt es in python wenn ich jemand timeouten will

ruby sparrow
novel ore
ruby sparrow
novel ore
#

warum fragst du das

ruby sparrow
novel ore
#

ne ich will denn ja nur timeouten weiß gerade aber nicht wie

ruby sparrow
novel ore
#

wie machst du das

quiet socket
solid ingot
novel ore
#

Ja hab schon gefunden bei mir ist es user.timeout

solid ingot
#

jo, gibt entweder user.timeout oder user.timeout_for

#

runde klammern hinter BoostTime()

silk gulch
#

Bei nem Levelsystem müsste man doch
if new_level != old_level:
abfragen, um einen Level-Up zu checken oder?

tawdry leaf
#

das sind einf 2 variablen

tawdry leaf
silk gulch
solid ingot
#

ja

#

da hab ich auch ein ganzes video zu :D

tawdry leaf
solid ingot
tawdry leaf
#

und geht bis 12:22

#

30 min raus gecuttet 🤔

#

bin für uncut video 🙂

silk gulch
cloud cedar
#
import discord
from discord.ext import commands
from discord.commands import slash_command, Option
import aiosqlite
class warn(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_ready(self):
        async with aiosqlite.connect("warns.db") as db:
            await db.execute(
                """
                CREATE TABLE IF NOT EXISTS users(
                user_id INTEGER PRIMARY KEY,
                warn_count INTEGER DEFAULT 0
                )
                
                
                
                
                """
            )
    @slash_command(description = "Warne einen User")
    async def warn(self, ctx, warnuser: Option(discord.Member)):
        async with aiosqlite.connect("warns.db") as db:
            await db.execute(
                "INSERT OR IGNORE INTO users (user_id) VALUES (?)", (warnuser.id,)
                )
            await db.execute(
                "UPDATE users SET warn_count = warn_count + 1 WHERE user_id = ?", (warnuser.id)
            )
            await db.commit()
        embed = discord.Embed(title="Verwarnung", color=discord.Color.brand_red(), description=(f"{warnuser.mention} wurde verwarnt!"))
        ctx.respond(embed = embed, ephemeral = True)



def setup(bot):
    bot.add_cog(warn(bot))```
Code



Error: ValueError: parameters are of unsupported type
solid ingot
#

komma hinter warnuser.id

cloud cedar
#

ach wegen tupel

#

danke

solid ingot
strange juniper
#

Mal 'ne Frage zu den Cooldowns. Im moment habe ich:

@commands.cooldown(1, 180, commands.BucketType.user)

Im Code.

Kann man das so abändern, dass der cooldown zwar userbezogen ist, sich allerdings auf einen Server beschränkt?
Also das jemand der meinen Bot auf 2 oder mehr servern hat das Command auf beiden Servern 1x ausführen kann und für beide unabhängige Cooldowns laufen?

normal sundial
#

wie kann man in einer funktion ausserhalb der cog klasse auf die guild zu greifen?

crude heath
#

Datenbank peeposhy

tawdry leaf
#

Die mitgeben 🤔

tawdry leaf
normal sundial
#

das meine ich nicht : ```py
async def result_check():
async with aiosqlite.connect(f"main.db") as db:
async with db.execute("SELECT levelactive FROM active WHERE guild_id = ?", (guild.id,)) as cursor:
print(ctx.guild.id)
result = await cursor.fetchone()
result2 = result[0]
if result2 == 0:
return True

das habe ich ausserhalb der klasse und wenn dies true wiedergibt wird ein slash command erstellt. aber offensichtlich fehlt mir die guild id wo der scuhen soll in der datenbank. und wie kann ich da jetzt drauf zu greifen?
tawdry leaf
#

na dann sag ma xD

normal sundial
#

ich weiss auch wieso aber wie löse ich das xD

crude heath
#

Ich denke mal, du insertest die Id mit nem on_guild_join Even… machst ja das was ich dir gezeigt habe

#

Und na klar is dann nichts in der nd wenn er nd neu auf Server gejoint ist

normal sundial
#

nein ich rede davon das der bei guild.id die guild id braucht um zu suchenwie greife ich darauf zu lasss die datenbank mal datenbank sein xD

crude heath
normal sundial
crude heath
#

kannst die guild id da nd bekommen

normal sundial
#

okay das ist meine frage gewesen wie kann ich das dann am besten machen?

crude heath
#

Naja ich hab’s ja gemacht das das erst getestet wird nachdem der Command ausgeführt wurde und wenn es deaktiviert ist kommt halt dann „levelsystem deaktiviert“ als ctx.respond

strange juniper
strange juniper
tawdry leaf
#

hm

umbral goblet
tawdry leaf
#

oder ein event 🙂

tawdry leaf
crude heath
#

Das macht doch niemand! (Ich auf dem Weg, das schnell zu coden:)

tawdry leaf
normal sundial
tawdry leaf
crude heath
crude heath
tawdry leaf
crude heath
#

Oder so ähnlich

tawdry leaf
#

idk

normal sundial
cloud cedar
#

Weiß wer wie man wenn ein command auf discord ausgeführt wird was mit nem raspberry pi machen kann?

strange juniper
strange juniper
tawdry leaf
#

dann hat er des doch trz auf beiden server

strange juniper
#

sollte nicht, ein user hat auf verschiedenen servern verschiedene user objekte

#

*member-objekte

#

also sollte er wenigstens.

#

steckt ja auch ne andere ID drinne

#

Ich gehe erstmal raus, überprüfe die These morgen.

tawdry leaf
#

okay

umbral goblet
#

gib einfach ein ich glaube nach gewisser zeiz wird man automatisch ausgelogt

novel ore
#

Wie kann man machen das man einen command ausführen kann und dann idt er gesperrt bis Sonntag 0 Uhr und dann kann man ihn wieder einmal ausführen und dann idt er wieder bis zum nächsten Sonntag gesperrt

solid ingot
#

evtl mit einer datenbank, wo du speicherst wer den command ausgeführt hast

novel ore
burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @novel ore, du bist jetzt Level 2 🎉

Du hast insgesamt 10 Nachrichten geschrieben.

Du hast <@&1042123300970696705> erhalten!

solid ingot
#

zum beispiel mit einem task loop

novel ore
#

Aber kann man denn nicht immer nur alle paar Stunden oder Tage ausführen und nicht zu bestimmten Uhrzeit oder

solid ingot
#

doch

novel ore
#

Ok danke

novel ore
#

Wie kann ich da denn Tag festlegen

solid ingot
#

das musst du innerhalb der methode machen

#

@novel ore

novel ore
#

Und das mach ich einfach i mein Task loop und lass es immer um 0uhr ausführen und wenn es Sonntag ist macht er es und sonst einfach nichts

thick haven
#

Also egal welches emoji forrmat ich nutze bekomem ich imme rdas

Traceback (most recent call last):
  File "C:\Users\jurek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\modal.py", line 324, in dispatch
    await value.callback(interaction)
  File "c:\Users\jurek\Documents\Development\Python\DC Bots\Xenority\Xenority-Main-Pycord-V2\cogs\verify.py", line 89, in callback
    emoji = await commands.PartialEmojiConverter().convert(None, self.children[2].value)
  File "C:\Users\jurek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\converter.py", line 839, in convert       
    raise PartialEmojiConversionFailure(argument)
discord.ext.commands.errors.PartialEmojiConversionFailure: Couldn't convert ":weary:" to PartialEmoji.
ROle Button
Ignoring exception in modal <cogs.verify.Add_URL_Button object at 0x00000240F96D37C0>:
Traceback (most recent call last):
  File "C:\Users\jurek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\modal.py", line 324, in dispatch
    await value.callback(interaction)
  File "c:\Users\jurek\Documents\Development\Python\DC Bots\Xenority\Xenority-Main-Pycord-V2\cogs\verify.py", line 89, in callback
    emoji = await commands.PartialEmojiConverter().convert(None, self.children[2].value)
  File "C:\Users\jurek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\converter.py", line 839, in convert       
    raise PartialEmojiConversionFailure(argument)
discord.ext.commands.errors.PartialEmojiConversionFailure: Couldn't convert ":weary:" to PartialEmoji.
1 Minute ist Um
1 Minute ist Um
Ignoring exception in modal <cogs.verify.Add_URL_Button object at 0x00000240F96D37C0>:
Traceback (most recent call last):
  File "C:\Users\jurek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\modal.py", line 324, in dispatch
    await value.callback(interaction)
  File "c:\Users\jurek\Documents\Development\Python\DC Bots\Xenority\Xenority-Main-Pycord-V2\cogs\verify.py", line 89, in callback
    emoji = await commands.PartialEmojiConverter().convert(None, self.children[2].value)
  File "C:\Users\jurek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\converter.py", line 839, in convert       
    raise PartialEmojiConversionFailure(argument)
discord.ext.commands.errors.PartialEmojiConversionFailure: Couldn't convert "<:weary:>" to PartialEmoji.
ROle Button
Ignoring exception in modal <cogs.verify.Add_URL_Button object at 0x00000240F97AC280>:
Traceback (most recent call last):
  File "C:\Users\jurek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\modal.py", line 324, in dispatch
    await value.callback(interaction)
  File "c:\Users\jurek\Documents\Development\Python\DC Bots\Xenority\Xenority-Main-Pycord-V2\cogs\verify.py", line 89, in callback
    emoji = await commands.PartialEmojiConverter().convert(None, self.children[2].value)
  File "C:\Users\jurek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\converter.py", line 839, in convert       
    raise PartialEmojiConversionFailure(argument)
discord.ext.commands.errors.PartialEmojiConversionFailure: Couldn't convert ":StatusOffline_xenority: " to PartialEmoji.```
**CODe**
```emoji = await commands.PartialEmojiConverter().convert(None, self.children[2].value)
        if emoji.is_custom_emoji:
            print("Ja")```
solid ingot
#

zur not kannst du emojis auch direkt im code nutzen, custom emojis mit der ID

thick haven
solid ingot
#

stimmt

#

ich kenne mich damit nicht aus, aber ich denke nicht dass man da einfach None reinschreiben kann bei ctx

#

habs mit nem context getestet, das funktioniert

mental hamlet
paper iris
#

ich bin mir nd sicher aber ich glaub du darfst am ende kein komma mehr setzen

urban glen
solid ingot
#

von discord components rate ich ab, pycord etc haben alles nötige dafür schon

novel ore
#

code:

from discord.ext import commands
import discord
from discord import slash_command, Member
from discord.ext import commands, tasks
from discord.commands import SlashCommandGroup
import aiosqlite
import random

from datetime import time, timezone, datetime

class Lotto(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.DB = "casino.db"


    @commands.Cog.listener()
    async def on_ready(self):
        self.lotto.start()
        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                """
                CREATE TABLE IF NOT EXISTS lotto (
                user_id INTEGER PRIMARY KEY,
                money INTEGER DEFAULT 0,
                zahl1 INTEGER,
                zahl2 INTEGER,
                zahl3 INTEGER,
                zahl4 INTEGER,
                zahl5 INTEGER,
                last_reset TIMESTAMP DEFAULT CURRENT_TIMESTAMP
                )
                """
            )

ich möchte in dem on_reeady event meinen loop starten aber wenn ich denn Bot starte kommt dieser Error

#
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\Basti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Basti\PycharmProjects\CC×System\cogs\casino\lotto.py", line 19, in on_ready
    self.lotto.start()
AttributeError: 'SlashCommandGroup' object has no attribute 'start'
```
umbral goblet
novel ore
umbral goblet
#

also in dem cog

novel ore
#

ja da ist noch mehr

umbral goblet
#

ja dan schick in doch auch

#

also alles in dieser klasse

novel ore
#

    async def check_user(self, user_id):
        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                "INSERT OR IGNORE INTO lotto (user_id) VALUES (?)", (user_id,)
            )
            await db.commit()

    @tasks.loop(
        time=time(18, 16, 0, tzinfo=timezone.utc)
    )
    async def lotto(self):
        day = datetime.now().strftime("%A")
        if day == "Sunday":
            print("Sunday")
            zahl1 = random.randint(1, 49)
            zahl2 = random.randint(1, 49)
            zahl3 = random.randint(1, 49)
            zahl4 = random.randint(1, 49)
            zahl5 = random.randint(1, 49)


    lotto = SlashCommandGroup("lotto")

    @lotto.command()
    async def zahlen(self, ctx, lotto1: int, lotto2: int, lotto3: int, lotto4: int, lotto5: int):
        await self.check_reset()
        await self.check_user(ctx.author.id)

        if lotto1 < 0 or lotto1 > 50 or lotto2 < 0 or lotto2 > 50 or lotto3 < 0 or lotto3 > 50 or lotto4 < 0 or lotto4 > 50 or lotto5 < 0 or lotto5 > 50:
            await ctx.respond("Bitte gib eine Zahl zwischen 1 und 49 ein!")
            return

        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                "UPDATE lotto SET zahl1 = ?, zahl2 = ?, zahl3 = ?, zahl4 = ?, zahl5 = ? WHERE user_id = ?",
                (lotto1, lotto2, lotto3, lotto4, lotto5, ctx.author.id)
            )
            await db.commit()

            await ctx.respond(f"Deine Zahlen wurden gespeichert!")

def setup(bot):
    bot.add_cog(Lotto(bot))
umbral goblet
novel ore
#

aber es ist ja da

novel ore
umbral goblet
novel ore
umbral goblet
#

ah ja der ist ja im zweiten code teil habe ich nicht gesehen

novel ore
#

ach so

novel ore
umbral goblet
#

kannst du mal screenshot vom ganzen ncode schicken

novel ore
umbral goblet
# novel ore

ja die slashcommandgroup kann nicht glecih heissen wie der task die heissen beide lotto

novel ore
#

ah ok

umbral goblet
#

gehts?

novel ore
burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @novel ore, du bist jetzt Level 3 🎉

Du hast insgesamt 28 Nachrichten geschrieben.

umbral goblet
novel ore
# umbral goblet nein gerade nicht sry aber schreib doch eifach

in dem code setz ich ja die lotto zahlen und das können ganz viele user machen halt alle auf dem server und ich möchte jetzt das am Sonntag um 0 Uhr random eine zahl von 1-49 genommen wird. Das hab ich schon abeer wie kann ich jetzt überprüfen welcher user genau diese Zahl hat und dem dann das geld geben!

umbral goblet
shadow pebble
#

braucht jmd hilfe?

umbral goblet
novel ore
shadow pebble
umbral goblet
novel ore
#

ok ich versuch es mal

umbral goblet
#

ok

novel ore
#

    @tasks.loop(
        time=time(18, 49, 0, tzinfo=timezone.utc)
    )
    async def lotto_loop(self):
        day = datetime.now().strftime("%A")
        if day == "Sunday":
            print("Sunday")
            zahl1 = random.randint(1, 49)
            zahl2 = random.randint(1, 49)
            zahl3 = random.randint(1, 49)
            zahl4 = random.randint(1, 49)
            zahl5 = random.randint(1, 49)
            async with aiosqlite.connect(self.DB) as db:
                async with db.execute("Select user_id from lotto where zahl1 = ?", (zahl1,)) as cursor:
                    result = await cursor.fetchone()

sind jetzt in der result alle ids die die passende Zahl haben

umbral goblet
novel ore
#

hab ich noch nie gemacht und es geht

umbral goblet
#

ok ist mir neu aber wenn es geht

novel ore
umbral goblet
#

aber es checkt halt nur zahl1

novel ore
umbral goblet
#

ok nice

novel ore
# umbral goblet ok nice

wie kann ich eine spalte in der Tabelle auf 0 setzten bei allen User id ohne jede User id dafür erst zu getten

#

einfach das where weglassen?

umbral goblet
novel ore
# crude heath wie meinst du das?
                await db.execute("UPDATE lotto SET zahl1 = 0, zahl2 = 0, zahl3 = 0, zahl4 = 0, zahl5 = 0")
                await db.commit()

das soll für alle user_ids passieren

crude heath
#

ah du meinst das bei jedem user sozusagen die auf 0 gesetzt werden nh

crude heath
novel ore
crude heath
novel ore
#

ja

crude heath
novel ore
#

ka hab davor noch errors der code kommt nichtmal so weit xD

crude heath
#

wow

#

xD

#

soll es nur in einem server sein oder in allen

novel ore
#

einem

crude heath
#

würde ne for schleife machen

novel ore
#

Das ist der Loop wo ist da der fehler der Printet nur Sunday mehr nicht

crude heath
#

dann ist result1 None.

#

printe mal das result1

novel ore
umbral goblet
crude heath
crude heath
novel ore
#

2 aber nichtmehr

umbral goblet
crude heath
# novel ore ja

hmm wahrscheinlich sage ich jtzr was komplett dummes: mach mal vor jedes SELECT Dings nen async with aiosqlite.connect

novel ore
#

ne ist bestimmt wegen dem return

#

ja war wegen dem return

umbral goblet
crude heath
umbral goblet
#

ich muss sagen der bing chat ist echt nützlich

crude heath
#

xD

umbral goblet
# crude heath xD

ich muss nur nach oben scrollen nach dem suchen und er gibt mir antworten

tawdry leaf
#

if member is None:
member == ctx.author

crude heath
#

Member ist schließlich nd required

tawdry leaf
#

oder auf True xD

crude heath
shadow pebble
#

wenn man es auf der datenbank als user id speichert geht es sowieso glaube ich?

#

weil die datenbank ja dann wieder die gleiche user id endeckt

storm seal
urban glen
solid ingot
#

import re

urban glen
#

aso

solid ingot
urban glen
#

ich dachte namens re gibs kein import

#

diese slash commands haben schon eine differenzierung zu prefix

#

aber das geht noch?

#

kein wunder das ich nicht prefix mache

#

die haben alles anders

shadow pebble
urban glen
#

ok

solid ingot
#

sieht auf den ersten blick gut aus, wenn kein error kommt sollte es klappen

#

code?

shadow pebble
#

mit py bitte

#

sonst lösche ich prefix commands von ganz discord angrycat

#

und timo hilft mir dabei auf süß

#

dann gehen alle deine codes nicht mehr

#

du musst alles neu in slash_commands schreiben

solid ingot
#

mach mal prints und schau bis wohin der code ausgeführt wird

solid ingot
#

vlt wird die rolle nicht gefunden?

cloud cedar
#

wie kann ich bei dem rank command statt dem username den nickname anzeigen?

storm seal
#

@solid ingot du bist ja Bro deswegen frage ich gleich dich. Weiß du ob so etwas auch mit py-cord geht ?

solid ingot
#

ja das geht

#

einfach discord.Attachment als typ

mental hamlet
#

Jap

#

Professionelle Anleitung wie man richtig copy pastet:

  • you runterladen code
  • you fragen chatgpt nach requirements.txt
  • you betteln nach Hilfe
  • you bekommen errors
  • you bekommen keine errors mehr
  • you haben kopiert
tawdry leaf
#

Oder einfach eine gute Anleitung schreiben xD

storm seal
#

ihhh

tawdry leaf
mental hamlet
burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @mental hamlet, du bist jetzt Level 22 🎉

Du hast insgesamt 2,925 Nachrichten geschrieben.

mental hamlet
#

Jede lib hat ihre vor und Nachteile

tawdry leaf
mental hamlet
#

BRAUCHST ffmpeg

#

dann idk.

uneven zodiac
#

In der Datenbank gibt es begruessung nicht

#

Falsch geschrieben oder so

#

Schick nochmal Code hab das Problem auch manchmal

storm seal
uneven zodiac
#

Ja klar

cloud cedar
burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @cloud cedar, du bist jetzt Level 14 🎉

Du hast insgesamt 828 Nachrichten geschrieben.

tawdry leaf
vocal isle
tawdry leaf
urban glen
#

Warum wird nur der dritte Button angezeigt?

solid ingot
#

deine callback methoden müssen unterschiedlich heißen, bei dir heißen aktuell alle 3 methoden "button"

ruby sparrow
#
Traceback (most recent call last):
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\cogs\botinfo.py", line 19, in botinfo
    await ctx.respond(embed=embed)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\context.py", line 282, in respond
    return await self.interaction.response.send_message(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\interactions.py", line 825, in send_message
    await self._locked_response(
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\interactions.py", line 1090, in _locked_response
    await coro
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\webhook\async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

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

Traceback (most recent call last):
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\ezcord\bot.py", line 158, in _error_event
    raise error
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\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: NotFound: 404 Not Found (error code: 10062): Unknown interaction
Ignoring exception in on_application_command_error
Traceback (most recent call last):
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\cogs\ban.py", line 29, in on_application_command_error
    await ctx.respond(f"There has been an error: ```{error}```", ephemeral=True)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\context.py", line 282, in respond
    return await self.interaction.response.send_message(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\interactions.py", line 825, in send_message
    await self._locked_response(
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\interactions.py", line 1090, in _locked_response
    await coro
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\webhook\async_.py", line 221, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged.```
#

code :

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



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

    @slash_command(name="botinfo", description="Shows information about the bot.")
    async def botinfo(self,ctx):
        embed = discord.Embed(title="Bot Information", color=discord.Color.blurple())
        embed.set_thumbnail(url=ctx.bot.user.avatar.url)
        embed.add_field(name="Bot Name", value=ctx.bot.user.name, inline=True)
        embed.add_field(name="Bot ID", value=ctx.bot.user.id, inline=True)
        embed.add_field(name="Bot Created On", value=ctx.bot.user.created_at.strftime("%m/%d/%Y %H:%M:%S"), inline=True)
        embed.set_footer(text=f"Made by ama#0004", icon_url="https://cdn.discordapp.com/attachments/1090638128932462675/1098916204132962445/static_7.png")
        await ctx.respond(embed=embed)


def setup(bot):
    bot.add_cog(botinfo(bot))```
thick haven
#
    def __init__(self, ctx, message, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.message = message```
Wieso kann ich meine message in beim modal callback evrwenden message... geht nicht er findet das ned
obtuse estuary
#

Kannst du bitte deine Frage noch mal richtig stellen

thick haven
#

ich kann das message objekt nicht im callback nutzen weil es ned gefunden wird

solid ingot
#

wie meinst du das genau? kommt ein error? ist self.message None?

thick haven
#

Jetzt geht das ausm nix komsicha ebr gut, jetzt hääte ich noch ne frage kann ich irgnewie wenn ich eine view bearbeiten wenn eine view vorher vorhanden war adden so das ich sozusagen einen button zu den 2 anderen adden kann

solid ingot
#

view.add_item()

thick haven
#

und da einfach meinen button rein? richtig also den ich adden will

#

aber

#

wie kann ich die and4ere view bekommen?

solid ingot
#

welche?

thick haven
#

Naja ich will über kontaxt einen button an ne msg machen abe rich knn ja ned einfach view = view... amchen da ich da ja nur den einen button habe den ich im code habe aber was ist wenn ann der msg schon nen button hängt da will ich einen ádden und nicht den alten erstezten

solid ingot
#

an deiner message ist ein view. zu diesem view kannst du einen button hinzufügen, und dann die nachricht mit dem view bearbeiten

thick haven
tawdry leaf
#

Was machst du da 🫣

novel ore
#
import discord
from discord import slash_command
from discord.ext import commands, tasks
from datetime import time, timezone, datetime
import random

class verifizieren(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    
    @commands.Cogs.listerner()
    async def on_ready(self):
        self.verifizieren.start()


    @tasks.loop(
        time=time(22, 0, 0, tzinfo=timezone.utc)
    )
    async def verifizieren(self):
        random_number = random.randint(1, 100000)

    class Modal(discord.ui.Modal):
        def __init__(self, bot, *args, **kwargs):
            self.bot = bot
            super().__init__(
                discord.ui.InputText(
                    label="",
                    placeholder="Gebe hier die Zahl ein ",
                    style=discord.InputTextStyle.long
                ),
                *args,
                **kwargs
            )

        async def callback(self, interaction):
            try:
                await interaction.response.send_message(self.children[0].value)
            except:
                await interaction.response.send_message("Fehler")
                return

Wie kann ich die random_number an das Modal übergeben

limpid wolf
#

Schau dir das mal an da wird es erklärt wie man sachen übergibt

#

Aber ich frage mich warum du das in einem Task Loop hast?

novel ore
tawdry leaf
#

dazu hast du doch random

novel ore
#

ja und das soll er jede Nacht eine neue Zahl machen

#

deswegen der Task Loop

limpid wolf
# novel ore deswegen der Task Loop

Dafür brauchst du keinen Taskloop, generiere einfach immer eine neue Zahl wenn man auf den Button drückt oder was auch immer das Modal triggert

ruby sparrow
#
Traceback (most recent call last):
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\cogs\untime.py", line 14, in untimeout
    timeouts = await self.untimeout()
                     ^^^^^^^^^^^^^^^^
TypeError: ApplicationCommand.__call__() missing 1 required positional argument: 'ctx'

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

Traceback (most recent call last):
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\ezcord\bot.py", line 191, in _error_event
    raise error
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\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: TypeError: ApplicationCommand.__call__() missing 1 required positional argument: 'ctx'
Ignoring exception in on_application_command_error
Traceback (most recent call last):
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\cogs\untime.py", line 14, in untimeout
    timeouts = await self.untimeout()
                     ^^^^^^^^^^^^^^^^
TypeError: ApplicationCommand.__call__() missing 1 required positional argument: 'ctx'

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

Traceback (most recent call last):
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\cogs\ban.py", line 30, in on_application_command_error
    raise error
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\ezcord\bot.py", line 191, in _error_event
    raise error
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\Rysii\OneDrive\Desktop\Ama discord bot\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: TypeError: ApplicationCommand.__call__() missing 1 required positional argument: 'ctx'
#
import discord
from discord.ext import commands
from discord.commands import slash_command


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

    @slash_command(description="Untimeout")
    async def untimeout(self, ctx, member: discord.Member):
        timeouts = await self.untimeout()
        if member.id in timeouts:
            await self.remove_timeout(member.id)
            await ctx.send(f"{member.mention} wurde erfolgreich ent-timeoutet!")
        else:
            await ctx.send(f"{member.mention} ist nicht getimeoutet!")


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

kann wer helfen

solid ingot
#
timeouts = await self.untimeout()

was machst du mit der zeile?

ruby sparrow
#

oh fuck

ruby sparrow
#

:

#

oder komm das

novel ore
#
        async def callback(self, interaction):
            if self.children[0].value == str(self.zahl):
                role1 = interaction.guild.get_role(1100134956551901194)
                role2 = interaction.guild.get_role(1100852860280909874)
                role3 = interaction.guild.get_role(1100786285989343242)
                role4 = interaction.guild.get_role(1100850918733389845)
                role5 = interaction.guild.get_role(1100851004280406097)
                role6 = interaction.guild.get_role(1100851015005261874)
                role7 = interaction.guild.get_role(1100851040456298516)
                role8 = interaction.guild.get_role(1100851054012272680)
                if role1 in interaction.user.roles:
                    await interaction.user.remove_roles(role1)
                    await interaction.user.add_roles(role2, role3, role4, role5, role6, role7, role8)
                    await interaction.response.send_message("Du bist nun verifiziert")
                else:
                    await interaction.response.send_message("Du hast dich schon verifiziert")
            else:
                await interaction.response.send_message("Schau nochmal ob du die richtige Zahl eingegeben hast!")

error:

Ignoring exception in modal <cogs.verifizieren.verifizieren.verifizieren.Modal object at 0x000001B6126D9360>:
Traceback (most recent call last):
  File "C:\Users\Basti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\modal.py", line 341, in dispatch
    await value.callback(interaction)
  File "C:\Users\Basti\PycharmProjects\CC×System\cogs\verifizieren\verifizieren.py", line 42, in callback
    await interaction.user.add_roles(role2, role3, role4, role5, role6, role7, role8)
  File "C:\Users\Basti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 1007, in add_roles
    await req(guild_id, user_id, role.id, reason=reason)
AttributeError: 'NoneType' object has no attribute 'id'
ruby sparrow
novel ore
#

ich versteh nicht was der error aussagt

#

'NoneType' object has no attribute 'id'

ruby sparrow
solid ingot
urban glen
#

Ich bin davor mit easypil anzufangen, gibt es aber irgendein Trick wodurch man vereinfacht die position vom bild bekommt wo der text hin soll?

solid ingot
#

paint

urban glen
burnt prairieBOT
#
urban glen
solid ingot
#

doch

urban glen
#

lol

#

schau ich mir dann mal an

ruby sparrow
#
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\neu discord bot\cogs\test.py", line 15, in on_ready
    await db.execute(
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiosqlite\core.py", line 184, in execute
    cursor = await self._execute(self._conn.execute, sql, parameters)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiosqlite\core.py", line 129, in _execute
    return await future
           ^^^^^^^^^^^^
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiosqlite\core.py", line 102, in run
    result = function()
             ^^^^^^^^^^
sqlite3.OperationalError: table reports already exists```
#
import discord
from discord.ext import commands
from discord.commands import slash_command, Option
import aiosqlite

class warn(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.db = "report.db"


    @commands.Cog.listener()
    async def on_ready(self):
        async with aiosqlite.connect(self.db) as db:
            await db.execute(
                """
                CREATE TABLE reports (
                guild_id INT,
                user_id INT,
                modid INT,
                grund TEXT)
                """)
            await db.execute(
                """
                CREATE TABLE check (
                id INT PRIMARY KEY,
                serverid INT,
                count INT)
                """
            )

    @commands.Cog.listener()
    async def on_member_join(self, member):
        id = int(member.id+member.guild.id)
        async with aiosqlite.connect(self.db) as db:
            await db.execute("INSERT OR IGNORE INTO check (id, serverid, count) VALUES (?,?,0)", (id, member.guild.id))


    @slash_command(description="Warn a Member!")
    async def warn(self, ctx, user: Option(discord.User, "The User you want to warn"), reason: Option(int, "The Reason, why you want to warn the Member!")):


        async with aiosqlite.connect(self.db) as db:
            await db.execute("INSERT INTO reports (guild_id, user_id, modid, grund) VALUES (?,?,?;?)",
                             (ctx.guild.id, user.id, ctx.author.id, reason))
            await db.commit()
            await db.execute("UPDATE check SET count = count + 1 WHERE id = ?", (user.id+ctx.guild.id,))
            async with db.execute("SELECT count FROM check WHERE id = ?", (user.id+ctx.guild.id,)) as cursor:
                count = await cursor.fetchone()
                count2 = count[0]
                if count2 == 3:
                    await user.ban(reason="3x Warned")
                    await ctx.respond(f"{user.mention} got banned because he got 3x warned!", ephemeral=True)


            embed = discord.Embed(
                title="Warn",
                description=f"{user.mention} got warned!",
                color = discord.Color.random()
            )
            embed.add_field(name="`Warn-Reason`",value=f"**reason**")
            embed.add_field(name="`Responsible Moderator`",value=f"**{ctx.author.mention}**")
            embed.add_field(name="`Warned User`",value=f"**{user.mention}**")
            embed.set_author(name="PANTHEON")
            embed.set_footer(text="PANTHEON")
            embed.set_thumbnail(url=ctx.author.display_avatar_url)

            channel = await self.bot.get_channel("1100759291524304957")
            if channel == None:
                await ctx.respond("The Log-Channel is not valid, please insert it again! ", ephemeral=True)
            else:
                await ctx.respond(f"{user.mention} got warned!", ephemeral=True)
                await channel.send(embed=embed)



def setup(bot):
    bot.add_cog(warn(bot))```
lethal sequoia
solid ingot
#

begrueßung ist None, deswegen kannst du [0] nicht verwenden

#

None[0] geht nicht

#

prüfen ob es none ist

#

nope

#

also du solltest es natürlich prüfen bevor du [0] nutzt, denn das geht bei None nicht

crude heath
#

Ja. Dann musst du auch nicht mehr result = result[0]

#

Schreiben

#

Eif nur

msgcount, xp = await cursor.fetchone
indigo sapphire
#

guten nachmitag leute

wie bekomm ich den User#2133 ?
als beispiel.
ich möchte den user name und den tag bekommen

mental hamlet
indigo sapphire
#

Ty

ruby sparrow
#
Ignoring exception in on_application_command_error
Traceback (most recent call last):
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\neu discord bot\cogs\hshshs.py", line 19, in warn
    async with aiosqlite.connect(self.db) as db:
                                 ^^^^^^^
AttributeError: 'Mod' object has no attribute 'db'

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

Traceback (most recent call last):
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\ezcord\bot.py", line 191, in _error_event
    raise error
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'Mod' object has no attribute 'db'
Ignoring exception in on_application_command_error
Traceback (most recent call last):
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\neu discord bot\cogs\hshshs.py", line 19, in warn
    async with aiosqlite.connect(self.db) as db:
                                 ^^^^^^^
AttributeError: 'Mod' object has no attribute 'db'

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

Traceback (most recent call last):
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\OneDrive\Desktop\neu discord bot\cogs\ban.py", line 30, in on_application_command_error
    raise error
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\ezcord\bot.py", line 191, in _error_event
    raise error
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\Rysii\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'Mod' object has no attribute 'db'
#
import aiosqlite
import discord
from discord.ext import commands
import sqlite3
from discord.commands import slash_command
from discord.commands import Option

class Mod(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.conn = sqlite3.connect('database.db')
        self.cursor = self.conn.cursor()
        self.cursor.execute('''CREATE TABLE IF NOT EXISTS warns
                         (user_id TEXT, mod_id TEXT, reason TEXT)''')
        self.conn.commit()

    @slash_command()
    async def warn(self, ctx, user: Option(discord.User, "The User you want to warn"),reason: Option(int, "The Reason, why you want to warn the Member!")):
        async with aiosqlite.connect(self.db) as db:
            await db.execute("INSERT INTO reports (guild_id, user_id, modid, grund) VALUES (?,?,?;?)",(ctx.guild.id, user.id, ctx.author.id, reason))
            await db.commit()
            await db.execute("UPDATE checking SET count = count + 1 WHERE id = ?", (user.id + ctx.guild.id,))
            async with db.execute("SELECT count FROM checking WHERE id = ?", (user.id + ctx.guild.id,)) as cursor:
                count = await cursor.fetchone()
                count2 = count[0]
                if count2 == 3:
                    await user.ban(reason="3x Warned")
                    await ctx.respond(f"{user.mention} got banned because he got 3x warned!", ephemeral=True)

                    embed = discord.Embed(
                        title="Warn",
                        description=f"{user.mention} got warned!",
                        color=discord.Color.random()
                    )
                    embed.add_field(name="`Warn-Reason`", value=f"**reason**")
                    embed.add_field(name="`Responsible Moderator`", value=f"**{ctx.author.mention}**")
                    embed.add_field(name="`Warned User`", value=f"**{user.mention}**")
                    embed.set_author(name="PANTHEON")
                    embed.set_footer(text="PANTHEON")
                    embed.set_thumbnail(url=ctx.author.display_avatar_url)

                    channel = await self.bot.get_channel("1100759291524304957")
                    if channel == None:
                        await ctx.respond("The Log-Channel is not valid, please insert it again! ", ephemeral=True)
                    else:
                        await ctx.respond(f"{user.mention} got warned!", ephemeral=True)
                        await channel.send(embed=embed)
def setup(bot):
    bot.add_cog(Mod(bot))```
restive herald
#

du musst nen self.db. = "blabla.db"
hinzufügen

restive herald
#

na bei der class wo du auch self.bot = bot machst

restive herald
#

code

burnt prairieBOT
#
Level Up!

Herzlichen Glückwunsch @restive herald, du bist jetzt Level 7 🎉

Du hast insgesamt 194 Nachrichten geschrieben.

ruby sparrow
# restive herald code
import aiosqlite
import discord
from discord.ext import commands
import sqlite3
from discord.commands import slash_command
from discord.commands import Option

class Mod(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.db = "report.db"
        self.conn = sqlite3.connect('database.db')
        self.cursor = self.conn.cursor()
        self.cursor.execute('''CREATE TABLE IF NOT EXISTS warns
                         (user_id TEXT, mod_id TEXT, reason TEXT)''')
        self.conn.commit()


    @slash_command()
    async def warn(self, ctx, user: Option(discord.User, "The User you want to warn"),reason: Option(int, "The Reason, why you want to warn the Member!")):
        async with aiosqlite.connect(self.db) as db:
            await db.execute("INSERT INTO reports (guild_id, user_id, modid, grund) VALUES (?,?,?;?)",(ctx.guild.id, user.id, ctx.author.id, reason))
            await db.commit()
            await db.execute("UPDATE checking SET count = count + 1 WHERE id = ?", (user.id + ctx.guild.id,))
            async with db.execute("SELECT count FROM checking WHERE id = ?", (user.id + ctx.guild.id,)) as cursor:
                count = await cursor.fetchone()
                count2 = count[0]
                if count2 == 3:
                    await user.ban(reason="3x Warned")
                    await ctx.respond(f"{user.mention} got banned because he got 3x warned!", ephemeral=True)

                    embed = discord.Embed(
                        title="Warn",
                        description=f"{user.mention} got warned!",
                        color=discord.Color.random()
                    )
                    embed.add_field(name="`Warn-Reason`", value=f"**reason**")
                    embed.add_field(name="`Responsible Moderator`", value=f"**{ctx.author.mention}**")
                    embed.add_field(name="`Warned User`", value=f"**{user.mention}**")
                    embed.set_author(name="PANTHEON")
                    embed.set_footer(text="PANTHEON")
                    embed.set_thumbnail(url=ctx.author.display_avatar_url)

                    channel = await self.bot.get_channel("1100759291524304957")
                    if channel == None:
                        await ctx.respond("The Log-Channel is not valid, please insert it again! ", ephemeral=True)
                    else:
                        await ctx.respond(f"{user.mention} got warned!", ephemeral=True)
                        await channel.send(embed=embed)
def setup(bot):
    bot.add_cog(Mod(bot))```
restive herald
#

is das der ganze

ruby sparrow
#

ja

restive herald
#

du hast ja auch bei VALUES statt nem , nen ; gesetzt

ruby sparrow
restive herald
#

bei der erstem db connection wo du in reports guild id etc. insertest hast du bei VALUES vor dem letztem ? ein ; statt einem , gesetzt

ruby sparrow
#

könnst du kurz call?

silver rapids
mystic flower
#

wie kann ich einen task jeden tag um eine bestimmte Uhrzeit ausführen lassen ?

old ore
#

Hallo leute ich bräuchte hilfe bei etwa . undzwar wenn ich in meinem Ticketsystem 2 ticket systeme erstelle schickt es in das was als erstes erstellt wurde message und in das 2te nicht. es schickt per dm zwar das es den channel createt hat aber danach geht es nicht weiter

Hier der code:

msg = await interaction.user.send(f"![Loading](https://cdn.discordapp.com/emojis/833101350623117342.webp?size=128 "Loading") Creating your Ticket (Usually takes 2-4 Seconds)...")

            ticket = await interaction.guild.create_text_channel(
                name=ticket_name.replace("{user}", str(interaction.user.name)), 
                category=discord.utils.get(interaction.guild.categories, id=category_id), topic=f"📨 Ticket for {interaction.user.name} | Createt at {time.strftime('%d.%m.%Y | %H:%M:%S')}")
            
            await ticket.set_permissions(interaction.guild.default_role, view_channel=False, send_messages=False)
            if role1 != "0":
                await ticket.set_permissions(
                    discord.utils.get(interaction.guild.roles, id=role1),
                    view_channel=True,
                    send_messages=True,
                    read_message_history=True,
                    add_reactions=True,
                    attach_files=True,
                    embed_links=True,
                )

            if role2 != "0":
                await ticket.set_permissions(
                    discord.utils.get(interaction.guild.roles, id=role2),
                    view_channel=True,
                    send_messages=True,
                    read_message_history=True,
                    add_reactions=True,
                    attach_files=True,
                    embed_links=True,
                )
            
            if role3 != "0":
                await ticket.set_permissions(
                    discord.utils.get(interaction.guild.roles, id=role3),
                    view_channel=True,
                    send_messages=True,
                    read_message_history=True,
                    add_reactions=True,
                    attach_files=True,
                    embed_links=True,
                )

            await ticket.set_permissions(
                interaction.user,
                view_channel=True,
                send_messages=True,
                read_message_history=True,
                add_reactions=True,
                attach_files=True,
                embed_links=True,
            )

            await msg.edit(content=f"![833101995723194437](https://cdn.discordapp.com/emojis/1070058449406275644.webp?size=128 "833101995723194437") Your Ticket has been created! {ticket.mention}")

            em = discord.Embed(
                title= f"Ticket for `{interaction.guild.id}`",
                description= f"{createtext.replace('{user}', f'{interaction.user.mention}')} ",
                color=col
            )
            em.set_footer(text=f"Ticket ID: {ticket_id2}")
            em.set_thumbnail(url=interaction.guild.icon.url)

            em1 = discord.Embed(
                title= f"**A Staff Member will claim the Ticket soon!**",
                description=f"Dear {interaction.user.mention}! \n *Please wait until a Staff Member, claimed your Ticket!*",
                color=col
            )
            em1.set_footer(text=f"Ticket ID: {ticket_id2}")
            em1.set_thumbnail(url=interaction.guild.icon.url)


            ticket_id1 = ticket_id2
            await ticket.send(content=f" {interaction.user.mention} | <@{role1}> | <@{role2}>| <@{role3}>", embeds=[em, em1], view=Ticketcomp(ticket_id1))


solid ingot
#

was soll noch passieren?

lethal sequoia
#

Kann ich für den gesamten bot commands in DMs deaktivieren oder muss ich das für jeden Command einzeln machen?

old ore
old ore
limpid wolf
solid ingot
#

es gibt auf jeden Fall Checks für den ganzen bot, vlt kann man das darüber machen, die hab ich aber auch noch nie wirklich benutzt

#

könnte ich eig Mal mein Video dazu machen

lethal sequoia
#

Ja gut dann halt eine Zeile mehr pro Command kann ich auch mit leben. Danke für die fixe Antwort

wispy flame
ruby sparrow
wispy flame
ruby sparrow
#
import aiosqlite
import discord
from discord.ext import commands
import sqlite3
from discord.commands import slash_command
from discord.commands import Option

class Mod(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.db = "report.db"
        self.conn = sqlite3.connect('database.db')
        self.cursor = self.conn.cursor()
        self.cursor.execute('''CREATE TABLE IF NOT EXISTS warns
                         (user_id TEXT, mod_id TEXT, reason TEXT)''')
        self.conn.commit()

    @slash_command()
    async def warn(self, ctx, user: Option(discord.User, "The User you want to warn"),reason: Option(int, "The Reason, why you want to warn the Member!")):
            db = await aiosqlite.connect('database.db')
            await db.execute("INSERT INTO reports (guild_id, user_id, modid, grund) VALUES (?,?,?,?)",(ctx.guild.id, user.id, ctx.author.id, reason))
            await db.commit()
            await db.execute("UPDATE checking SET count = count + 1 WHERE id = ?", (user.id + ctx.guild.id,))
            async with db.execute("SELECT count FROM checking WHERE id = ?", (user.id + ctx.guild.id,)) as cursor:
                count = await cursor.fetchone()
                count2 = count[0]
                if count2 == 3:
                    await user.ban(reason="3x Warned")
                    await ctx.respond(f"{user.mention} got banned because he got 3x warned!", ephemeral=True)

                    embed = discord.Embed(
                        title="Warn",
                        description=f"{user.mention} got warned!",
                        color=discord.Color.random()
                    )
                    embed.add_field(name="`Warn-Reason`", value=f"**reason**")
                    embed.add_field(name="`Responsible Moderator`", value=f"**{ctx.author.mention}**")
                    embed.add_field(name="`Warned User`", value=f"**{user.mention}**")
                    embed.set_author(name="PANTHEON")
                    embed.set_footer(text="PANTHEON")
                    embed.set_thumbnail(url=ctx.author.display_avatar_url)

                    channel = await self.bot.get_channel("1100759291524304957")
                    if channel == None:
                        await ctx.respond("The Log-Channel is not valid, please insert it again! ", ephemeral=True)
                    else:
                        await ctx.respond(f"{user.mention} got warned!", ephemeral=True)
                        await channel.send(embed=embed)
def setup(bot):
    bot.add_cog(Mod(bot))```
#

kann wer helfen

dense magnet
obtuse estuary
#

Hmm hast su schon mal in den Docs geguckt?

solid ingot
obtuse estuary
urban glen
#

CODE:

    @slash_command(description="assign a role to a member")
    @command.has_permisions(administrator=True)
    async def role(ctx: user, role):
    member = ctx.guild.get_member(user.id)
    if role in member.roles:
        await member.remove_roles(role)
        await ctx.send(f"Removed {role.name} from {user.mention}")
    else:
        await member.add_roles(role)
        await ctx.send(f"Added {role.name} to {user.mention}")```

**ERROR:**

```IndentationError: expected an indented block after function definition on line 41
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/main.py", line 23, in <module>
    bot.load_extension(f"cogs.{filename[:-3]}")
  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 910, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 777, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.Admin' raised an error: IndentationError: expected an indented block after function definition on line 41 (Admin.py, line 42)```
solid ingot
#

alles, was innerhalb der role methode steht, muss eins nach rechts eingerückt werden

urban glen
solid ingot
#

bitte benutze die antwort funktion nicht zum pingen, sondern zum antworten

solid ingot
urban glen
solemn musk
#

weiss wer warum der das nd ändert

wise stone
urban glen
wise stone
wise stone
#

Ping?

urban glen
# wise stone schick Mal den Code wo das Teil getriggert wird und bitte in ein Code Block
    @slash_command(description="assign a role to a member")
    @command.has_permisions(administrator=True)
    async def role(ctx: user, role):
    member = ctx.guild.get_member(user.id)
    if role in member.roles:
        await member.remove_roles(role)
        await ctx.send(f"Removed {role.name} from {user.mention}")
    else:
        await member.add_roles(role)
        await ctx.send(f"Added {role.name} to {user.mention}")```
#

hab ausversehen ohne py gesesndet

#

sehe da eigentlich kein error

#

für syntax

#

oder komma?

wise stone
urban glen
#

was

#

aso

wise stone
#

und teste dann Mal neu

urban glen
urban glen
#

ok

wise stone
#

wieso gettest du die members?

#

user hat das schon

urban glen
#

soll ich dan sagen

await user.remove_roles(role)```
wise stone
#

jup

urban glen
#

okay

#
    @slash_command(description="assign a role to a member")
    @command.has_permisions(administrator=True)
    async def role(ctx, user:discord.Member, role:discord.Role):
    if role in user.roles:
        await user.remove_roles(role)
        await ctx.send(f"Removed {role.name} from {user.mention}")
    else:
        await user.add_roles(role)
        await ctx.send(f"Added {role.name} to {user.mention}")```
#
IndentationError: expected an indented block after function definition on line 41
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/main.py", line 23, in <module>
    bot.load_extension(f"cogs.{filename[:-3]}")
  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 910, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/container/.local/lib/python3.10/site-packages/discord/cog.py", line 777, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.Admin' raised an error: IndentationError: expected an indented block after function definition on line 41 (Admin.py, line 42)```
#

42 ist if role

#

aso hab vergessen

wise stone
#

@urban glen einrücking ist falsch

urban glen
#

ja habs bemerkt

urban glen
#

ups bei den permissions

wise stone
urban glen
#

"discord.errors.ExtensionFailed: Extension 'cogs.Admin' raised an error: AttributeError: module 'discord.ext.commands' has no attribute 'has_permisions'"

#

digga

#

ich kann nicht schreiben

#

permissions*

wise stone
#

2 m

urban glen
#

nein

#

2 s

#

man sagt per-missions nicht perm-missions

wise stone
#

bruh Englisch kackt rein

urban glen
#
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.10/site-packages/discord/client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "/home/container/cogs/Admin.py", line 37, in on_application_command_error
    raise error
  File "/home/container/.local/lib/python3.10/site-packages/discord/bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 375, in invoke
    await injected(ctx)
  File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'ApplicationContext' object has no attribute 'roles'
#

ohh

#

hab self vergessen

old ore
#

er sagt das die guild none ist obwohlt es nicht so kann mir mir bitte werhelfen

obtuse estuary
snow hatch
#

hey mal eine frage, will relativ viele bilder vom bot senden lassen, aber wenn ich die ja alle einzelnt halt per attachment einbinde dann ist das sehr viel code, gibts irgendeinen weg das besser zu machen? Weil wenn ich einfach alle links sende, dann werden die ja auch angezeigt und das sieht nicht so geil aus

urban glen
#

wie genau?

#

also du machst /image und hast dann optionen und die sollen geschickt werden oder wie

snow hatch
#

ja so unegfähr, und dann werden dir halt relativ viele bilder geschickt

#

aber ich müsste um sie als nachricht zu senden sie entweder als link schicken, wo der link dann sichtbar ist, oder jeden einzeln halt in meinem code einbinden so:
gesendetba = discord.File("Banner/gesendet.png", filename="gesendet.png")
Geht das einfacher?

lethal sequoia
#

Kann ich beim benutzen dieser Option die everyone Rolle ausblenden?

    @rolemenu.command(name = "add", description = "Fügt eine Rolle zu einem Rollenmenü hinzu")
    @discord.default_permissions(administrator = True)
    async def add(self, ctx, role: Option(discord.Role), emote: Option(str)):

Wollte es für einen simplen Weg benutzen Rollen zu einem Rolemenu hinzuzufügen aber die everyone Rolle ist etwas störend weil es damit so aussieht:

indigo sapphire
novel ore
#
Ignoring exception in modal <cogs.verifizieren.verifizieren.VerifyModal object at 0x000001ECE41D1510>:
Traceback (most recent call last):
  File "C:\Users\Basti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\modal.py", line 341, in dispatch
    await value.callback(interaction)
  File "C:\Users\Basti\PycharmProjects\CC×System\cogs\verifizieren\verifizieren.py", line 49, in callback
    await interaction.response.send_message("Du bist nun Verifiziert.", ephemeral=True)
  File "C:\Users\Basti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 825, in send_message
    await self._locked_response(
  File "C:\Users\Basti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 1090, in _locked_response
    await coro
  File "C:\Users\Basti\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\webhook\async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
#

code

class VerifyModal(discord.ui.Modal):
    def __init__(self, bot, **kwargs) -> None:
        self.bot = bot
        self.zahl = str(random.randint(1000, 9999))
        super().__init__(**kwargs, title=f'{self.zahl}')

        self.add_item(discord.ui.InputText(
            label=f"Gib die Zahl ein: {self.zahl}",
            placeholder=f"{self.zahl}",
            required=True,
            min_length=4,
            max_length=4
        ))
    async def callback(self, interaction: discord.Interaction):
        user = interaction.user
        
        if self.children[0].value == self.zahl:
            if role1 in interaction.user.roles:
                await interaction.user.remove_roles(role1)
                try:
                    await user.add_roles(role2, role3, role4, role5, role6, role7, role8)
                except discord.errors.Forbidden:
                    embed = discord.Embed(
                        color=discord.Colour.red(),
                        title="Fehler",
                        description="Es ist ein Fehler aufgetreten. Dies kann mehrere Gründe haben. \n\n- Ich habe keine Berechtigung, die Rolle zu vergeben. \n- Die Rolle ist höher als meine. \n- Die Rolle ist höher als meine. \n\nBitte überprüfe die Berechtigungen und versuche es erneut."
                    )
                    await interaction.response.send_message(embed=embed, ephemeral=True)
                await interaction.response.send_message("Du bist nun Verifiziert.", ephemeral=True)
            else:
                await interaction.response.send_message("Du bist schon Verifiziert", ephemeral=True)
        else:
            await interaction.response.send_message("Die Zahl ist falsch", ephemeral=True)
#

warum kommt da Unknown interaction

solid ingot
#

das kommt meistens, wenn dein bot länger als 3 sekunden zum antworten braucht

tawdry leaf
#

F

lethal sequoia
tawdry leaf
solid ingot
tawdry leaf
#

if select.values[0]== "everyone":

lethal sequoia
#

Schade, aber denke mache es dann eh eher so

        await ctx.respond("Bitte ping die Rolle, die du hinzufügen möchtest")
        while True:
            try:
                msg = await self.bot.wait_for("message", timeout = 30, check = lambda m: m.author == ctx.author and m.channel == ctx.channel)
            except asyncio.TimeoutError:
                await ctx.respond("Du hast zu lange Gebraucht die nächste Rolle hinzuzufügen", ephemeral = True)
                break
            else:
                if msg.role_mentions:
                    role = msg.role_mentions[0]
                    await ctx.respond(f"Rolle: {role}")
                    break
                else:
                    await ctx.respond("Bitte ping eine Rolle", ephemeral = True)

Funktioniert so ja auch und ist glaube ich auch etwas entspannter (also jetzt funktionierts noch nich weil die hälfte fehlt aber whatever) kann ich ja auch quasi if role.name == "here" or "everyone": benutzen zum checken oder?

#

Bitte drückt mir kein "versuchs doch einfach" 💀

solid ingot
#

@ here ist gar keine rolle oder?

tawdry leaf
#

hmm

solid ingot
#

das mit dem namen sollte gehen, ich mach das aber immer mit guild.default_role

tawdry leaf
lethal sequoia
#

Es wird halt als mentionable angezeigt deswegen dachte ichs

tawdry leaf
#

obwohl

solid ingot
lethal sequoia
solid ingot
#

musst du nicht

lethal sequoia
#

Alles klar, danke auf jeden Fall für die Auskunft wie immer eine Freude :^)

solid ingot
#

kann auch sein dass bei "everyone" noch ein @ davor muss wenn du den name prüfst

solid ingot
#

ah warte mal

#

es gibt ja role.is_default()

tawdry leaf
#

ye

lethal sequoia
#

ach das gibt ja dann eh nur true oder false right? Ja gut dann spare ich mir des andere

solid ingot
#

jo

solemn musk
#

weisst du wie es geht

tawdry leaf
#

zeiger 🤔

snow hatch
#

wie kann ich attachments als nachricht senden, finde nichts in den docs
Will halt relativ viele bilder mit einer nachricht versenden

solid ingot
#

du kannst attachments zu files umwandeln und dann senden

snow hatch
solid ingot
#

wie meinst du das genau?

snow hatch
#

also ich will halt einfach bilder per dm verschicken
Ich kann das ja entweder im dem ich den link sende den man dann sieht was nervt oder das bild anhänge, das heißt ich muss das bild ja erstmal in einem ordner meines bots haben, und dann einzelnt alle bilder reinkriegen in den code, mit z.b. discord.File(..)
Und das dann senden, oder geht das anders/einfacher? habe glaube meine erste frage falsch formuliert

snow hatch
#

Bzw. andere frage
Habe jetzt mal versucht das ganze einfach als file normal zu speichern und als dm zu senden aber kriege einen Fehler

bannerinfo = discord.File("blau/infos.png", filename="infos.png")
        bannerserver = [bannerinfo]

                        await ch.send(file=bannerserver )
discord.errors.InvalidArgument: file parameter must be File
solid ingot
#

wenn du eine liste von files hast, musst du files= statt file= schreiben

snow hatch
#

danke
Aber kann man eigentlich auch ganze ordner zu eine file machen? So das ich nicht jeden einzelnt mit discord.File reinladen muss?

solid ingot
#

du könntest eine for schleife machen

snow hatch
#

glaube weiß was du meinst, aber wie kann ich dann jede datei hinzufügen? Weil man ja immer discord.File(banner/dennamen) machen muss

urban glen
#

Also bin nicht sicher ob das so klappen würde, aber kannst es testen

snow hatch
#

was genau ist dieses os

urban glen
snow hatch
urban glen
snow hatch
#

jo habe irgendwie probleme den pfad richtig anzugeben

urban glen
#

Zeig doch mal deine Anordnung

snow hatch
#

muss ich den von meinen privaten daten angeben? also C:\User usw?

urban glen
#

Nein

#

Zeig doch mal deine Ordner Anordnung und in welcher Datei du dich befindest

snow hatch
#

C:\Users\gianl\PycharmProjects\discordbot\blau
also, im blau ordner sind die bilder die ich schicken will

urban glen
#

Ich meine als screenshot

snow hatch
#

was genau willst du als screenshot sehen?

urban glen
#

Deine Ordner Anordnung

snow hatch
urban glen
#

Und in welcher Datei befindest du dich?

snow hatch
#

in dem blau ordner sind die bilder

#

in einer in cogs

#

also im cogs ordner drinne

urban glen
#
folder_path = "../blau/"

oder

folder_path = "./blau/"

Eins von beiden denke ich, teste mal

#

Wenns nicht geht, dann kann dir maybe wer anders helfen

snow hatch
#

warum . ?

urban glen
#

Man man

#

Das beantworte ich jetzt nd xD
||grundwissen||

snow hatch
#

sorry habe mic mit os noch nie beschäftigt
Klappt...habe nur zu viele als 10 bilder drinnepepecry
Das muss ich nochmal ändern

snow hatch
#

habe eine neue view(dropdown) hinzugefügt seitdem kommt beim starten der fehler
discord.errors.ExtensionFailed: Extension 'cogs.banner' raised an error: TypeError: module() takes at most 2 arguments (3 given)
Woran liegt das? Ich finde einfach nicht den fehler

urban glen
#

Obwohl wait

snow hatch
urban glen
snow hatch
urban glen
#

Füg mal Python Highlight zu deinem Code hinzu

#

Kriege gleich Augenkrebs alter xD

snow hatch
urban glen
#

Aber alles gut
Hast ja als Datei geschickt xD
Also ich kann das manuell bei mir ändern

snow hatch
#

habe ich aber er speichert das nie

urban glen
#

Das view muss groß geschrieben sein.

snow hatch
#

pepecry Bin ich blind

snow hatch
#

Mir wird gesagt er kann diesesn pfad nicht finden

           folder_pathblau = "./bannerlibrary/blau/serververwaltung/informationen"```
#

weshalb?

urban glen
#

Schick mal ganzen Screenshot

snow hatch
#

oder ist was mit ./ falsch?

urban glen
#

Und wenn das auch nd geht, dann probier mal mit Backslashes

snow hatch
#

ok

#

ist gefixxt und instant der nächste bug

urban glen
#

ok

wispy flame