mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Update chat to work with new API version
This commit is contained in:
@ -2,34 +2,19 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetMessagesRequest : APIRequest<List<Message>>
|
||||
{
|
||||
private readonly List<Channel> channels;
|
||||
private readonly long? since;
|
||||
private readonly Channel channel;
|
||||
|
||||
public GetMessagesRequest(List<Channel> channels, long? sinceId)
|
||||
public GetMessagesRequest(Channel channel)
|
||||
{
|
||||
this.channels = channels;
|
||||
since = sinceId;
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
string channelString = string.Join(",", channels.Select(x => x.Id));
|
||||
|
||||
var req = base.CreateWebRequest();
|
||||
req.AddParameter(@"channels", channelString);
|
||||
if (since.HasValue) req.AddParameter(@"since", since.Value.ToString());
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => @"chat/messages";
|
||||
protected override string Target => $@"chat/channels/{channel.Id}/messages";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user