private void ProcessDispatch(EventPayload response) { if (response.Command != Command.Dispatch) { return; } if (!response.Event.HasValue) { return; } switch (response.Event.Value) { //We are to join the server case ServerEvent.ActivitySpectate: SpectateMessage spectate = response.GetObject <SpectateMessage>(); EnqueueMessage(spectate); break; case ServerEvent.ActivityJoin: JoinMessage join = response.GetObject <JoinMessage>(); EnqueueMessage(join); break; case ServerEvent.ActivityJoinRequest: JoinRequestMessage request = response.GetObject <JoinRequestMessage>(); EnqueueMessage(request); break; //Unkown dispatch event received. We should just ignore it. default: Logger.Warning("Ignoring {0}", response.Event.Value); break; } }
private static void OnSpectate(object sender, SpectateMessage args) { Process.Start(new ProcessStartInfo { FileName = args.Secret, UseShellExecute = true }); }
private static void OnSpectate(object sender, SpectateMessage args) { /* * This is called when the Discord Client wants to join a online game to watch and spectate. * It can be triggered from a invite that your user has clicked on within discord. * * The secret should be some sort of encrypted data that will give your game the nessary information to connect. * For example, it could be the Game ID and the Game Password which will allow you to look up from the Master Server. * Please avoid using IP addresses within these fields, its not secure and defeats the Discord security measures. * * This feature requires the RegisterURI to be true on the client. */ Console.WriteLine("Spectating Game '{0}'", args.Secret); }