src/Entity/Telegram/AgentPublicBot/Bot.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Telegram\AgentPublicBot;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Domains\Domain;
  5. use App\Entity\Generic\User;
  6. use App\Entity\SubTransactions\ArzDigital;
  7. use App\Entity\VPN\Service\Service;
  8. use App\Repository\Telegram\AgentPublicBot\BotRepository;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\DBAL\Types\Types;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  14. #[ORM\Entity(repositoryClassBotRepository::class)]
  15. class Bot extends BaseEntity
  16. {
  17.     #[ORM\Id]
  18.     #[ORM\Column(type'guid'uniquetrue)]
  19.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  20.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  21.     private ?string $id null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $title null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $token null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $ownerUserId null;
  28.     #[ORM\ManyToOne(inversedBy'bots')]
  29.     #[ORM\JoinColumn(nullablefalse)]
  30.     private ?User $owner null;
  31.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  32.     private ?string $description null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $cardNumber null;
  35.     #[ORM\Column]
  36.     private ?bool $forceJoinChannel null;
  37.     #[ORM\Column(length255nullabletrue)]
  38.     private ?string $channelUserNAme null;
  39.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotPlan::class)]
  40.     private Collection $botPlans;
  41.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotUser::class)]
  42.     private Collection $botUsers;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $supportUsername null;
  45.     #[ORM\ManyToOne(inversedBy'bots')]
  46.     private ?Domain $domain null;
  47.     #[ORM\Column(length255nullabletrue)]
  48.     private ?string $logo null;
  49.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotTransaction::class)]
  50.     private Collection $botTransactions;
  51.     #[ORM\Column(nullabletrue)]
  52.     private ?int $channelMembers null;
  53.     #[ORM\Column(nullabletrue)]
  54.     private ?int $botServices null;
  55.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  56.     private ?string $welcomeMessage null;
  57.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  58.     private ?string $thanksMessage null;
  59.     #[ORM\Column]
  60.     private ?bool $allowTest null;
  61.     #[ORM\Column(nullabletrue)]
  62.     private ?int $offPercent null;
  63.     #[ORM\Column(length255nullabletrue)]
  64.     private ?string $walletAddress null;
  65.     #[ORM\Column(typeTypes::BIGINTnullabletrue)]
  66.     private ?string $minimumCardToCard null;
  67.     #[ORM\OneToMany(mappedBy'creatorBot'targetEntityService::class)]
  68.     private Collection $services;
  69.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotCampaign::class)]
  70.     private Collection $botCampaigns;
  71.     #[ORM\Column]
  72.     private ?bool $isBotForWebsite null;
  73.     #[ORM\OneToMany(mappedBy'bot'targetEntityArzDigital::class)]
  74.     private Collection $arzDigitals;
  75.     #[ORM\Column]
  76.     private ?bool $sentAutoMessages null;
  77.     #[ORM\Column(nullabletrue)]
  78.     private ?int $usersCount null;
  79.     #[ORM\Column(nullabletrue)]
  80.     private ?int $servicesCount null;
  81.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotNotification::class)]
  82.     private Collection $botNotifications;
  83.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  84.     private ?string $adsNotTestedMessage null;
  85.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  86.     private ?string $adsNotBoughtMessage null;
  87.     #[ORM\OneToMany(mappedBy'bot'targetEntityBotAnalytics::class)]
  88.     private Collection $botAnalytics;
  89.     public function __toString():string
  90.     {
  91.         return  $this->getTitle();
  92.     }
  93.     public function __construct()
  94.     {
  95.         $this->setIsBotForWebsite(0);
  96.         parent::__construct();
  97.         $this->setForceJoinChannel(0);
  98.         $this->botPlans = new ArrayCollection();
  99.         $this->botUsers = new ArrayCollection();
  100.         $this->botTransactions = new ArrayCollection();
  101.         $this->setAllowTest(0);
  102.         $this->services = new ArrayCollection();
  103.         $this->botCampaigns = new ArrayCollection();
  104.         $this->arzDigitals = new ArrayCollection();
  105.         $this->setSentAutoMessages(0);
  106.         $this->botNotifications = new ArrayCollection();
  107.         $this->botAnalytics = new ArrayCollection();
  108.     }
  109.     public function usersCount():int
  110.     {
  111.         return count($this->getBotUsers());
  112.     }
  113.     public function getId(): ?string
  114.     {
  115.         return $this->id;
  116.     }
  117.     public function getTitle(): ?string
  118.     {
  119.         return $this->title;
  120.     }
  121.     public function setTitle(string $title): static
  122.     {
  123.         $this->title $title;
  124.         return $this;
  125.     }
  126.     public function getToken(): ?string
  127.     {
  128.         return $this->token;
  129.     }
  130.     public function setToken(string $token): static
  131.     {
  132.         $this->token $token;
  133.         return $this;
  134.     }
  135.     public function getOwnerUserId(): ?string
  136.     {
  137.         return $this->ownerUserId;
  138.     }
  139.     public function setOwnerUserId(?string $ownerUserId): static
  140.     {
  141.         $this->ownerUserId $ownerUserId;
  142.         return $this;
  143.     }
  144.     public function getOwner(): ?User
  145.     {
  146.         return $this->owner;
  147.     }
  148.     public function setOwner(?User $owner): static
  149.     {
  150.         $this->owner $owner;
  151.         return $this;
  152.     }
  153.     public function getDescription(): ?string
  154.     {
  155.         return $this->description;
  156.     }
  157.     public function setDescription(?string $description): static
  158.     {
  159.         $this->description $description;
  160.         return $this;
  161.     }
  162.     public function getCardNumber(): ?string
  163.     {
  164.         return $this->cardNumber;
  165.     }
  166.     public function setCardNumber(?string $cardNumber): static
  167.     {
  168.         $this->cardNumber $cardNumber;
  169.         return $this;
  170.     }
  171.     public function isForceJoinChannel(): ?bool
  172.     {
  173.         return $this->forceJoinChannel;
  174.     }
  175.     public function setForceJoinChannel(bool $forceJoinChannel): static
  176.     {
  177.         $this->forceJoinChannel $forceJoinChannel;
  178.         return $this;
  179.     }
  180.     public function getChannelUserNAme(): ?string
  181.     {
  182.         return $this->channelUserNAme;
  183.     }
  184.     public function setChannelUserNAme(?string $channelUserNAme): static
  185.     {
  186.         $this->channelUserNAme $channelUserNAme;
  187.         return $this;
  188.     }
  189.     /**
  190.      * @return Collection<int, BotPlan>
  191.      */
  192.     public function getBotPlans(): Collection
  193.     {
  194.         return $this->botPlans;
  195.     }
  196.     public function addBotPlan(BotPlan $botPlan): static
  197.     {
  198.         if (!$this->botPlans->contains($botPlan)) {
  199.             $this->botPlans->add($botPlan);
  200.             $botPlan->setBot($this);
  201.         }
  202.         return $this;
  203.     }
  204.     public function removeBotPlan(BotPlan $botPlan): static
  205.     {
  206.         if ($this->botPlans->removeElement($botPlan)) {
  207.             // set the owning side to null (unless already changed)
  208.             if ($botPlan->getBot() === $this) {
  209.                 $botPlan->setBot(null);
  210.             }
  211.         }
  212.         return $this;
  213.     }
  214.     /**
  215.      * @return Collection<int, BotUser>
  216.      */
  217.     public function getBotUsers(): Collection
  218.     {
  219.         return $this->botUsers;
  220.     }
  221.     public function addBotUser(BotUser $botUser): static
  222.     {
  223.         if (!$this->botUsers->contains($botUser)) {
  224.             $this->botUsers->add($botUser);
  225.             $botUser->setBot($this);
  226.         }
  227.         return $this;
  228.     }
  229.     public function removeBotUser(BotUser $botUser): static
  230.     {
  231.         if ($this->botUsers->removeElement($botUser)) {
  232.             // set the owning side to null (unless already changed)
  233.             if ($botUser->getBot() === $this) {
  234.                 $botUser->setBot(null);
  235.             }
  236.         }
  237.         return $this;
  238.     }
  239.     public function getSupportUsername(): ?string
  240.     {
  241.         return $this->supportUsername;
  242.     }
  243.     public function setSupportUsername(?string $supportUsername): static
  244.     {
  245.         $this->supportUsername $supportUsername;
  246.         return $this;
  247.     }
  248.     public function getDomain(): ?Domain
  249.     {
  250.         return $this->domain;
  251.     }
  252.     public function setDomain(?Domain $domain): static
  253.     {
  254.         $this->domain $domain;
  255.         return $this;
  256.     }
  257.     public function getLogo(): ?string
  258.     {
  259.         return $this->logo;
  260.     }
  261.     public function setLogo(string $logo): static
  262.     {
  263.         $this->logo $logo;
  264.         return $this;
  265.     }
  266.     /**
  267.      * @return Collection<int, BotTransaction>
  268.      */
  269.     public function getBotTransactions(): Collection
  270.     {
  271.         return $this->botTransactions;
  272.     }
  273.     public function addBotTransaction(BotTransaction $botTransaction): static
  274.     {
  275.         if (!$this->botTransactions->contains($botTransaction)) {
  276.             $this->botTransactions->add($botTransaction);
  277.             $botTransaction->setBot($this);
  278.         }
  279.         return $this;
  280.     }
  281.     public function removeBotTransaction(BotTransaction $botTransaction): static
  282.     {
  283.         if ($this->botTransactions->removeElement($botTransaction)) {
  284.             // set the owning side to null (unless already changed)
  285.             if ($botTransaction->getBot() === $this) {
  286.                 $botTransaction->setBot(null);
  287.             }
  288.         }
  289.         return $this;
  290.     }
  291.     public function getChannelMembers(): ?int
  292.     {
  293.         return $this->channelMembers;
  294.     }
  295.     public function setChannelMembers(?int $channelMembers): static
  296.     {
  297.         $this->channelMembers $channelMembers;
  298.         return $this;
  299.     }
  300.     public function getBotServices(): ?int
  301.     {
  302.         return $this->botServices;
  303.     }
  304.     public function setBotServices(?int $botServices): static
  305.     {
  306.         $this->botServices $botServices;
  307.         return $this;
  308.     }
  309.     public function getWelcomeMessage(): ?string
  310.     {
  311.         if (!$this->welcomeMessage){
  312.             return  'به فروشگاه ما خوش اومدی ❤️
  313. 🛜 سازگار با تمام اپراتورهای اینترنت
  314. 📲 مناسب تمام گوشی‌ها و سیستم‌ها
  315. 👨‍💻 پشتیبانی ۲۴ ساعته تا آخرین روز
  316. ⭐️ کیفیت خیلی بالا و قیمت‌های پایین'.PHP_EOL;
  317.         }
  318.         return $this->welcomeMessage;
  319.     }
  320.     public function setWelcomeMessage(?string $welcomeMessage): static
  321.     {
  322.         $this->welcomeMessage $welcomeMessage;
  323.         return $this;
  324.     }
  325.     public function getThanksMessage(): ?string
  326.     {
  327.         return $this->thanksMessage;
  328.     }
  329.     public function setThanksMessage(?string $thanksMessage): static
  330.     {
  331.         $this->thanksMessage $thanksMessage;
  332.         return $this;
  333.     }
  334.     public function isAllowTest(): ?bool
  335.     {
  336.         return $this->allowTest;
  337.     }
  338.     public function setAllowTest(bool $allowTest): static
  339.     {
  340.         $this->allowTest $allowTest;
  341.         return $this;
  342.     }
  343.     public function getOffPercent(): ?int
  344.     {
  345.         return $this->offPercent;
  346.     }
  347.     public function setOffPercent(?int $offPercent): static
  348.     {
  349.         $this->offPercent $offPercent;
  350.         return $this;
  351.     }
  352.     public function getWalletAddress(): ?string
  353.     {
  354.         return $this->walletAddress;
  355.     }
  356.     public function setWalletAddress(?string $walletAddress): static
  357.     {
  358.         $this->walletAddress $walletAddress;
  359.         return $this;
  360.     }
  361. //
  362. //    /**
  363. //     * @return Collection<int, BotChargeTransactions>
  364. //     */
  365. //    public function getBotChargeTransactions(): Collection
  366. //    {
  367. //        return $this->botChargeTransactions;
  368. //    }
  369. //
  370. //    public function addBotChargeTransaction(BotChargeTransactions $botChargeTransaction): static
  371. //    {
  372. //        if (!$this->botChargeTransactions->contains($botChargeTransaction)) {
  373. //            $this->botChargeTransactions->add($botChargeTransaction);
  374. //            $botChargeTransaction->setBot($this);
  375. //        }
  376. //
  377. //        return $this;
  378. //    }
  379. //
  380. //    public function removeBotChargeTransaction(BotChargeTransactions $botChargeTransaction): static
  381. //    {
  382. //        if ($this->botChargeTransactions->removeElement($botChargeTransaction)) {
  383. //            // set the owning side to null (unless already changed)
  384. //            if ($botChargeTransaction->getBot() === $this) {
  385. //                $botChargeTransaction->setBot(null);
  386. //            }
  387. //        }
  388. //
  389. //        return $this;
  390. //    }
  391.     public function getMinimumCardToCard(): ?string
  392.     {
  393.         return $this->minimumCardToCard;
  394.     }
  395.     public function setMinimumCardToCard(?string $minimumCardToCard): static
  396.     {
  397.         $this->minimumCardToCard $minimumCardToCard;
  398.         return $this;
  399.     }
  400.     /**
  401.      * @return Collection<int, Service>
  402.      */
  403.     public function getServices(): Collection
  404.     {
  405.         return $this->services;
  406.     }
  407.     public function addService(Service $service): static
  408.     {
  409.         if (!$this->services->contains($service)) {
  410.             $this->services->add($service);
  411.             $service->setCreatorBot($this);
  412.         }
  413.         return $this;
  414.     }
  415.     public function removeService(Service $service): static
  416.     {
  417.         if ($this->services->removeElement($service)) {
  418.             // set the owning side to null (unless already changed)
  419.             if ($service->getCreatorBot() === $this) {
  420.                 $service->setCreatorBot(null);
  421.             }
  422.         }
  423.         return $this;
  424.     }
  425.     /**
  426.      * @return Collection<int, BotCampaign>
  427.      */
  428.     public function getBotCampaigns(): Collection
  429.     {
  430.         return $this->botCampaigns;
  431.     }
  432.     public function addBotCampaign(BotCampaign $botCampaign): static
  433.     {
  434.         if (!$this->botCampaigns->contains($botCampaign)) {
  435.             $this->botCampaigns->add($botCampaign);
  436.             $botCampaign->setBot($this);
  437.         }
  438.         return $this;
  439.     }
  440.     public function removeBotCampaign(BotCampaign $botCampaign): static
  441.     {
  442.         if ($this->botCampaigns->removeElement($botCampaign)) {
  443.             // set the owning side to null (unless already changed)
  444.             if ($botCampaign->getBot() === $this) {
  445.                 $botCampaign->setBot(null);
  446.             }
  447.         }
  448.         return $this;
  449.     }
  450.     public function isIsBotForWebsite(): ?bool
  451.     {
  452.         return $this->isBotForWebsite;
  453.     }
  454.     public function setIsBotForWebsite(bool $isBotForWebsite): static
  455.     {
  456.         $this->isBotForWebsite $isBotForWebsite;
  457.         return $this;
  458.     }
  459.     /**
  460.      * @return Collection<int, ArzDigital>
  461.      */
  462.     public function getArzDigitals(): Collection
  463.     {
  464.         return $this->arzDigitals;
  465.     }
  466.     public function addArzDigital(ArzDigital $arzDigital): static
  467.     {
  468.         if (!$this->arzDigitals->contains($arzDigital)) {
  469.             $this->arzDigitals->add($arzDigital);
  470.             $arzDigital->setBot($this);
  471.         }
  472.         return $this;
  473.     }
  474.     public function removeArzDigital(ArzDigital $arzDigital): static
  475.     {
  476.         if ($this->arzDigitals->removeElement($arzDigital)) {
  477.             // set the owning side to null (unless already changed)
  478.             if ($arzDigital->getBot() === $this) {
  479.                 $arzDigital->setBot(null);
  480.             }
  481.         }
  482.         return $this;
  483.     }
  484.     public function isSentAutoMessages(): ?bool
  485.     {
  486.         return $this->sentAutoMessages;
  487.     }
  488.     public function setSentAutoMessages(bool $sentAutoMessages): static
  489.     {
  490.         $this->sentAutoMessages $sentAutoMessages;
  491.         return $this;
  492.     }
  493.     public function getUsersCount(): ?int
  494.     {
  495.         return $this->usersCount;
  496.     }
  497.     public function setUsersCount(?int $usersCount): static
  498.     {
  499.         $this->usersCount $usersCount;
  500.         return $this;
  501.     }
  502.     public function getServicesCount(): ?int
  503.     {
  504.         return $this->servicesCount;
  505.     }
  506.     public function setServicesCount(?int $servicesCount): static
  507.     {
  508.         $this->servicesCount $servicesCount;
  509.         return $this;
  510.     }
  511.     /**
  512.      * @return Collection<int, BotNotification>
  513.      */
  514.     public function getBotNotifications(): Collection
  515.     {
  516.         return $this->botNotifications;
  517.     }
  518.     public function addBotNotification(BotNotification $botNotification): static
  519.     {
  520.         if (!$this->botNotifications->contains($botNotification)) {
  521.             $this->botNotifications->add($botNotification);
  522.             $botNotification->setBot($this);
  523.         }
  524.         return $this;
  525.     }
  526.     public function removeBotNotification(BotNotification $botNotification): static
  527.     {
  528.         if ($this->botNotifications->removeElement($botNotification)) {
  529.             // set the owning side to null (unless already changed)
  530.             if ($botNotification->getBot() === $this) {
  531.                 $botNotification->setBot(null);
  532.             }
  533.         }
  534.         return $this;
  535.     }
  536.     public function getAdsNotTestedMessage(): ?string
  537.     {
  538.         return $this->adsNotTestedMessage;
  539.     }
  540.     public function setAdsNotTestedMessage(?string $adsNotTestedMessage): static
  541.     {
  542.         $this->adsNotTestedMessage $adsNotTestedMessage;
  543.         return $this;
  544.     }
  545.     public function getAdsNotBoughtMessage(): ?string
  546.     {
  547.         return $this->adsNotBoughtMessage;
  548.     }
  549.     public function setAdsNotBoughtMessage(?string $adsNotBoughtMessage): static
  550.     {
  551.         $this->adsNotBoughtMessage $adsNotBoughtMessage;
  552.         return $this;
  553.     }
  554.     /**
  555.      * @return Collection<int, BotAnalytics>
  556.      */
  557.     public function getBotAnalytics(): Collection
  558.     {
  559.         return $this->botAnalytics;
  560.     }
  561.     public function addBotAnalytic(BotAnalytics $botAnalytic): static
  562.     {
  563.         if (!$this->botAnalytics->contains($botAnalytic)) {
  564.             $this->botAnalytics->add($botAnalytic);
  565.             $botAnalytic->setBot($this);
  566.         }
  567.         return $this;
  568.     }
  569.     public function removeBotAnalytic(BotAnalytics $botAnalytic): static
  570.     {
  571.         if ($this->botAnalytics->removeElement($botAnalytic)) {
  572.             // set the owning side to null (unless already changed)
  573.             if ($botAnalytic->getBot() === $this) {
  574.                 $botAnalytic->setBot(null);
  575.             }
  576.         }
  577.         return $this;
  578.     }
  579. }