Telegram.pm 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. package Cpanel::iContact::Provider::Schema::Telegram;
  2. use strict;
  3. use warnings;
  4. # Name is always uc(MODULE)
  5. =encoding utf-8
  6. =head1 NAME
  7. Cpanel::iContact::Provider::Schema::Telegram - Schema for the Telegram iContact module
  8. =head1 SYNOPSIS
  9. use Cpanel::iContact::Provider::Schema::Telegram;
  10. my $settings = Cpanel::iContact::Provider::Schema::Telegram::get_settings();
  11. my $config = Cpanel::iContact::Provider::Schema::Telegram::get_config();
  12. =head1 DESCRIPTION
  13. Provide settings and configuration for the HipChat iContact module.
  14. =cut
  15. =head2 get_settings
  16. Provide config data for TweakSettings that will be saved in
  17. /etc/wwwacct.conf.shadow
  18. =over 2
  19. =item Input
  20. =over 3
  21. None
  22. =back
  23. =item Output
  24. =over 3
  25. A hashref that can be injected into Whostmgr::TweakSettings::Basic's %Conf
  26. with the additional help and label keys that are used in the display of the
  27. tweak settings.
  28. =back
  29. =back
  30. =cut
  31. sub get_settings {
  32. my $help = <<HALP;
  33. Telegram Bot Token: Token created for sending notifications to the bot you configured for sending cPanel & WHM Notifications to users in Telegram, separated by commas.
  34. <br>In order to create a token for your bot, please message the BotFather in Telegram and it will make one for you.
  35. HALP
  36. return {
  37. 'CONTACTTELEGRAM' => {
  38. 'name' => 'Telegram',
  39. 'shadow' => 1,
  40. 'type' => 'text',
  41. 'checkval' => sub {
  42. my $value = shift();
  43. $value =~ s/^\s+|\s+$//g; # Trim
  44. return $value if $value eq q{};
  45. if($value !~ m/^[0-9]+:[A-Z]{3}-[A-Z]{3}[A-Za-z0-9]+-[A-Za-z0-9]+$/ ) {
  46. die "Bogus value, neener neener";
  47. }
  48. return $value;
  49. },
  50. 'label' => 'Telegram Bot Token',
  51. 'help' => $help,
  52. }
  53. };
  54. }
  55. =head2 get_config
  56. Provide configuration for the module.
  57. =over 2
  58. =item Input
  59. =over 3
  60. None
  61. =back
  62. =item Output
  63. =over 3
  64. A hash ref containing the following key values:
  65. default_level: The iContact default contact level (All)
  66. display_name: The name displayed on the Contact Manager page in WHM.
  67. =back
  68. =back
  69. =cut
  70. sub get_config {
  71. return {
  72. 'default_level' => 'All',
  73. 'display_name' => 'Telegram',
  74. 'icon' =>
  75. 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22620%22%20height%3D%22620%22%20viewBox%3D%220%200%20620%20620%22%3E%3ClinearGradient%20id%3D%22a%22%20gradientUnits%3D%22userSpaceOnUse%22%20x1%3D%22311.167%22%20y1%3D%22603.333%22%20x2%3D%22311.167%22%20y2%3D%2219%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%231D93D2%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%2338B0E3%22%2F%3E%3C%2FlinearGradient%3E%3Ccircle%20fill%3D%22url%28%23a%29%22%20stroke%3D%22%23FFF%22%20stroke-width%3D%2228%22%20stroke-miterlimit%3D%2210%22%20cx%3D%22311.167%22%20cy%3D%22311.167%22%20r%3D%22292.167%22%2F%3E%3Cpath%20fill%3D%22%23C8DAEA%22%20d%3D%22M220.76%20338.848l35.362%2097.88s4.42%209.157%209.157%209.157%2075.146-73.252%2075.146-73.252l78.304-151.24-196.707%2092.197-1.264%2025.258z%22%2F%3E%3Cpath%20fill%3D%22%23A9C6D8%22%20d%3D%22M267.646%20363.95l-6.788%2072.146s-2.842%2022.102%2019.26%200%2043.257-39.152%2043.257-39.152%22%2F%3E%3Cpath%20fill%3D%22%23FFF%22%20d%3D%22M221.398%20342.34l-72.734-23.7s-8.683-3.526-5.894-11.525c.575-1.65%201.736-3.052%205.21-5.473%2016.12-11.234%20298.324-112.667%20298.324-112.667s7.97-2.683%2012.677-.898c2.153.816%203.527%201.737%204.685%205.104.42%201.226.663%203.83.63%206.42-.022%201.87-.252%203.6-.42%206.316-1.72%2027.732-53.145%20234.705-53.145%20234.705s-3.076%2012.113-14.103%2012.525c-4.02.15-8.9-.664-14.734-5.683-21.635-18.612-96.42-68.87-112.944-79.924-.93-.622-1.198-1.433-1.355-2.222-.233-1.165%201.034-2.61%201.034-2.61s130.217-115.75%20133.68-127.895c.268-.94-.74-1.405-2.105-1-8.65%203.183-158.58%2097.858-175.126%20108.313-.968.61-3.682.217-3.682.217z%22%2F%3E%3C%2Fsvg%3E',
  76. };
  77. }
  78. 1;