removed gambling, tweaked reminders
master
Lan 5 years ago
parent 8832400594
commit 95d3b05eb3
  1. 53
      Kehyeedra3/Commands/Economy.cs
  2. 46
      Kehyeedra3/Commands/Stuff.cs
  3. 41
      Kehyeedra3/Services/ReminderService.cs

@ -962,60 +962,7 @@ namespace Kehyeedra3.Commands
}
await Context.Channel.SendMessageAsync($"Bank has {(suser.Money + user.Money).ToYeedraDisplay()}% left"/*\nSkuld can currently sell a maximum of {suser.Money * 64}₩ at 0.0001% = 64₩ exchange rate*/);
}
[Command("bet"), Summary("Gamble %coins in units of 0.0001%.")]
public async Task Gamble(int wager)
{
int res1 = SRandom.Next(0, 101);
int res2 = SRandom.Next(0, 101);
int loss = wager;
if (res1 > res2)
{
wager += wager;
}
else if (res1 < res2)
{
loss += wager;
}
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
var buser = Database.Users.FirstOrDefault(x => x.Id == 0);
if (user == null || user.Money < loss)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n You can't afford that, go back to the mines.");
return;
}
else
{
if (buser.Money > 100)
{
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), wager - loss))
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, gamble more and lose please.");
return;
}
await Database.SaveChangesAsync();
string result = "";
if ((wager - loss) > 0)
{
result = $"Rolled: **{res1}** against **{res2}**\nResult: +{((long)(wager - loss)).ToYeedraDisplay()}%\nBalance: {user.Money.ToYeedraDisplay()}%";
await ReplyAsync($"{Context.User.Mention}\n{result}");
}
if ((wager - loss) < 0)
{
result = $"Rolled: **{res1}** against **{res2}**\nResult: {((long)(wager - loss)).ToYeedraDisplay()}%\nBalance: {user.Money.ToYeedraDisplay()}%";
await ReplyAsync($"{Context.User.Mention}\n{result}");
}
}
else
{
await ReplyAsync($"{Context.User.Mention}\nHey, stop that.");
}
}
}
}
[Command("leaderboard"), Alias("top", "lb"), Summary("Shows the top 10 people in a leaderboard, currently available leaderboards: 'f, fish', 'm, money'.")]
public async Task Leaderboard(string type = null)
{

@ -108,7 +108,6 @@ namespace Kehyeedra3.Commands
{
string remin = "";
string refix = "";
string resuff = "";
ulong sen = (d * 86400) + (h * 3600) + (m * 60);
ulong yeedraStamp = DateTime.UtcNow.ToYeedraStamp();
@ -156,20 +155,19 @@ namespace Kehyeedra3.Commands
if (d == 0 && h == 0 && m == 0)
{
refix += "right now";
resuff += " just now";
}
else
{
refix += "in";
resuff += " ago";
}
if (sen != 0)
{
if (sen < 63072000)
{
var reminder = new Reminder
{
UserId = Context.User.Id,
Message = $"**Reminder from{remin}{resuff}:**\n\n''{r}''",
Message = $"{r}",
Created = yeedraStamp,
Send = sen + yeedraStamp
};
@ -183,23 +181,45 @@ namespace Kehyeedra3.Commands
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n Are you sure you need a reminder 2 years in the future..? \nAre you stupid?");
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}\n Ok, I'll remind you {refix}{remin}.");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nOk, I'll remind you {refix}{remin}.");
}
else
{
var dmchannel = await Bot._bot.GetUser(Context.User.Id).GetOrCreateDMChannelAsync();
await dmchannel.SendMessageAsync($"**You literally just told me to DM you:**\n\n{r}");
}
}
[Command("dab"), Summary("Dabs a person")]
public async Task Dab(IGuildUser user = null)
[Command("reminders",RunMode = RunMode.Async), Summary("List reminders")]
public async Task ListReminders(string manage = null)
{
if (user == null)
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
await Context.Channel.SendMessageAsync($"You put a dab of creamy sauce on your delicious, crunchy fishstick.\nYou have gained +5 calories.");
string rlist = "";
var user = Context.User;
foreach (Reminder reminder in Database.Reminders)
{
if (reminder.UserId == Context.User.Id)
{
rlist += $"ID: {reminder.Id} Made at: **GMT{reminder.Created.FromYeedraStamp()}**\n";
}
else
}
if (manage == null)
{
await Context.Channel.SendMessageAsync($"You give your good friend {user.Mention} a dab of creamy sauce to enjoy with their delicious, crunchy fishstick.\n{user.Mention} has gained +5 calories.");
await Context.Channel.SendMessageAsync(rlist);
return;
}
//else
//{
// await Context.Channel.SendMessageAsync($"Which reminder would you like to edit?\n\n{rlist}");
// var reply = await NextMessageAsync();
// long rep = long.Parse(reply.Content);
// if (rep ==)
//}
}
}
}

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Threading.Tasks;
using Kehyeedra3.Services.Models;
@ -13,7 +14,45 @@ namespace Kehyeedra3.Services
var dmchannel = await Bot._bot.GetUser(reminder.UserId).GetOrCreateDMChannelAsync();
if (dmchannel != null)
{
await dmchannel.SendMessageAsync(reminder.Message);
ulong m = (reminder.Send - reminder.Created) / 60;
ulong h = 0;
ulong d = 0;
while (m > 59)
{
h += 1;
m -= 60;
}
while (h > 23)
{
d += 1;
h -= 24;
}
string remin = "";
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";
}
}
await dmchannel.SendMessageAsync($"**Reminder from{remin} ago:**\n\n''{reminder.Message}''");
}
}
public async Task Tick()

Loading…
Cancel
Save