예제 #1
0
 public static void DeleteMessage(string chnid, string msgid)
 {
     try
     {
         IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
         channelservice.DeleteMessage(chnid, msgid).Wait();
     }
     catch (Exception exception)
     {
         //App.NavigateToBugReport(exception);
     }
 }
예제 #2
0
 public static async Task TriggerTypingIndicator(string channelId)
 {
     try
     {
         IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
         await channelservice.TriggerTypingIndicator(channelId);
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #3
0
 public static void ModifyGuildChannel(string chnId, ModifyChannel newChn)
 {
     try
     {
         IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
         channelservice.ModifyChannel(chnId, newChn).Wait();
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #4
0
 public static async Task <Message> GetMessage(string chnid, string msgid)
 {
     try
     {
         IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
         return(await channelservice.GetChannelMessage(chnid, msgid));
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(new SharedModels.Message());
 }
예제 #5
0
 public static async Task <IEnumerable <SharedModels.Message> > GetChannelPinnedMessages(string id)
 {
     try
     {
         IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
         return(await channelservice.GetPinnedMessages(id));
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(null);
 }
예제 #6
0
 public static async Task CreateMessage(string id, string text)
 {
     try
     {
         MessageUpsert message = new MessageUpsert();
         message.Content = text;
         IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
         await channelservice.CreateMessage(id, message);
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #7
0
 public static async Task DeleteReactionAsync(string channelid, string messageid, string emoji)
 {
     try
     {
         await Task.Run(() =>
         {
             IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
             channelservice.DeleteReaction(channelid, messageid, emoji).Wait();
         });
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #8
0
 public static async Task AckMessage(string chnId, string msgId)
 {
     try
     {
         await Task.Run(async() =>
         {
             IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
             await channelservice.AckMessage(chnId, msgId);
         });
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #9
0
        public static async Task <IEnumerable <Invite> > GetChannelInvites(string channelId)
        {
            try
            {
                IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
                var             ch             = await channelservice.GetChannelInvites(channelId);

                return(ch);
            }
            catch (Exception exception)
            {
                App.NavigateToBugReport(exception);
            }
            return(null);
        }
예제 #10
0
 public static SharedModels.GuildChannel GetGuildChannel(string id)
 {
     try
     {
         IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
         Task <SharedModels.GuildChannel> channelTask = channelservice.GetGuildChannel(id);
         channelTask.Wait();
         return(channelTask.Result);
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
     return(new SharedModels.GuildChannel());
 }
예제 #11
0
 public static async void EditMessageAsync(string chnid, string msgid, string content)
 {
     try
     {
         await Task.Run(() =>
         {
             EditMessage editmessage        = new EditMessage();
             editmessage.Content            = content;
             IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
             channelservice.EditMessage(chnid, msgid, editmessage);
         });
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
예제 #12
0
        private Task <bool> Login()
        {
            Messenger.Default.Send(new ConnectionStatusMessage(ConnectionStatus.Connecting));

            IAuthenticator           authenticator            = new DiscordAuthenticator(_accessToken);
            AuthenticatedRestFactory authenticatedRestFactory = new AuthenticatedRestFactory(new DiscordApiConfiguration()
            {
                BaseUrl = "https://discordapp.com/api"
            }, authenticator);

            ActivitesService   = authenticatedRestFactory.GetActivitesService();
            ChannelService     = authenticatedRestFactory.GetChannelService();
            ConnectionsService = authenticatedRestFactory.GetConnectionService();
            GameService        = authenticatedRestFactory.GetGameService();
            GuildService       = authenticatedRestFactory.GetGuildService();
            InviteService      = authenticatedRestFactory.GetInviteService();
            MiscService        = authenticatedRestFactory.GetMiscService();
            UserService        = authenticatedRestFactory.GetUserService();
            VoiceService       = authenticatedRestFactory.GetVoiceService();

            return(_gatewayService.InitializeGateway(_accessToken));
        }
예제 #13
0
        public static async Task <Invite> CreateInvite(string chnId, CreateInvite invite)
        {
            IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();

            return(await channelservice.CreateChannelInvite(chnId, invite));
        }
예제 #14
0
        public static void UnpinMessage(string chnId, string msgId)
        {
            IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();

            channelservice.DeletePinnedChannelMessage(chnId, msgId);
        }
예제 #15
0
        public static async Task <IEnumerable <SharedModels.Message> > GetChannelMessagesBefore(string id, string msgpos)
        {
            IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();

            return(await channelservice.GetChannelMessagesBefore(id, msgpos));
        }