private RoomWatcher <DefaultWebSocket> NewRoomWatcherFor(int roomNumber) { var newRoomWatcher = new RoomWatcher <DefaultWebSocket>(this.auth, $"https://chat.stackoverflow.com/rooms/{roomNumber}"); var messageHandler = new ChatEventHandler(); var scheduler = new SharpExchange.Chat.Actions.ActionScheduler(this.auth, Host, roomNumber); var router = new CommandRouter(this, roomNumber, scheduler); messageHandler.OnEvent += router.RouteCommand; newRoomWatcher.EventRouter.AddProcessor(messageHandler); scheduler.CreateMessageAsync("Hello friends!"); return(newRoomWatcher); }
public static Task <bool> DeleteMessageAsync(this ActionScheduler actionScheduler, int messageId) { var action = new MessageDeleter(messageId); return(actionScheduler.ScheduleActionAsync <bool>(action)); }
public static Task <bool> DeleteMessageAsync(this ActionScheduler actionScheduler, Chat.Message message) { message.ThrowIfNull(nameof(message)); return(DeleteMessageAsync(actionScheduler, message.Id)); }
public static Task <bool> KickMuteUserAsync(this ActionScheduler actionScheduler, int userId) { var action = new UserKickMuter(userId); return(actionScheduler.ScheduleActionAsync <bool>(action)); }
public static Task <bool> KickMuteUser(this ActionScheduler actionScheduler, Chat.User user) { user.ThrowIfNull(nameof(user)); return(KickMuteUserAsync(actionScheduler, user.Id)); }
public static Task ChangeUserAccessLevelAsync(this ActionScheduler actionScheduler, int userId, UserAccessLevel newLevel) { var action = new UserAccessLevelEditor(userId, newLevel); return(actionScheduler.ScheduleActionAsync <bool>(action)); }
public static Task ChangeUserAccessLevelAsync(this ActionScheduler actionScheduler, Chat.User user, UserAccessLevel newLevel) { user.ThrowIfNull(nameof(user)); return(ChangeUserAccessLevelAsync(actionScheduler, user.Id, newLevel)); }
public static Task <bool> ToggleStarAsync(this ActionScheduler actionScheduler, int messageId) { var action = new MessageStarToggler(messageId); return(actionScheduler.ScheduleActionAsync <bool>(action)); }