Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Net.Http;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7. using Discord;
  8. using Discord.Commands;
  9. using Discord.WebSocket;
  10. using Microsoft.Data.Sqlite;
  11. using SteamWebAPI2;
  12. using SteamWebAPI2.Interfaces;
  13. using SteamWebAPI2.Models;
  14. using SteamWebAPI2.Utilities;
  15.  
  16. namespace DiscordBot.Modules
  17. {
  18. [Name("Cheaters")]
  19. [Group("cheater")]
  20. [Summary("Commands related to cheaters; ban-watch, lists, etc.")]
  21. public class CheaterModule : ModuleBase<SocketCommandContext>
  22. {
  23. [Command("add")]
  24. [Summary("Add a cheater to the list")]
  25. [RequireOwner]
  26. public async Task AddCheater(string profile)
  27. {
  28. string dbpath = Path.Combine(Directory.GetCurrentDirectory(), "cheaters.sq3");
  29. if (!(File.Exists(dbpath)))
  30. throw new Exception("Database doesn't exist. Notify the bot owner.");
  31. using (SqliteConnection db = new SqliteConnection($"Filename={dbpath}"))
  32. {
  33. db.Open();
  34. SqliteCommand checkForEmptyTable = new SqliteCommand("SELECT name FROM sqlite_master WHERE type='cheaters'", db);
  35. SqliteDataReader query = checkForEmptyTable.ExecuteReader();
  36. if (!(query.HasRows))
  37. throw new Exception("Database has no entries. Notify the bot owner.");
  38.  
  39.  
  40. /* doing this wrong...
  41. var steamWebApiBaseUrl = "https://api.steampowered.com/";
  42. var steamWebApiKey = "<your web api key>";
  43. HttpClient httpClient = new HttpClient();
  44. SteamWebHttpClient steamWebHttpClient = new SteamWebHttpClient(httpClient);
  45. return new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey, steamWebHttpClient);
  46.  
  47. var steamid = new SteamId(profile, ???)
  48. */
  49.  
  50. db.Close();
  51. }
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement