Skip to content

Commit

Permalink
dices! (updated NuGet package too)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elepover committed Apr 6, 2020
1 parent 5cbfcef commit 0e3016a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
63 changes: 35 additions & 28 deletions pmcenter/BotCommands/InfoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,80 +18,87 @@ public async Task<bool> ExecuteAsync(TelegramBotClient botClient, Update update)
{
return false;
}
var targetMessage = update.Message.ReplyToMessage;
var sb = new StringBuilder("ℹ *Message Info*\n📩 *Sender*: [");
if (Vars.CurrentConf.UseUsernameInMsgInfo)
{
sb.Append(update.Message.ReplyToMessage.ForwardFrom.FirstName);
sb.Append(targetMessage.ForwardFrom.FirstName);
sb.Append(" ");
sb.Append(update.Message.ReplyToMessage.ForwardFrom.LastName);
sb.Append(targetMessage.ForwardFrom.LastName);
}
else
{
sb.Append("Here");
}
sb.Append("](tg://user?id=");
sb.Append(update.Message.ReplyToMessage.ForwardFrom.Id);
sb.Append(targetMessage.ForwardFrom.Id);
sb.Append(")\n👤 User ID: `");
sb.Append(update.Message.ReplyToMessage.ForwardFrom.Id);
sb.Append(targetMessage.ForwardFrom.Id);
sb.Append("`\n🌐 Language: `");
sb.Append(update.Message.ReplyToMessage.ForwardFrom.LanguageCode);
sb.Append(targetMessage.ForwardFrom.LanguageCode);
sb.Append("`\n⌚ Forward Time: `");
sb.Append(update.Message.ReplyToMessage.ForwardDate.ToString());
sb.Append(targetMessage.ForwardDate.ToString());
sb.Append("`\n🆔 Message ID: `");
sb.Append(update.Message.ReplyToMessage.MessageId);
sb.Append(targetMessage.MessageId);
sb.Append("`");

sb.Append("\n\n➕ *Additional Info*");
sb.Append("\n📼 Message Type: " + update.Message.ReplyToMessage.Type.ToString());
if (update.Message.ReplyToMessage.Document != null)
sb.Append("\n📼 Message Type: " + targetMessage.Type.ToString());
if (targetMessage.Document != null)
{
sb.Append("\n📛 File Name: `");
sb.Append(update.Message.ReplyToMessage.Document.FileName);
sb.Append(targetMessage.Document.FileName);
sb.Append("`\n📄 File ID: `");
sb.Append(update.Message.ReplyToMessage.Document.FileId);
sb.Append(targetMessage.Document.FileId);
sb.Append("`\n🗜 File Size: `");
sb.Append(update.Message.ReplyToMessage.Document.FileSize);
sb.Append(targetMessage.Document.FileSize);
sb.Append("`\n📖 MIME Type: `");
sb.Append(update.Message.ReplyToMessage.Document.MimeType);
sb.Append(targetMessage.Document.MimeType);
sb.Append("`");
}
else if (update.Message.ReplyToMessage.Location != null)
else if (targetMessage.Location != null)
{
sb.Append("\n🌐 Latitude: `");
sb.Append(update.Message.ReplyToMessage.Location.Latitude);
sb.Append(targetMessage.Location.Latitude);
sb.Append("`\n🌐 Longitude: `");
sb.Append(update.Message.ReplyToMessage.Location.Longitude);
sb.Append(targetMessage.Location.Longitude);
sb.Append("`");
}
else if (update.Message.ReplyToMessage.Sticker != null)
else if (targetMessage.Sticker != null)
{
sb.Append("\n😶 Emoji: `");
sb.Append(update.Message.ReplyToMessage.Sticker.Emoji);
sb.Append(targetMessage.Sticker.Emoji);
sb.Append("`\n📄 File ID: `");
sb.Append(update.Message.ReplyToMessage.Sticker.FileId);
sb.Append(targetMessage.Sticker.FileId);
sb.Append("`");
}
else if (update.Message.ReplyToMessage.Audio != null)
else if (targetMessage.Audio != null)
{
sb.Append("\n📄 File ID: `");
sb.Append(update.Message.ReplyToMessage.Audio.FileId);
sb.Append(targetMessage.Audio.FileId);
sb.Append("`\n🗜 File Size: `");
sb.Append(update.Message.ReplyToMessage.Audio.FileSize);
sb.Append(targetMessage.Audio.FileSize);
sb.Append("`\n📖 MIME Type: `");
sb.Append(update.Message.ReplyToMessage.Audio.MimeType);
sb.Append(targetMessage.Audio.MimeType);
sb.Append("`\n⏳ Duration(secs): `");
sb.Append(update.Message.ReplyToMessage.Audio.Duration);
sb.Append(targetMessage.Audio.Duration);
sb.Append("`");
}
else if (update.Message.ReplyToMessage.Photo != null)
else if (targetMessage.Photo != null)
{
sb.Append("\n📄 File ID: `");
sb.Append(update.Message.ReplyToMessage.Photo[0].FileId);
sb.Append(targetMessage.Photo[0].FileId);
sb.Append("`\n🗜 File Size: `");
sb.Append(update.Message.ReplyToMessage.Photo[0].FileSize);
sb.Append(targetMessage.Photo[0].FileSize);
sb.Append("`");
}
sb.Append("\n\n_Additional information is available for a limited set of message types, including: Audios, Documents(Files), Locations, Photos and Stickers._");
else if (targetMessage.Dice != null)
{
sb.Append("\n🎲 Dice: `");
sb.Append(targetMessage.Dice.Value);
sb.Append("`");
}
sb.Append("\n\n_Additional information is available for a limited set of message types, including: Audios, Documents(Files), Dices, Locations, Photos and Stickers._");

_ = await botClient.SendTextMessageAsync(
update.Message.From.Id,
Expand Down
2 changes: 1 addition & 1 deletion pmcenter/pmcenter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="HttpToSocks5Proxy" Version="1.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Telegram.Bot" Version="15.2.1" />
<PackageReference Include="Telegram.Bot" Version="15.5.1" />
</ItemGroup>

</Project>

1 comment on commit 0e3016a

@Elepover
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to issue #27, master issue: #25

Please sign in to comment.