Skip to content

Commit 0e2ce5f

Browse files
committed
fix docs samples
1 parent ff4e500 commit 0e2ce5f

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

docs/guides/voice/libdave.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,12 @@ You'll first need a build of Discords' [libdave](https://github.com/discord/libd
99

1010
Then, enable dave voice encryption in your socket config:
1111

12-
```cs
13-
var client = new DiscordSocketClient(new DiscordSocketConfig()
14-
{
15-
EnableVoiceDaveEncryption = true,
16-
...
17-
});
18-
```
12+
[!code-csharp[Opt-in to libdave](samples/libdave_config.cs)]
1913

2014
That's it, `libdave` will be used when sending/receiving voice.
2115

2216
### libdave Log Sink
2317

2418
By default, `libdave` writes its logs to standard output, you can override that by specifying a custom log sink:
25-
```cs
26-
Discord.LibDave.Dave.SetLogSink(MyLogSink);
27-
28-
void MyLogSink(
29-
Discord.LibDave.LoggingSeverity severity,
30-
string filePath,
31-
int lineNumber,
32-
string message
33-
)
34-
{
35-
// do what you want with the logs
36-
Console.WriteLine($"[{severity} | LIBDAVE @ {file}#{line}]: {message}");
37-
}
38-
```
19+
20+
[!code-csharp[libdave sink](samples/libdave_sink.cs)]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var client = new DiscordSocketClient(new DiscordSocketConfig()
2+
{
3+
EnableVoiceDaveEncryption = true,
4+
...
5+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Discord.LibDave.Dave.SetLogSink(MyLogSink);
2+
3+
void MyLogSink(
4+
Discord.LibDave.LoggingSeverity severity,
5+
string filePath,
6+
int lineNumber,
7+
string message
8+
)
9+
{
10+
// do what you want with the logs
11+
Console.WriteLine($"[{severity} | LIBDAVE @ {file}#{line}]: {message}");
12+
}

0 commit comments

Comments
 (0)