Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Linq;
- using System.Net.Http;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using Discord;
- using Discord.Commands;
- using Discord.WebSocket;
- using Microsoft.Data.Sqlite;
- using SteamWebAPI2;
- using SteamWebAPI2.Interfaces;
- using SteamWebAPI2.Models;
- using SteamWebAPI2.Utilities;
- namespace DiscordBot.Modules
- {
- [Name("Cheaters")]
- [Group("cheater")]
- [Summary("Commands related to cheaters; ban-watch, lists, etc.")]
- public class CheaterModule : ModuleBase<SocketCommandContext>
- {
- [Command("add")]
- [Summary("Add a cheater to the list")]
- [RequireOwner]
- public async Task AddCheater(string profile)
- {
- string dbpath = Path.Combine(Directory.GetCurrentDirectory(), "cheaters.sq3");
- if (!(File.Exists(dbpath)))
- throw new Exception("Database doesn't exist. Notify the bot owner.");
- using (SqliteConnection db = new SqliteConnection($"Filename={dbpath}"))
- {
- db.Open();
- SqliteCommand checkForEmptyTable = new SqliteCommand("SELECT name FROM sqlite_master WHERE type='cheaters'", db);
- SqliteDataReader query = checkForEmptyTable.ExecuteReader();
- if (!(query.HasRows))
- throw new Exception("Database has no entries. Notify the bot owner.");
- /* doing this wrong...
- var steamWebApiBaseUrl = "https://api.steampowered.com/";
- var steamWebApiKey = "<your web api key>";
- HttpClient httpClient = new HttpClient();
- SteamWebHttpClient steamWebHttpClient = new SteamWebHttpClient(httpClient);
- return new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey, steamWebHttpClient);
- var steamid = new SteamId(profile, ???)
- */
- db.Close();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement