private Embed generateErrorEmbed(SocketUser user, IResult result, SocketUserMessage msg) { EmbedAuthorBuilder author = new EmbedAuthorBuilder(); author.Name = user.Username + "#" + user.Discriminator; if (Uri.IsWellFormedUriString(user.GetAvatarUrl(), UriKind.Absolute)) { author.IconUrl = user.GetAvatarUrl(); } if (msg.Channel.GetType() != typeof(SocketDMChannel)) { author.Url = msg.GetJumpUrl(); } EmbedBuilder builder = new EmbedBuilder { Author = author, Title = "A fatal error has occured. User message content: " + msg.Content, Description = result.Error + "\n```" + result.ErrorReason + "```", Color = Color.Red }; builder.AddField("Channel Type", (msg.Channel.GetType() == typeof(SocketDMChannel) ? "DM" : "Guild") + " Channel"); builder.WithCurrentTimestamp(); return(builder.Build()); }
public async Task HelpAsync() { EmbedBuilder embed = new EmbedBuilder(); SocketUser user = Context.Message.Author; if (user.GetAvatarUrl() == null) { avatar = user.GetDefaultAvatarUrl(); } else { avatar = user.GetAvatarUrl(); } embed.WithAuthor(user.ToString(), avatar); embed.WithTitle(Context.Client.CurrentUser.Username.ToString() + " " + "Command options!"); embed.WithThumbnailUrl("https://i.imgur.com/dq4HKJr.png"); embed.WithDescription("**INFO: this bot is in `beta` and some of these features may not have full functionality yet*"); embed.AddField("`.j` / `.join`", "Joins voice channel that you are connected to!"); embed.AddField("`.p` / `.play`", "Starts playing in connected voice channel!"); embed.AddField("`.pp` / `.pause`", "Pause playback!"); embed.AddField("`.r` / `.resume`", "Resumes playback!"); embed.AddField("`.ss` / `.skip`", "Stops current song and moves to the next! (requires majority of all users in current voice channel)"); embed.AddField("`.v` / `.volume`", "Ajusts the players volume!"); embed.AddField("`.s` / `.stop`", "Stops playback! (removes all songs from queue)"); embed.AddField("`.l` / `.leave`", "Leave current voice channel!"); embed.AddField("`.q` / `.queue`", "View all songs in queue!"); embed.AddField("`.rp` / `.repeat`", "Infinate queue! (at the end of a song, it is re-added to queue at end)"); embed.AddField("`.list`", "Playlist manager main command!"); embed.AddField("`.list create <playlist name>`", "Create new playlist!"); embed.AddField("`.list del <playlist name>`", "Delete playlist and all its contents!"); embed.AddField("`.list add <playlist name> <track name>`", "Adds a track to the playlist"); embed.AddField("`.list rem <playlist name> <track name>`", "removes a track from playlist"); await ReplyAsync(null, false, embed.Build()); }
static Embed GenUser(SocketUser user) { EmbedBuilder em = new EmbedBuilder(); em.Color = Discord.Color.Blue; em.ThumbnailUrl = user.GetAvatarUrl(); EmbedAuthorBuilder eab = new EmbedAuthorBuilder(); eab.Url = user.GetAvatarUrl(); eab.Name = $"{user.Username}#{user.Discriminator}"; eab.IconUrl = user.GetAvatarUrl(); em.Author = eab; var joined = Program.client.GetGuild(ConfigUtils.Configuration.ServerID).GetUser(user.Id).JoinedAt; em.AddField("Registered: ", $"{user.CreatedAt.DateTime.ToLongDateString()} at {user.CreatedAt.DateTime.ToLongTimeString()}"); em.AddField("Joined: ", $"{joined.Value.DateTime.ToLongDateString()} at {joined.Value.DateTime.ToLongTimeString()}"); string nick = Program.client.GetGuild(ConfigUtils.Configuration.ServerID).GetUser(user.Id).Nickname; if (nick == null) { nick = "none"; } em.AddField("Nickname: ", nick); em.AddField("ID: ", user.Id.ToString()); string game = "none"; if (user.Game.HasValue) { game = user.Game.Value.Name; } em.AddField("Game: ", game); string roles = ""; int i = 0; foreach (SocketRole role in Program.client.GetGuild(ConfigUtils.Configuration.ServerID).GetUser(user.Id).Roles) { roles += $"`{role.Name}`"; if (i < Program.client.GetGuild(ConfigUtils.Configuration.ServerID).GetUser(user.Id).Roles.Count - 1) { roles += ", "; } i++; } if (roles == "") { roles = "none"; } em.AddField("Roles: ", roles); if (user.IsBot) { em.AddField("Is a bot: ", "Yes"); } else { em.AddField("Is a bot: ", "No"); } return(em.Build()); }
public static async Task GameTimeout(SocketUser user, BlackjackGame game) { { EmbedBuilder eb = new EmbedBuilder(); var bot = game.Message.Author.Id; game.Stand(); if (game.SumHand(game.Hand) > 21) { await BalanceDb.AddToasties(bot, game.Toasties, game.Channel.Guild.Id); eb.WithAuthor(user.Username + " | Timeout", user.GetAvatarUrl()); eb.WithDescription("Your hand is a bust. You lose `" + game.Toasties + "` " + ToastieUtil.RandomEmote() + "\n" + "New balance `" + BalanceDb.GetToasties(user.Id, game.Channel.Guild.Id) + "` " + ToastieUtil.RandomEmote()); eb.WithColor(Color.DarkRed); } else if (game.SumHand(game.Hand) > game.SumHand(game.Dealer) || game.SumHand(game.Dealer) > 21) { await BalanceDb.AddToasties(user.Id, game.Toasties * 2, game.Channel.Guild.Id); await BalanceDb.AddToasties(bot, -game.Toasties, game.Channel.Guild.Id); eb.WithAuthor(user.Username + " | Timeout", user.GetAvatarUrl()); eb.WithDescription("Your score is higher than Namiko's. You win `" + game.Toasties + "` " + ToastieUtil.RandomEmote() + "\n" + "New balance `" + BalanceDb.GetToasties(user.Id, game.Channel.Guild.Id) + "` " + ToastieUtil.RandomEmote()); eb.WithColor(Color.Gold); } else if (game.SumHand(game.Hand) == game.SumHand(game.Dealer)) { await BalanceDb.AddToasties(user.Id, game.Toasties, game.Channel.Guild.Id); eb.WithAuthor(user.Username + " | Timeout", user.GetAvatarUrl()); eb.WithDescription("Your score is tied with Namiko's. You get your " + ToastieUtil.RandomEmote() + " back!\n" + "Your balance `" + BalanceDb.GetToasties(user.Id, game.Channel.Guild.Id) + "` " + ToastieUtil.RandomEmote()); eb.WithColor(Color.DarkGreen); } else { await BalanceDb.AddToasties(bot, game.Toasties, game.Channel.Guild.Id); eb.WithAuthor(user.Username + " | Timeout", user.GetAvatarUrl()); eb.WithDescription("Namiko's score is higher. You lose `" + game.Toasties + "` " + ToastieUtil.RandomEmote() + "\n" + "New balance `" + BalanceDb.GetToasties(user.Id, game.Channel.Guild.Id) + "` " + ToastieUtil.RandomEmote()); eb.WithColor(Color.DarkRed); } eb.AddField("Your hand (" + game.SumHand(game.Hand) + ")", HandToString(game.Hand, false), true); eb.AddField("Namiko's hand (" + game.SumHand(game.Dealer) + ")", HandToString(game.Dealer, false), true); await Send(game, eb); games.Remove(user); } }
public Embed GenerateEmbed(GelbooruPost post, uint postCount, SocketUser user) { EmbedBuilder postEmbed; if (post != null) { string formattedTags = "`" + post.tags.TrimStart().TrimEnd().Replace(" ", "` `") + "`"; string finalTags; if (formattedTags.Length > 1024) { finalTags = formattedTags.Substring(0, 1020) + "`..."; } else { finalTags = formattedTags; } postEmbed = new EmbedBuilder() { Author = new EmbedAuthorBuilder() { IconUrl = user.GetAvatarUrl(), Name = $"Requested by {user.Username}" }, Title = $"{post.id}", Url = $"https://gelbooru.com/index.php?page=post&s=view&id={post.id}", Fields = new List <EmbedFieldBuilder>() { new EmbedFieldBuilder() { Name = "Tags", Value = finalTags } }, ImageUrl = post.sample_url ?? post.preview_url, Footer = new EmbedFooterBuilder() { Text = $"{postCount} results" } }; } else { postEmbed = new EmbedBuilder() { Author = new EmbedAuthorBuilder() { IconUrl = user.GetAvatarUrl(), Name = $"Requested by {user.Username}" }, Description = "No posts available." }; } return(postEmbed.Build()); }
public static async Task UserUpdated(SocketUser cachedUser, SocketUser user) { if (user.Username != cachedUser.Username || user.GetAvatarUrl() != cachedUser.GetAvatarUrl()) // If user has updated username or avatar { List <(string, string)> queryParams = new List <(string, string)>() { ("@username", user.Username), ("@avatarUrl", user.GetAvatarUrl()) }; DatabaseActivity.ExecuteNonQueryCommand("UPDATE users SET username=@username, avatarUrl=@avatarUrl WHERE id='" + user.Id + "';", queryParams); } }
public string LevelUp(SocketUser contextUser, User user) { // Getting User's Avatar Bitmap bmpAvatar; Stream responseStream; if (contextUser.GetAvatarUrl() == null) { System.Net.WebRequest request = System.Net.WebRequest.Create(contextUser.GetDefaultAvatarUrl()); System.Net.WebResponse response = request.GetResponse(); responseStream = response.GetResponseStream(); } else { System.Net.WebRequest request = System.Net.WebRequest.Create(contextUser.GetAvatarUrl()); System.Net.WebResponse response = request.GetResponse(); responseStream = response.GetResponseStream(); } bmpAvatar = new Bitmap(responseStream); Bitmap result = new Bitmap(350, 120); using (Graphics g = Graphics.FromImage(result)) using (StringFormat sf = new StringFormat()) using (SolidBrush b = new SolidBrush(Color.Black)) { g.Clear(m_clrUserInfoBG); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; g.DrawImage(bmpAvatar, 15, 15, 90, 90); using (Font f = new Font(FontCollection.Families[0], 14, FontStyle.Bold)) g.DrawString(Truncate(contextUser.Username.ToUpper(), 11), f, b, new Rectangle(m_nMargin, m_nAvatar + 2 * m_nMargin, 300, 28)); using (Font f = new Font(FontCollection.Families[0], 20, FontStyle.Bold)) g.DrawString("Congratulations!", f, b, new Rectangle(110, 15, 250, 35)); using (Font f = new Font(FontCollection.Families[0], 14, FontStyle.Regular)) g.DrawString("On reaching Level " + user.Level + "", f, b, new Rectangle(111, 48, 250, 25)); } result.Save(Path.Combine(FilePath, user.UserID + ".png"), ImageFormat.Png); return(user.UserID + ".png"); }
public async Task Warm(SocketUser user = null, [Remainder] string input = "") { if (user == null) { await BetterReplyAsync("You must provide a user to warm.", parameters : $"user null; {input}"); return; } await Context.Channel.TriggerTypingAsync(); try { Task <MemoryStream> download = Http.GetStreamAsync(user.GetAvatarUrl(ImageFormat.Png, 256)); using MemoryStream data = await download; if (download.IsCompletedSuccessfully) { using MemoryStream stream = new MemoryStream(256); using MagickImage image = new MagickImage(Cache.GetStream("warm.png")); using MagickImage avatar = new MagickImage(data) { BackgroundColor = new MagickColor(0, 0, 0, 0) }; avatar.Resize(225, 225); avatar.Rotate(-5.5); image.Composite(avatar, 160, 132, CompositeOperator.Atop); image.Resize(256, 256); image.Write(stream, MagickFormat.Png); stream.Seek(0, SeekOrigin.Begin); await BetterSendFileAsync(stream, "warm.png", $"{BetterUserFormat(user)} has been warmed{(string.IsNullOrWhiteSpace(input) ? "" : $" for `{input}`")}.", parameters : $"{user} ({user.Id}); {input}");
public async Task WsashiStats([Remainder] string arg = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var userAccount = GlobalUserAccounts.GetUserAccount(target); uint Level = userAccount.LevelNumber; GlobalUserAccounts.SaveAccounts(); var xp = userAccount.XP; var requiredXp = (Math.Pow(userAccount.LevelNumber + 1, 2) * 50); var thumbnailurl = target.GetAvatarUrl(); var auth = new EmbedAuthorBuilder() { Name = target.Username, IconUrl = thumbnailurl, }; var embed = new EmbedBuilder() { Author = auth }; embed.WithColor(37, 152, 255); embed.AddField("Lvl.", Level, true); embed.AddField("Exp.", $"{xp}/{requiredXp} (tot. {userAccount.XP})", true); await Context.Channel.SendMessageAsync("", embed : embed.Build()); }
public static async Task BBTAG_Set_List(SocialLinkerCommand sl_command) { // Create two variables for the command user and the command channel, derived from the message object taken in. SocketUser user = sl_command.User; SocketTextChannel channel = (SocketTextChannel)sl_command.Channel; // Get the account information of the command's user. var account = UserInfoClasses.GetAccount(user); var embed = new EmbedBuilder(); var author = new EmbedAuthorBuilder { Name = "BlazBlue: Cross Tag Battle Sprite Sets", IconUrl = user.GetAvatarUrl() }; embed.WithAuthor(author); // Assign an embed color and thumbnail based on the user's episode header setting for the BBTAG template. embed.WithColor(EmbedSettings.Get_Game_Color("BBTAG", account)); embed.WithThumbnailUrl(EmbedSettings.Get_Game_Logo("BBTAG")); // Create a description with the list of sprite sets available for the title. embed.WithDescription($"{OfficialSetMethods.Generate_BBTAG_Set_List()}"); // Send the embeded message to the channel. await channel.SendMessageAsync("", false, embed.Build()); }
public static async Task Scene_Upload_Failed(SocketUser user, ISocketMessageChannel channel) { // Get the account information of the command's target var account = UserInfoClasses.GetAccount(user); var embed = new EmbedBuilder(); var author = new EmbedAuthorBuilder { Name = "Image Upload Failed", IconUrl = user.GetAvatarUrl() }; embed.WithAuthor(author); // Determine the color and thumbnail for the embeded message. embed.WithColor(Get_Profile_Embed_Color(account)); embed.WithThumbnailUrl(Get_Profile_Help_Thumbnail(account)); // Write an appropriate description for the error. embed.WithDescription("Something went wrong while trying to upload the image. Try again soon."); var error_message = await channel.SendMessageAsync("", false, embed.Build()); Timer error_timer = new Timer() { // Create a timer that expires as a "time out" duration for the user. Interval = error_duration, AutoReset = false, Enabled = true }; // If the timer runs out, activate a function. error_timer.Elapsed += (sender, e) => ErrorTimer_Elapsed(sender, e, error_message, account); }
private async Task _client_UserBanned(SocketUser User, SocketGuild Guild) { var guildobj = DatabaseHandler.GetGuild(Guild.Id); if (!guildobj.EventLogger.Settings.guilduserbanned) { return; } if (guildobj.EventLogger.LogEvents) { var embed = new EmbedBuilder { Title = "User Banned", ThumbnailUrl = User.GetAvatarUrl(), Description = $"**Username:** {User.Username}", Color = Color.DarkRed, Footer = new EmbedFooterBuilder { Text = $"{DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)} UTC TIME" } }; //await guildobj.EventLog(embed, Guild); await LogEvent(guildobj, Guild, embed); } }
public static async Task P5S_Set_List(SocialLinkerCommand sl_command) { // Create two variables for the command user and the command channel, derived from the message object taken in. SocketUser user = sl_command.User; SocketTextChannel channel = (SocketTextChannel)sl_command.Channel; // Get the account information of the command's user. var account = UserInfoClasses.GetAccount(user); var embed = new EmbedBuilder(); var author = new EmbedAuthorBuilder { Name = "Persona 5 Strikers Conversation Portrait Sets", IconUrl = user.GetAvatarUrl() }; embed.WithAuthor(author); // Set the color and thumbnail for the embeded message. embed.WithColor(EmbedSettings.Get_Game_Color("P5S", null)); embed.WithThumbnailUrl(EmbedSettings.Get_Game_Logo("P5S")); // Create a description with the list of sprite sets available for the title. embed.WithDescription($"{OfficialSetMethods.Generate_Normal_Set_List("P5S")}"); // Send the embeded message to the channel. await channel.SendMessageAsync("", false, embed.Build()); }
public async Task Stats([Remainder] string arg = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var userAccountt = GlobalGuildUserAccounts.GetUserID((SocketGuildUser)target); var userAccount = GlobalUserAccounts.GetUserAccount(target); uint Level = userAccount.LevelNumber; var xp = userAccount.XP; var requiredXp = (Math.Pow(userAccount.LevelNumber + 1, 2) * 50); var thumbnailurl = target.GetAvatarUrl(); var auth = new EmbedAuthorBuilder() { Name = target.Username, IconUrl = thumbnailurl, }; var embed = new EmbedBuilder() { Author = auth }; embed.WithColor(Global.NayuColor); embed.AddField("Affection Lvl.", Level, true); embed.AddField("Exp.", $"{xp}/{requiredXp} (tot. {userAccount.XP})", true); embed.AddField("Reputation Points", userAccountt.Reputation, true); embed.AddField("Taiyaki", userAccount.Taiyaki, true); embed.AddField("Taiyaki From Messages", userAccount.TaiyakiFromMessages, true); embed.AddField("Taiyaki From Gambling", userAccount.TaiyakiFromGambling, true); embed.AddField("Active Chomusuke", userAccount.ActiveChomusuke); await SendMessage(Context, embed.Build()); }
public async Task Succ([Remainder] string args = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); if (mentionedUser == null) { await Context.Channel.SendFileAsync(dir + "succ.png"); return; } target = mentionedUser ?? Context.User; string avatarUrl = target.GetAvatarUrl(); var guildUser = (SocketGuildUser)target; string css = "<style>\n #avatar{\n position: absolute;\n top: 377px;\n left: 175px;\n z-index: 1;\n width: 65px;\n height: 65px;\n }\n body {\n margin: 0;\n }\n</style>"; string imgpath = "https://cdn.discordapp.com/attachments/464773560393662465/475988185915195402/succ_edit.png"; string body = "\n<img id=\"back\" src=\"" + imgpath + "\">\n"; string avatarhtml = "<img id=\"avatar\" src = \"" + avatarUrl + "\">"; string fullhtml = css + body + avatarhtml; var converter = new HtmlToImageConverter { Width = 375, Height = 535 }; var jpgBytes = converter.GenerateImage(fullhtml, NReco.ImageGenerator.ImageFormat.Jpeg); await Context.Channel.SendFileAsync(new System.IO.MemoryStream(jpgBytes), "succd.jpg"); }
public async Task Stats([Remainder] string arg = "") { try { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var account = UserAccounts.GetAccount(target); var embed = new EmbedBuilder(); embed.WithTitle(target.Username + "'s Stats"); embed.WithDescription($"requested by {Context.User.Username}!"); embed.AddInlineField("Level", account.LevelNumber); embed.AddInlineField("XP", account.XP); embed.AddInlineField("Reputation", account.Rep); embed.WithColor(new Color(0, 255, 255)); embed.WithThumbnailUrl(target.GetAvatarUrl()); await Context.Channel.SendMessageAsync("", false, embed.Build()); } catch (Exception e) { Misc.ExceptionAlert(Context, e); } }
public static Embed GetEmbedMessage(string messageTitle, string fieldTitle, string fieldContents, SocketUser user, EmbedFooterBuilder fb = null) { EmbedBuilder eb = new EmbedBuilder(); if (user != null) { if (fb == null && user != null) { fb = new EmbedFooterBuilder(); fb.WithText(PremiumUtils.SelectFooterEmbedText(user));; fb.WithIconUrl(user.GetAvatarUrl()); } eb.WithTitle($"{messageTitle}"); eb.AddField($"{fieldTitle}", $"{fieldContents}"); eb.WithColor(PremiumUtils.SelectEmbedColour(user)); eb.WithFooter(fb); return(eb.Build()); } else { eb.WithTitle($"{messageTitle}"); eb.AddField($"{fieldTitle}", $"{fieldContents}"); eb.WithColor(Color.Red); eb.WithFooter(fb); return(eb.Build()); } }
public async Task GetLVL([Remainder] string arg = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var account = UserAccounts.GetAccount(target); string rank = UserAccounts.assignRank(account); string message = $"Level: {account.LVL}\n" + $"{target.Username}'s XP is: {account.XP}/ {account.LVL * 500}\n" + $"and has a balance of {account.PEBBLES}"; string title = $"Rank: {rank}"; var embed = new EmbedBuilder(); embed.WithTitle(title); embed.WithFooter("", "https://i.imgur.com/9Y0vuCO.png"); embed.WithDescription(message); embed.WithColor(new Color(0, 255, 0)); embed.ThumbnailUrl = target.GetAvatarUrl().ToString(); await Context.Channel.SendMessageAsync("", false, embed); }
public async Task ExecuteAsync(int amount, SocketUser user = null) { user = user ?? Context.User; var hex = Configuration["EmbedColorHex"]; var currencyName = Configuration["CurrencyName"]; var embed = new EmbedBuilder() .WithColor(new Color(Convert.ToUInt32(hex, 16))) .WithAuthor(user.Username, user.GetAvatarUrl()) .WithFooter(Context.Client.CurrentUser.Username, Context.Client.CurrentUser.GetAvatarUrl()) .WithCurrentTimestamp(); using (var _dbContext = new BotContext()) { var _user = await _dbContext.Users.FindAsync(user.Id.ToString()); if (_user == null) { embed.WithDescription("User not found!"); await ReplyAsync(embed : embed.Build()); return; } _user.Points = amount; embed.WithDescription($"Set **{amount}** {currencyName} for {user.Mention}."); await _dbContext.SaveChangesAsync(); await ReplyAsync(embed : embed.Build()); } }
public async Task ExecuteAsync(SocketUser user = null) { var hex = Configuration["EmbedColorHex"]; var embed = new EmbedBuilder() .WithColor(new Color(Convert.ToUInt32(hex, 16))) .WithFooter(Context.Client.CurrentUser.Username, Context.Client.CurrentUser.GetAvatarUrl()) .WithCurrentTimestamp(); using (var _dbContext = new BotContext()) { user = user ?? Context.User; embed.WithAuthor(user.Username, user.GetAvatarUrl()); var _user = await _dbContext.Users.FindAsync(user.Id.ToString()); if (_user == null) { embed.WithDescription("User not in database."); await ReplyAsync(embed : embed.Build()); return; } var currencyName = Configuration["CurrencyName"]; embed.AddField("Balance", $"{_user.Points} {currencyName}"); await ReplyAsync(embed : embed.Build()); } }
public override Embed GetEmbed() { EmbedBuilder eb = new EmbedBuilder(); if (!string.IsNullOrWhiteSpace(Data.Nickname)) { eb.WithTitle(Data.Nickname); } else { eb.WithTitle(Data.Username); } eb.WithColor(Data.ProfileColor); eb.WithThumbnailUrl(User.GetAvatarUrl()); eb.AddField("Title", GetTitle()); eb.AddField("Total Activity Rating", Data.Score.ToString(), true); eb.AddField("Kamtrokens", Data.Kamtrokens, true); eb.AddField("Reputation Score", Data.Reputation.ToString(), true); eb.AddField("Legacy Score", Data.LegacyScore.ToString(), true); eb.AddField("Max Reputation per Week", Data.MaxReputation, true); eb.AddField("Titles Obtained", GetTitleList(), true); if (!string.IsNullOrWhiteSpace(Data.Quote)) { eb.WithFooter(Data.Quote); } return(eb.Build()); }
public async Task removePoints(uint Points, [Remainder] string args = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; Random rand = new Random(); int R = rand.Next(0, 256); int G = rand.Next(0, 256); int B = rand.Next(0, 256); var account = UserAccounts.getAccount(target); account.Points -= Points; if (account.Points < 0) { account.Points = 0; } UserAccounts.saveAccounts(); var embed = new EmbedBuilder(); embed.WithTitle("Stole points!"); embed.WithThumbnailUrl(target.GetAvatarUrl()); embed.WithColor(new Color(R, G, B)); embed.WithDescription($"Stole {Points} from {target.Username}! yeet'd"); await Context.Channel.SendMessageAsync("", false, embed); }
public async Task TextAvatar(SocketUser user = null, String text = "TEXT", String text1 = "", String text2 = "", String text3 = "", String text4 = "") { int nbArgument = 1; if (text4 != "") { nbArgument = 5; } if (text3 != "" && text4 == "") { nbArgument = 4; } if (text2 != "" && text3 == "") { nbArgument = 3; } if (text1 != "" && text2 == "") { nbArgument = 2; } EditImage editImage = new EditImage(CDN.GetUserAvatarUrl(user.Id, user.AvatarId, 512, ImageFormat.Auto)); Console.WriteLine(user.GetAvatarUrl()); editImage.writeMessageOnImage(text, text1, text2, text3, text4, nbArgument); await Context.Channel.SendFileAsync("image\\update.png"); }
public async Task AvatarTask(SocketUser user, ImageFormat format, ushort size) { EmbedBuilder output = new EmbedBuilder(); output.WithImageUrl(user.GetAvatarUrl(format, size)); await ReplyAsync("", embed : output.Build()); }
public async Task addXP(uint xp, string arg = "") { try { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var u = Context.User as SocketGuildUser; var permission = u.GuildPermissions.Administrator; if (!permission) { await Context.Channel.SendMessageAsync(":x: You do not have permission to use this command " + Context.User.Mention + "!"); return; } var account = UserAccounts.GetAccount(Context.User); account.XP += xp; UserAccounts.SaveAccounts(); var embed = new EmbedBuilder(); embed.WithTitle($"{target.Username}has been given {xp} XP"); embed.WithDescription($"by {Context.User.Username}."); embed.AddInlineField("Level", account.LevelNumber); embed.AddInlineField("XP", account.XP); embed.WithColor(new Color(0, 255, 255)); embed.WithThumbnailUrl(target.GetAvatarUrl()); await Context.Channel.SendMessageAsync("", false, embed.Build()); } catch (Exception e) { Misc.ExceptionAlert(Context, e); } }
public async Task info(SocketUser user = null) { if (user == null) { user = Context.Message.Author; } dbase.chkserver(Context.Guild); string query = "SELECT * FROM uzytkownicy as u INNER JOIN `servery` as s ON u.Server = s.id WHERE u.user='******' AND s.nid='" + Context.Guild.Id.ToString() + "'"; MySqlCommand cmd = new MySqlCommand(query, dbase.connect); if (!dbase.HasRows(cmd)) { query = "INSERT INTO `uzytkownicy`(`id`, `user`, `score`, `ranks`, `level`, `link`, `server`) VALUES (null,'" + user.Id.ToString() + "',0 ,null ,1 ,null, '" + dbase.Chkserver(Context.Guild.Id.ToString()) + "')"; cmd = new MySqlCommand(query, dbase.connect); dbase.make(cmd); query = "SELECT * FROM `uzytkownicy` as u INNER JOIN `servery` as s ON u.Server = s.id WHERE u.user='******' AND s.nid='" + Context.Guild.Id.ToString() + "'"; cmd = new MySqlCommand(query, dbase.connect); } DataTable info = dbase.Read(cmd); var builder = new Discord.EmbedBuilder(); builder.WithTitle("Informacje o uzytkowniku " + user.Username); builder.WithThumbnailUrl(user.GetAvatarUrl()); builder.AddField("Ilość punktów:", info.Rows[0][2]); builder.AddInlineField("Poziom:", info.Rows[0][4]); if (info.Rows[0][5] != null && info.Rows[0][5].ToString() != "") { builder.AddInlineField("Deviantart:", info.Rows[0][5].ToString()); } builder.WithColor(Color.DarkGreen); await Context.Channel.SendMessageAsync("", false, builder); }
public async Task ProfileAsync(SocketUser user) { if (!FileSystem.UserExists(user)) { await ReplyAsync("User isn't registered"); return; } FileSystem.UpdateUser(user); Profile profile = new Profile(user); EmbedBuilder e = new EmbedBuilder(); object money = profile.Money + " ℄"; e.WithColor(Color.Blue); e.WithTitle(user.Username); e.WithThumbnailUrl(user.GetAvatarUrl()); e.AddField("LewdCoins", money, false); e.AddField("Registered at", profile.RegisterDate, true); e.AddField("PlayerID", profile.PlayerID, true); await ReplyAsync("", embed : e.Build()); }
public async Task Profile(SocketUser user = null) { user = user == null ? Context.User : user; int index = Config.Profiles.FindIndex(x => x.UserID == user.Id); if (index == -1) { Extensions.Log("Error", $"Couldn't find profile for {user.Username}"); await Context.Channel.SendEmbedAsync($"Error", $"Couldn't find profile for {user.GetText()}"); return; } Profile profile = Config.Profiles[index]; EmbedBuilder embed = new EmbedBuilder { Color = Color.Purple, Author = new EmbedAuthorBuilder { IconUrl = user.GetAvatarUrl(), Name = user.Username } }; embed.AddField("Level", profile.Level); embed.AddField("Credit", profile.Credit); embed.AddField("Exp", $"{profile.GetExpBar()} ({profile.Exp} / {profile.GetMaxExp()})"); await Context.Channel.SendMessageAsync("", false, embed.Build()); }
public async Task Account(SocketUser user) { var account = UserAccounts.GetAccount(user); var descripitionBuilder = new StringBuilder(); var socketGuildUser = (SocketGuildUser)user; descripitionBuilder.Append ($"__**Discord Info**__\n" + $"**Name**: {user.Username}\n" + $"**Joined At**: {socketGuildUser.JoinedAt}\n" + $"**Current Status**: {socketGuildUser.Status}\n" + $"**Current Nickname**: {socketGuildUser.Nickname}\n" + $"\n**__Guild Info__**\n" + $"**Guild Rank**: {account.GuildRank}\n" + $"**Returning For Next Tier**: {account.ReturningForNextRaid}\n" + $"**Player Is Trial Raider**: {account.IsTrial}\n" + $"**Wow Main**: {account.MainChar}\n" + $"**Main Spec**: {account.MainSpec}\n" + $"**Main Alt**: {account.WowAlt}\n " + $"**Alt's Spec**: {account.WowAltSpec}\n" + $"\n__**Report Info**__\n" + $"**Created Reports**: {account.ReportMade}\n" + $"**User Reports**: {account.OwnReports}\n"); if (account.AdminReports == 0) { descripitionBuilder.Append($"They currently have no Admin reports against them.\n"); } else { descripitionBuilder.Append($"**Admin Reports**: {account.AdminReports}\n"); } if (account.RaidsMissedWithReason == 0 && account.RaidsMissedNoReason == 0) { descripitionBuilder.Append($"They've Currently not missed any raids.\n"); } if (account.RaidsMissedWithReason > 0) { descripitionBuilder.Append($"**Raids Missed With Reason**: {account.RaidsMissedWithReason}\n"); } if (account.RaidsMissedNoReason > 0 && account.RaidsMissedNoReason < 4) { descripitionBuilder.Append($"**Raids Missed No Reason**: {account.RaidsMissedNoReason}\n"); } if (account.RaidsMissedNoReason > 4) { descripitionBuilder.Append($"\n🛑__**{user.Username.ToUpper()} HAS NOW MISSED {account.RaidsMissedNoReason} RAIDS WITH NO REASON**__🛑"); } var description = descripitionBuilder.ToString(); var embed = new EmbedBuilder() .WithTitle($"{user.Username} Guild Account Details") .WithCurrentTimestamp() .WithColor(Color.DarkTeal) .WithThumbnailUrl(user.GetAvatarUrl()) .WithDescription(description); await ReplyAsync("", false, embed.Build()); }
public async Task addEXP(uint EXP, [Remainder] string args = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; Random rand = new Random(); int R = rand.Next(0, 256); int G = rand.Next(0, 256); int B = rand.Next(0, 256); var account = UserAccounts.getAccount(target); account.EXP += EXP; UserAccounts.saveAccounts(); var embed = new EmbedBuilder(); embed.WithTitle("Added EXP!"); embed.WithThumbnailUrl(target.GetAvatarUrl()); embed.WithColor(new Color(R, G, B)); embed.WithDescription($"Given {target.Username} {EXP} EXP!"); await Context.Channel.SendMessageAsync("", false, embed); }