This commit is contained in:
2022-06-08 18:54:58 +03:00
parent c66ff52d94
commit 531edcd3cc
55 changed files with 2253 additions and 2360 deletions

View File

@@ -1,6 +1,5 @@
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
internal class Echo : DBCommand
@@ -11,14 +10,14 @@ internal class Echo : DBCommand
public string Usage => "echo [message]";
public bool canUseDM => true;
public bool canUseDM => true;
public bool canUseServer => true;
public bool requireAdmin => false;
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
string m = message.Content.Substring(6);
var m = message.Content.Substring(6);
await message.Channel.SendMessageAsync(m);
}
}

View File

@@ -1,37 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Commands;
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
namespace CMD_Utils
namespace CMD_Utils;
internal class FlipCoin : DBCommand
{
class FlipCoin : DBCommand
public string Command => "flip";
public string Description => "Flip a coin";
public string Usage => "flip";
public bool canUseDM => true;
public bool canUseServer => true;
public bool requireAdmin => false;
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
public string Command => "flip";
public string Description => "Flip a coin";
public string Usage => "flip";
public bool canUseDM => true;
public bool canUseServer => true;
public bool requireAdmin => false;
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
System.Random random = new System.Random();
int r = random.Next(1, 3);
if (r == 1)
await message.Channel.SendMessageAsync("Heads");
else await message.Channel.SendMessageAsync("Tails");
}
var random = new System.Random();
var r = random.Next(1, 3);
if (r == 1)
await message.Channel.SendMessageAsync("Heads");
else
await message.Channel.SendMessageAsync("Tails");
}
}

View File

@@ -1,53 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
using PluginManager.Others;
namespace CMD_Utils
namespace CMD_Utils;
public class Poll : DBCommand
{
public class Poll : DBCommand
public string Command => "poll";
public string Description => "Create a poll with options";
public string Usage => "poll [This-is-question] [This-is-answer-1] [This-is-answer-2] ... ";
public bool canUseDM => false;
public bool canUseServer => true;
public bool requireAdmin => true;
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
public string Command => "poll";
if (isDM) return;
var question = message.Content.Split(' ')[1].Replace('-', ' ');
var answers = Functions.MergeStrings(message.Content.Split(' '), 2).Split(' ');
var embedBuilder = new EmbedBuilder();
embedBuilder.Title = question;
var len = answers.Length;
for (var i = 0; i < len; i++) embedBuilder.AddField($"Answer {i + 1}", answers[i].Replace('-', ' '), true);
var msg = await context.Channel.SendMessageAsync(embed: embedBuilder.Build());
public string Description => "Create a poll with options";
var emotes = new List<IEmote>();
emotes.Add(Emoji.Parse(":one:"));
emotes.Add(Emoji.Parse(":two:"));
emotes.Add(Emoji.Parse(":three:"));
emotes.Add(Emoji.Parse(":four:"));
emotes.Add(Emoji.Parse(":five:"));
emotes.Add(Emoji.Parse(":six:"));
public string Usage => "poll [This-is-question] [This-is-answer-1] [This-is-answer-2] ... ";
public bool canUseDM => false;
public bool canUseServer => true;
public bool requireAdmin => true;
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
if (isDM) return;
string question = message.Content.Split(' ')[1].Replace('-', ' ');
string[] answers = PluginManager.Others.Functions.MergeStrings(message.Content.Split(' '), 2).Split(' ');
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.Title = question;
int len = answers.Length;
for (int i = 0; i < len; i++)
embedBuilder.AddField($"Answer {i + 1}", answers[i].Replace('-', ' '), true);
var msg = await context.Channel.SendMessageAsync(embed: embedBuilder.Build());
List<IEmote> emotes = new List<IEmote>();
emotes.Add(Emoji.Parse(":one:"));
emotes.Add(Emoji.Parse(":two:"));
emotes.Add(Emoji.Parse(":three:"));
emotes.Add(Emoji.Parse(":four:"));
emotes.Add(Emoji.Parse(":five:"));
emotes.Add(Emoji.Parse(":six:"));
for (int i = 0; i < len; i++)
await msg.AddReactionAsync(emotes[i]);
}
for (var i = 0; i < len; i++) await msg.AddReactionAsync(emotes[i]);
}
}

View File

@@ -1,6 +1,5 @@
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
public class Random : DBCommand
@@ -11,7 +10,7 @@ public class Random : DBCommand
public string Usage => "random [number1] [number2]";
public bool canUseDM => true;
public bool canUseDM => true;
public bool canUseServer => true;
public bool requireAdmin => false;
@@ -19,19 +18,18 @@ public class Random : DBCommand
{
try
{
string msg = message.Content;
int a = int.Parse(msg.Split(' ')[1]);
int b = int.Parse(msg.Split(' ')[2]);
var msg = message.Content;
var a = int.Parse(msg.Split(' ')[1]);
var b = int.Parse(msg.Split(' ')[2]);
if (a > b)
{
int x = a;
var x = a;
a = b;
b = x;
}
await message.Channel.SendMessageAsync("Your random generated number is " + new System.Random().Next(a, b));
}
catch
{