コード例 #1
0
        /// <summary>
        ///     当其包含 Quote 时, 获取目标 <see cref="MessageChain" />
        /// </summary>
        /// <param name="chain">包含 <see cref="Quote" /> 的消息链</param>
        /// <returns>源消息链</returns>
        public static async Task <MessageChain> OfMessageRepliedByAsync(this MessageChain chain)
        {
            var quote = chain.First(x => x is Quote) as Quote;
            var id    = MessageChain.Construct(new Source(quote !.MessageId));
            var src   = await _client.RequestAsync(id);

            return(src);
        }
コード例 #2
0
 /// <summary>
 ///     撤回该消息, 如果该消息不含 <see cref="Source" /> 则引发异常
 /// </summary>
 /// <param name="chain">包含 <see cref="Source" /> 的消息链</param>
 /// <returns>
 ///     <see cref="Task" />
 /// </returns>
 public static async Task RevokeAsync(this MessageChain chain)
 {
     await _client.RevokeMessageAsync(((Source)chain.First(x => x is Source)).MessageId);
 }