Skip to content

Script close after found an stream #6

@Taracraft

Description

@Taracraft

Hey there, i want to use an loop for that the script dont terminate.
Situation:
Streams goes online and script tells he is online but if they go offline i must restart the script.
And if he comes Online the script cant tell that he is online again.
custom function i made for clearing the streamingchannel in discord:

#variable section
intents = discord.Intents.all()
intents.members = True
intents.messages = True
intents.presences = True
client = discord.Client(intents=discord.Intents.all())
g = client.get_guild(xxx)

def channel_clear():
    @client.event
    async def on_ready():
        global g
        arr = [client.get_channel(xxx)]
        for channel in arr:
            print('Clearing messages...')
            await channel.purge(limit=1000)

        else:
            print(channel, 'Keine Einträge gefunden')
            config()
            get_lock()
            authorize()
            main()

and this i tried

if discord_request.status_code == 204:
                    print("Successfully called Discord API. Waiting 5 seconds to terminate...")
                    time.sleep(5)
                    while discord_request.status_code == 204:
                        if len(twitch_json['data']) != 1:
                            print("nicht Online")
                            channel_clear()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions