-
Notifications
You must be signed in to change notification settings - Fork 72
Add Soundboard #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Soundboard #283
Changes from 53 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
acadcd4
Add GuildVoiceChannelEffectSend
1bef49c
Add Soundboard
1b5d51d
add event to ListenerAdapter
2c1c929
Merge branch 'patch/voice-effect-event' into patch/soundboard
5fa89c9
add soundboard sound events
cc81f22
rename file
ecd8086
rename interface
99920e6
add sound fetching
a7d8b88
add check for gateway
abefae7
add docs for GuildVoiceChannelEffectSend
21a233a
rename SoundboardAnimationType to SoundboardEffectAnimationType
58b233e
Merge branch 'patch/voice-effect-event' into patch/soundboard
c5d2a69
bruh
5b8f4d5
Merge branch 'patch/voice-effect-event' into patch/soundboard
1e324fd
change param to varargs
bce8b96
remove pointless else
d1256c5
add CDNEndpoint.Path()
ca70e41
Merge branch 'master' into patch/soundboard
e05894b
shorten impl name
5db0713
Merge branch 'master' into patch/soundboard
9197f63
add audit log events
8d01c39
Merge branch 'master' into patch/soundboard
540af44
updates
48ee79e
add caches
83fb472
Merge branch 'master' into patch/soundboard
c1c843d
remove SoundOverridePath
806a095
Merge branch 'patch/voice-effect-event' into patch/soundboard
e724aa6
Merge branch 'master' into patch/voice-effect-event
734ef47
Merge branch 'patch/voice-effect-event' into patch/soundboard
c3695a6
updates
598fe31
remove UserID from SoundboardSound
3902c58
Merge branch 'refs/heads/master' into patch/soundboard
sebm253 16682b6
updates
sebm253 dd6709b
Merge branch 'master' into patch/voice-effect-event
sebm253 4662bbf
Merge branch 'patch/voice-effect-event' into patch/soundboard
sebm253 2082aa8
add URL()
sebm253 d2253dd
add required intent + fix docs
sebm253 ae06f00
SoundboardEffectAnimationType -> VoiceChannelEffectAnimationType
sebm253 2590d62
Merge branch 'patch/voice-effect-event' into patch/soundboard
sebm253 7957f48
oh man
sebm253 5d5e919
Revert "oh man"
sebm253 df95c4b
change SoundID type to int64 with ,string
sebm253 843e2b9
add event umarshaler
sebm253 c981e9a
Merge branch 'patch/voice-effect-event' into patch/soundboard
sebm253 b8daf5c
Merge branch 'master' into patch/soundboard
sebm253 dbc3bb9
damn this shit is broken
sebm253 49d9570
add GuildFeatureMoreSoundboard
sebm253 e0fafc9
add missing cache getter
sebm253 05d0079
Merge branch 'master' into patch/soundboard
sebm253 88f0566
add request func to client interface
sebm253 1df7005
Merge branch 'master' into patch/soundboard
sebm253 76178b1
Merge branch 'master' into patch/soundboard
sebm253 d66a8d7
fix endpoint method
sebm253 71d6d64
Update discord/soundboard.go
sebm253 39a71ec
Apply suggestions from code review
sebm253 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| package discord | ||
|
|
||
| import ( | ||
| "encoding/base64" | ||
| "fmt" | ||
| "io" | ||
|
|
||
| "github.com/disgoorg/json" | ||
| ) | ||
|
|
||
| type SoundType string | ||
|
|
||
| const ( | ||
| SoundTypeMP3 SoundType = "audio/mpeg" | ||
| SoundTypeOGG SoundType = "audio/ogg" | ||
| SoundTypeWAV SoundType = "audio/wav" | ||
| SoundTypeUnknown = SoundTypeMP3 | ||
| ) | ||
|
|
||
| func (t SoundType) GetMIME() string { | ||
|
sebm253 marked this conversation as resolved.
Outdated
|
||
| return string(t) | ||
| } | ||
|
|
||
| func (t SoundType) GetHeader() string { | ||
|
sebm253 marked this conversation as resolved.
Outdated
|
||
| return "data:" + string(t) + ";base64" | ||
| } | ||
|
|
||
| var _ json.Marshaler = (*Sound)(nil) | ||
| var _ fmt.Stringer = (*Sound)(nil) | ||
|
|
||
| func NewSound(soundType SoundType, reader io.Reader) (*Sound, error) { | ||
| data, err := io.ReadAll(reader) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return NewSoundRaw(soundType, data), nil | ||
| } | ||
|
|
||
| func NewSoundRaw(soundType SoundType, src []byte) *Sound { | ||
| data := make([]byte, base64.StdEncoding.EncodedLen(len(src))) | ||
| base64.StdEncoding.Encode(data, src) | ||
| return &Sound{Type: soundType, Data: data} | ||
| } | ||
|
|
||
| type Sound struct { | ||
| Type SoundType | ||
| Data []byte | ||
| } | ||
|
|
||
| func (s Sound) MarshalJSON() ([]byte, error) { | ||
| return json.Marshal(s.String()) | ||
| } | ||
|
|
||
| func (s Sound) String() string { | ||
| if len(s.Data) == 0 { | ||
| return "" | ||
| } | ||
| return s.Type.GetHeader() + "," + string(s.Data) | ||
|
sebm253 marked this conversation as resolved.
Outdated
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.