using Discord ;
using Discord.Addons.Interactive ;
using Discord.Commands ;
using Kehyeedra3.Services.Models ;
using Microsoft.EntityFrameworkCore.Storage ;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal ;
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.IO ;
using System.Linq ;
using System.Text ;
using System.Threading.Tasks ;
using ImageMagick ;
namespace Kehyeedra3.Commands
{
public class Stuff : InteractiveBase < SocketCommandContext > ///////////////////////////////////////////////
{
[Command("delet"), Summary("Posts a delet this image. Can be used on other channels.")]
public async Task DeletThis ( ITextChannel channel = null )
{
string imgdirpath = Path . Combine ( Environment . CurrentDirectory , "Delet" ) ;
DirectoryInfo imgdir = new DirectoryInfo ( imgdirpath ) ;
var files = imgdir . GetFiles ( ) ;
var item = files [ Bot . _ rnd . Next ( 0 , files . Length ) ] ;
if ( channel = = null )
{
await Context . Channel . SendFileAsync ( item . FullName ) ;
}
else
{
await channel . SendFileAsync ( item . FullName ) ;
}
}
[Command("ratenuts"), Summary("Rates your or another person's sack.")]
public async Task RateTrap ( string name = null )
{
int nutRating = SRandom . Next ( 0 , 3 0 1 ) ;
string nuts = "nuts" ;
if ( name = = null )
{
if ( Context . User . Id = = 5 3 4 8 5 9 7 2 6 0 9 0 0 1 0 6 7 2 )
{
nutRating - = 6 0 ;
}
if ( Context . User . Id = = 3 1 8 4 7 8 5 7 4 3 2 5 5 9 6 1 6 3 )
{
nutRating = SRandom . Next ( 1 0 0 0 0 0 0 , 1 0 0 0 0 0 0 0 ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nWarning: King, your african scale boss nuts have reached critical mass at {nutRating}g." ) ;
return ;
}
if ( Context . User . Id = = 2 4 2 0 4 0 3 3 3 3 0 9 8 3 7 3 2 7 | | Context . User . Id = = 1 9 4 5 3 8 5 8 3 6 4 9 0 2 6 0 4 9 )
{
nutRating + = 1 0 0 0 0 ;
}
if ( nutRating > 1 6 0 & & nutRating < 2 0 0 )
{
nutRating + = SRandom . Next ( nutRating , 1 0 0 0 1 ) ;
nuts = "boss nuts" ;
if ( nutRating > 1 0 0 0 0 )
{
nutRating = SRandom . Next ( nutRating , nutRating + 1 0 0 1 0 1 ) ;
nuts = "king size boss nuts" ;
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nCongrats king, your {nuts} weigh {nutRating}g." ) ;
return ;
}
if ( nutRating < 1 0 )
{
nutRating = SRandom . Next ( 1 0 0 , 2 0 0 1 ) ;
nuts = "tiny lady nuts" ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nHope you get better soon, your {nuts} weigh 0.{nutRating}g." ) ;
}
else
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYour {nuts} weigh {nutRating}g." ) ;
}
}
else
{
if ( name . Contains ( "534859726090010672" ) )
{
nutRating - = 6 0 ;
}
if ( name . Contains ( "318478574325596163" ) )
{
nutRating = SRandom . Next ( 1 0 0 0 0 0 0 , 1 0 0 0 0 0 0 0 ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nWarning: {name}'s african scale boss nuts have reached critical mass at {nutRating}g." ) ;
return ;
}
if ( name . Contains ( "242040333309837327" ) | | name . Contains ( "194538583649026049" ) )
{
nutRating + = 1 0 0 0 0 ;
}
if ( nutRating > 1 8 0 & & nutRating < 2 0 0 )
{
nuts = "boss nuts" ;
nutRating + = SRandom . Next ( nutRating , 1 0 0 0 1 ) ;
if ( nutRating > 1 0 0 0 0 )
{
nutRating = SRandom . Next ( nutRating , nutRating + 1 0 0 1 0 1 ) ;
nuts = "king size boss nuts" ;
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nCongrats {name}, your {nuts} weigh {nutRating}g." ) ;
return ;
}
if ( nutRating < 1 0 )
{
nutRating = SRandom . Next ( 1 0 0 , 2 0 0 1 ) ;
nuts = "tiny lady nuts" ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nSorry to hear about {name}, those {nuts} weigh 0.{nutRating}g." ) ;
}
else
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n{name}'s {nuts} weigh {nutRating}g." ) ;
}
}
}
[Command("ratertrap"), Summary("ratertrap")]
public async Task RaterTrap ( )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nPlease do not be like this man http://tinyurl.com/y7lj6nob" ) ;
}
[Command("8b"), Summary("Gives a prediction like a generic 8ball command that every self respecting discord bot must have")]
public async Task VapeBall ( [ Remainder ] string input )
{
Random rando = new Random ( ) ;
string [ ] predictions = new string [ ]
{
"No but you're still gay" ,
"I think so" ,
"Mayhaps" ,
"Yeah but you're still gay" ,
"No kys" ,
"Not today" ,
} ;
int randomIndex = rando . Next ( predictions . Length ) ;
string text = predictions [ randomIndex ] ;
await ReplyAsync ( $"{Context.User.Mention}\n{text}" ) ;
}
[Command("math"), Summary("It's a calculator, that's what compooter do")]
public async Task Mathboi ( [ Remainder ] string input )
{
string result = new DataTable ( ) . Compute ( input , null ) . ToString ( ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention} {input} = {result}" ) ;
}
[Command("roll"), Summary("Rolls dice. Eg. 'roll 20'")]
public async Task RollDice ( [ Remainder ] int input )
{
int output = SRandom . Next ( input + 1 ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n{output}" ) ;
}
[Command("remind"), Summary("Reminds you in a given time. (days, hours, minutes) Eg. 'remind 1 2 3 wash hands' would remind you in 1 day, 2 hours, 3 minutes to wash your hands")]
public async Task Reminder ( ulong d , ulong h , ulong m , [ Remainder ] string r = null )
{
string remin = "" ;
string refix = "" ;
ulong sen = ( d * 8 6 4 0 0 ) + ( h * 3 6 0 0 ) + ( m * 6 0 ) ;
ulong yeedraStamp = DateTime . UtcNow . ToYeedraStamp ( ) ;
if ( r = = null )
{
r = "Fill the text field next time you make a reminder." ;
}
while ( m > 5 9 )
{
h + = 1 ;
m - = 6 0 ;
}
while ( h > 2 3 )
{
d + = 1 ;
h - = 2 4 ;
}
if ( d > 0 )
{
remin + = $" {d} day" ;
if ( d > 1 )
{
remin + = $"s" ;
}
}
if ( h > 0 )
{
remin + = $" {h} hour" ;
if ( h > 1 )
{
remin + = $"s" ;
}
}
if ( m > 0 )
{
remin + = $" {m} minute" ;
if ( m > 1 )
{
remin + = $"s" ;
}
}
if ( d = = 0 & & h = = 0 & & m = = 0 )
{
refix + = "right now" ;
}
else
{
refix + = "in" ;
}
if ( sen ! = 0 )
{
if ( sen < 6 3 0 7 2 0 0 0 )
{
var reminder = new Reminder
{
UserId = Context . User . Id ,
Message = $"{r}" ,
Created = yeedraStamp ,
Send = sen + yeedraStamp
} ;
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
Database . Reminders . Add ( reminder ) ;
await Database . SaveChangesAsync ( ) . ConfigureAwait ( false ) ;
}
}
else
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nAre you sure you need a reminder 2 years in the future..? \nAre you stupid?" ) ;
return ;
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nOk, I'll remind you {refix}{remin}." ) ;
}
else
{
var dmchannel = await Bot . _ bot . GetUser ( Context . User . Id ) . CreateDMChannelAsync ( ) ;
await dmchannel . SendMessageAsync ( $"**You literally just told me to DM you:**\n\n{r}" ) ;
}
}
[Command("reminders",RunMode = RunMode.Async), Summary("List reminders")]
public async Task ListReminders ( string manage = null )
{
ulong d = 0 ;
ulong h = 0 ;
ulong m = 0 ;
string when = "" ;
string remin = "" ;
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
string rlist = "" ;
var user = Context . User ;
foreach ( Reminder reminder in Database . Reminders )
{
ulong yeedraStamp = DateTime . UtcNow . ToYeedraStamp ( ) ;
remin = "" ;
ulong ago = yeedraStamp - reminder . Created ;
while ( ago > 5 9 )
{
m + = 1 ;
ago - = 6 0 ;
}
while ( m > 5 9 )
{
h + = 1 ;
m - = 6 0 ;
}
while ( h > 2 3 )
{
d + = 1 ;
h - = 2 4 ;
}
if ( d > 0 )
{
remin + = $" {d} day" ;
if ( d > 1 )
{
remin + = $"s" ;
}
}
if ( h > 0 )
{
remin + = $" {h} hour" ;
if ( h > 1 )
{
remin + = $"s" ;
}
}
if ( m > 0 )
{
remin + = $" {m} minute" ;
if ( m > 1 )
{
remin + = $"s" ;
}
}
if ( d = = 0 & & h = = 0 & & m = = 0 )
{
when = " less than a minute ago." ;
}
else
{
when = $"{remin} ago." ;
}
m = 0 ;
h = 0 ;
d = 0 ;
if ( reminder . UserId = = Context . User . Id )
{
rlist + = $"Reminder ID: {reminder.Id} From{when} Contents: *{reminder.Message}*\n" ;
}
}
if ( rlist = = "" )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou haven't set any reminders." ) ;
return ;
}
if ( manage = = null )
{
await Context . Channel . SendMessageAsync ( rlist ) ;
return ;
}
else
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nWhich reminder would you like to edit?\n\n{rlist}" ) ;
var reply = await NextMessageAsync ( ) ;
ulong rep = ulong . Parse ( reply . Content ) ;
var rem = Database . Reminders . FirstOrDefault ( r = > r . Id = = rep & & r . UserId = = Context . User . Id ) ;
if ( rem = = null )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou have no such reminder." ) ;
return ;
}
else
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nWhat would you like to do? (edit/remove)" ) ;
reply = await NextMessageAsync ( ) ;
if ( reply . Content = = "edit" )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nInsert new reminder message." ) ;
reply = await NextMessageAsync ( ) ;
rem . Message = reply . Content ;
await Database . SaveChangesAsync ( ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nReminder updated." ) ;
}
else if ( reply . Content = = "remove" )
{
Database . Reminders . Remove ( rem ) ;
await Database . SaveChangesAsync ( ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nReminder removed." ) ;
}
else
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nInvalid action." ) ;
}
}
}
}
}
[Command("changenick")]
public async Task ChangeNickname ( IGuildUser usr = null , [ Remainder ] string name = null )
{
using var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) ;
var guild = Database . Guilds . FirstOrDefault ( x = > x . Id = = Context . Guild . Id ) ;
if ( guild = = null )
{
guild = new Guild
{
Id = Context . Guild . Id
} ;
Database . Guilds . Add ( guild ) ;
}
if ( guild . Changenick )
{
if ( usr = = null | | usr = = Context . User | | name = = null )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYeah you gotta ping someone else and write a name, retard" ) ;
return ;
}
else
{
await usr . ModifyAsync ( x = > x . Nickname = $"{name}" ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nLet's fucking goooo" ) ;
}
}
else
{
await ReplyAsync ( $"{Context.User.Mention}\nServer admins can enable this command using 'enable changenick'." ) ;
}
}
[Command("schizo"),Alias("sz"), Summary("Replaces your message with a red or blue variant, for use with funny seacat schizo game. There's also an orange for posting the 'original story'")]
public async Task SchizoGame ( string colour , [ Remainder ] string message )
{
using var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) ;
var guild = Database . Guilds . FirstOrDefault ( x = > x . Id = = Context . Guild . Id ) ;
string msg = "" ;
if ( guild = = null )
{
guild = new Guild
{
Id = Context . Guild . Id
} ;
Database . Guilds . Add ( guild ) ;
}
if ( ! guild . Schizogame )
{
await ReplyAsync ( $"{Context.User.Mention}\nThis command can be enabled by an admin on the server." ) ;
return ;
}
if ( Context . Channel . Id = = 0 )
{
await ReplyAsync ( $"{Context.User.Mention}\nYou gots to set the schizo channel??" ) ;
return ;
}
if ( Context . Channel . Id ! = guild . SchizoChannel )
{
await ReplyAsync ( $"{Context.User.Mention}\nWrong channel??" ) ;
return ;
}
colour = colour . ToLowerInvariant ( ) ;
if ( colour = = "red" | | colour = = "r" )
{
var guser = Context . User as IGuildUser ;
if ( guser . RoleIds . Contains ( guild . WitchRole ) )
{
msg = $"```diff\n- {message} ```" ;
await ReplyAsync ( msg ) ;
}
else
{
await ReplyAsync ( $"{Context.User.Mention}\nYOU are not the WITCH! YOU are a BITCH!" ) ;
return ;
}
}
else if ( colour = = "blue" | | colour = = "b" )
{
msg = $"```ini\n[ {message} ]```" ;
await ReplyAsync ( msg ) ;
}
else if ( colour = = "orange" | | colour = = "o" )
{
var guser = Context . User as IGuildUser ;
if ( guser . RoleIds . Contains ( guild . WitchRole ) )
{
msg = $"```css\n[ {message} ]```" ;
await ReplyAsync ( msg ) ;
}
else
{
await ReplyAsync ( $"{Context.User.Mention}\nYOU are not the WITCH! YOU are a BITCH!" ) ;
return ;
}
}
else
{
await ReplyAsync ( $"bruH! you gotta use red or blue! BRUH! r or b works also! bruh! ong WITH cap! MID AF!" ) ;
return ;
}
if ( guild . SchizoLogChannel > 0 )
{
await Context . Guild . GetTextChannel ( guild . SchizoLogChannel ) . SendMessageAsync ( msg ) ;
}
await Context . Message . DeleteAsync ( ) ;
}
}
}