You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's pretty much it! When you launch your worker with a valid bot token you should see your bot come online in an instant, congratulations! ✨
97
97
98
-
### OpenTracing (Optional)
99
-
100
-
You probably wonder what's the deal with the tracing dependency. I've taken liberty to implement [OpenTracing](https://github.com/opentracing/opentracing-csharp) within all event subscribers, so if your bot struggles with performance, you can easily analyse it with the addition of e.g. [Jaeger Tracing](https://github.com/jaegertracing/jaeger-client-csharp). If you don't know what that means or don't care about tracing at all, just skip this section. To utilise tracing, you can use this snippet to get you up and running (although I highly recommend you check out the Jaeger docs beforehand anyway):
// This will log to a default localhost installation of Jaeger.
114
-
vartracer=newTracer.Builder(serviceName)
115
-
.WithLoggerFactory(loggerFactory)
116
-
.WithSampler(newConstSampler(true))
117
-
.Build();
118
-
119
-
// Allows code that can't use DI to also access the tracer.
120
-
GlobalTracer.Register(tracer);
121
-
122
-
returntracer;
123
-
});
124
-
```
125
-
126
-
Make sure you call this **before**`AddDiscord` or the Mock Tracer will be used by default which will not collect or publish any metrics.
127
-
128
98
### Handling Discord Events
129
99
130
100
Now to the actual convenience feature of this library! Creating one (or more) class(es) that handle events, like when a guild came online or a message got created. Let's wire one up that gets general guild and member change events:
@@ -144,17 +114,14 @@ internal class BotModuleForGuildAndMemberEvents :
0 commit comments