コード例 #1
0
 public static async Task UpdateTopGgAsync()
 {
     if (DblToken != null)
     {
         if (DblApi == null)
         {
             DblApi = new AuthDiscordBotListApi(ClientId, DblToken);
         }
         if (DblLastSend.AddMinutes(10).CompareTo(DateTime.Now) < 0) // Make sure to not spam the API
         {
             DblLastSend = DateTime.Now;
             await DblApi.UpdateStats(Client.Guilds.Count);
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Returns a string that represents the image URL of an <see cref="IDblWidget"/>.
 /// </summary>
 /// <param name="id">The unique identifier of the bot to build a widget for.</param>
 /// <param name="format">The image format that this <see cref="IDblWidget"/> will be built for.</param>
 /// <returns>An image URL representing a widget.</returns>
 public string ToString(ulong id, WidgetImageFormat format = WidgetImageFormat.Svg)
 => DblApi.GetWidgetUrl(id, Type, format, AvatarBackgroundColor,
                        LeftColor, RightColor, LeftTextColor, RightTextColor, UseAvatar ?? true);
コード例 #3
0
 /// <summary>
 /// Returns a string that represents the image URL of an <see cref="IDblWidget"/>.
 /// </summary>
 /// <param name="id">The unique identifier of the bot to build a widget for.</param>
 /// <param name="format">The image format that this <see cref="IDblWidget"/> will be built for.</param>
 /// <returns>An image URL representing a widget.</returns>
 public string ToString(ulong id, WidgetImageFormat format = WidgetImageFormat.Svg)
 => DblApi.GetWidgetUrl(id, format, TopColor, MiddleColor,
                        UsernameColor, CertifiedColor, DataColor, LabelColor, HighlightColor);