Skip to content

'CustomSink' object has no attribute '__sink_listeners__' #3241

@KuraiAI

Description

@KuraiAI

Summary

'CustomSink' object has no attribute 'sink_listeners'

Reproduction Steps

Ever since the DAVE encryption fix, I've been getting an error
'CustomSink' object has no attribute '__sink_listeners__'
when I send the custom sink into the start_recording function of the voice client. This was never a problem in the past, and unfortunately due to Discord's new requirements, I can't use the pre-DAVE versions of pycord. Other Discord Python libraries don't work at all (I actually used a different one before swapping to Pycord because sinks were too slow on that one), and non-custom sinks don't work for my use case.

I'll attach the init for my custom sink.

Minimal Reproducible Code

def __init__(
        self,
        queue: asyncio.Queue,
        loop: asyncio.BaseEventLoop,
        *,
        filters=None,
        data_length=50000,
        quiet_phrase_timeout=1.2,
        mid_sentence_multiplier=1.8,
        no_data_multiplier=0.75,
        max_phrase_timeout=30,
        min_phrase_length=3,
        max_speakers=-1,
        min_speaking_time = 1
    ):
        self.queue = queue
        self.loop = loop

        if filters is None:
            filters = default_filters
        self.filters = filters
        Filters.__init__(self, **self.filters)

        self.data_length = data_length
        self.quiet_phrase_timeout = quiet_phrase_timeout
        self.mid_sentence_multiplier = mid_sentence_multiplier
        self.no_data_multiplier = no_data_multiplier
        self.max_phrase_timeout = max_phrase_timeout
        self.min_phrase_length = min_phrase_length
        self.max_speakers = max_speakers
        self.min_speaking_time = min_speaking_time

        self.vc = None
        self.audio_data = {}

        self.running = True

        self.speakers = []

        self.temp_file = NamedTemporaryFile().name

        self.voice_queue = Queue()
        self.voice_thread = threading.Thread(target=self.insert_voice, args=())
        self.voice_thread.start()

Expected Results

Channel is found
Voice client is received from the connect function
start_recording uses the write function in my custom sink

Actual Results

I get an error when the start_recording function is called.

Intents

default, message_content, members, voice_states

System Information

- Python v3.11.9-final
- py-cord v2.8.None-final
- aiohttp v3.13.3
- system info: Windows 10 10.0.26200

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Type

    No fields configured for Bug.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions