Add soundcloud support
This commit is contained in:
30
bot/modules/soundcloud/driver.py
Normal file
30
bot/modules/soundcloud/driver.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from attrs import define
|
||||
|
||||
from .engine import SoundCloudEngine
|
||||
|
||||
|
||||
@define
|
||||
class SoundCloudDriver:
|
||||
engine: SoundCloudEngine
|
||||
|
||||
async def get_track(self, track_id: int | str):
|
||||
return await self.engine.call(
|
||||
f'tracks/{track_id}'
|
||||
)
|
||||
|
||||
async def search(self, query: str, limit: int = 30):
|
||||
return (await self.engine.call(
|
||||
'search/tracks',
|
||||
params={
|
||||
'q': query,
|
||||
'limit': limit
|
||||
}
|
||||
))['collection']
|
||||
|
||||
async def resolve_url(self, url: str):
|
||||
return await self.engine.call(
|
||||
'resolve',
|
||||
params={
|
||||
'url': url
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user