Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion discord/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -2206,7 +2206,7 @@ def repl(match: re.Match) -> str:
transformed = transforms[type](id)
return transformed

result = re.sub(r'<(@[!&]?|#)([0-9]{15,20})>', repl, self.content)
result = re.sub(r'<(@[!&]?|#)(\d{15,20})>', repl, self.content)

return escape_mentions(result)

Expand Down
6 changes: 3 additions & 3 deletions discord/opus.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,11 @@ def _set_gain(self, adjustment: int) -> int:
"""
return _lib.opus_decoder_ctl(self._state, CTL_SET_GAIN, adjustment)

def set_gain(self, dB: float) -> int:
def set_gain(self, db: float) -> int:
"""Sets the decoder gain in dB, from -128 to 128."""

dB_Q8 = max(-32768, min(32767, round(dB * 256))) # dB * 2^n where n is 8 (Q8)
return self._set_gain(dB_Q8)
db_q8 = max(-32768, min(32767, round(db * 256))) # dB * 2^n where n is 8 (Q8)
return self._set_gain(db_q8)

def set_volume(self, mult: float) -> int:
"""Sets the output volume as a float percent, i.e. 0.5 for 50%, 1.75 for 175%, etc."""
Expand Down
3 changes: 1 addition & 2 deletions discord/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ def parse_channel_update(self, data: gw.ChannelUpdateEvent) -> None:
_log.debug('CHANNEL_UPDATE referencing an unknown guild ID: %s. Discarding.', guild_id)

def parse_channel_create(self, data: gw.ChannelCreateEvent) -> None:
factory, ch_type = _channel_factory(data['type'])
factory, _ = _channel_factory(data['type'])
if factory is None:
_log.debug('CHANNEL_CREATE referencing an unknown channel type %s. Discarding.', data['type'])
return
Expand All @@ -893,7 +893,6 @@ def parse_channel_create(self, data: gw.ChannelCreateEvent) -> None:
self.dispatch('guild_channel_create', channel)
else:
_log.debug('CHANNEL_CREATE referencing an unknown guild ID: %s. Discarding.', guild_id)
return

def parse_channel_pins_update(self, data: gw.ChannelPinsUpdateEvent) -> None:
channel_id = int(data['channel_id'])
Expand Down
Loading