{"id":21134303,"url":"https://github.com/devoxin/sharplink","last_synced_at":"2025-07-09T02:32:16.241Z","repository":{"id":52815986,"uuid":"132192251","full_name":"devoxin/SharpLink","owner":"devoxin","description":"Lavalink wrapper for Discord.Net written in C#","archived":false,"fork":false,"pushed_at":"2021-04-18T11:38:34.000Z","size":66,"stargazers_count":27,"open_issues_count":3,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-21T21:07:29.286Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devoxin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-04T21:49:31.000Z","updated_at":"2024-03-08T18:31:28.000Z","dependencies_parsed_at":"2022-08-17T14:50:56.283Z","dependency_job_id":null,"html_url":"https://github.com/devoxin/SharpLink","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devoxin%2FSharpLink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devoxin%2FSharpLink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devoxin%2FSharpLink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devoxin%2FSharpLink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devoxin","download_url":"https://codeload.github.com/devoxin/SharpLink/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225478270,"owners_count":17480617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T06:26:29.902Z","updated_at":"2024-11-20T06:26:30.381Z","avatar_url":"https://github.com/devoxin.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SharpLink\nA [Lavalink](https://github.com/freyacodes/Lavalink) wrapper for Discord.Net!\n\n[![NuGet Pre Release](https://img.shields.io/nuget/vpre/SharpLink.svg?style=flat-square)](https://www.nuget.org/packages/SharpLink/)\n\n## `Getting Started`\n\n- Follow [these instructions](https://github.com/freyacodes/Lavalink#server-configuration) to setup Lavalink.\n- Once Lavalink is up and running follow the code example below to setup Sharplink.\n\n```cs\nDiscordSocketClient client = new DiscordSocketClient();\nLavalinkManager lavalinkManager = new LavalinkManager(client, new LavalinkManagerConfig\n{\n    RESTHost = \"localhost\",\n    RESTPort = 2333,\n    WebSocketHost = \"localhost\",\n    WebSocketPort = 2333,\n    Authorization = \"YOUR_SECRET_AUTHORIZATION_KEY\",\n    TotalShards = 1 \n});\n```\n*Notes:* \n\u003e You don't have to pass a `LavalinkManagerConfig` since Sharplink uses the default config.\n\n\u003e As of Lavalink v3.1, in `LavalinkManagerConfig` your hosts, `RESTHost` and `WebSocketHost`, should be identical, and `RESTPort` should be identical to `WebSocketPort`.\n\n\u003e Set `TotalShards` to the total amount of shards your bot uses. If you don't understand what `TotalShards` is you are probably not sharding your bot and should set this value to `1`.\n\n\u003e Use only a single instance of `LavaLinkManager`. If possible add `LavalinkManager` to your DI (Dependency Injection).\n\nOnce a LavalinkManager is set up it will need to be started. It is recommended you put this in the ready event.\n\n```csharp\nclient.Ready += async () =\u003e\n{\n    await lavalinkManager.StartAsync();\n}\n```\n\nFrom there you can connect to audio channels, play music, and do whatever else you wish to do. Here is an example to connect and play music on a voice channel.\n\n```cs\n// Get LavalinkPlayer for our Guild and if it's null then join a voice channel.\nLavalinkPlayer player = lavalinkManager.GetPlayer(GUILD_ID) ?? await lavalinkManager.JoinAsync(VOICE_CHANNEL);\n\n// Now that we have a player we can go ahead and grab a track and play it\nLoadTracksResponse response = await lavalinkManager.GetTracksAsync(\"IDENTIFIER\");\n// Gets the first track from the response\nLavalinkTrack track = response.Tracks.First();\nawait player.PlayAsync(track);\n\n// For legacy usage with GetTrackAsync() on pre beta-0005 (This is deprecated, please upgrade)\n// The below note about search results applies to this method also\nLavalinkTrack track = await lavalinkManager.GetTrackAsync(\"IDENTIFIER\");\nawait player.PlayAsync(track);\n```\n\n*Notes:* To get a track from **Youtube** use `GetTracksAsync($\"ytsearch:Query\")`. To get a track from **SoundCloud** use `GetTracksAsync($\"scsearch:Query\")`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevoxin%2Fsharplink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevoxin%2Fsharplink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevoxin%2Fsharplink/lists"}