# Path: bot/games/models.py
# class Game(models.Model):
#     name = models.CharField(_('name'), max_length=255)
#     alias_for = models.ForeignKey('self', null=True, blank=True, on_delete=models.CASCADE)
# 
#     objects = GameQuerySet.as_manager()
# 
#     class Meta:
#         verbose_name = _('game')
#         verbose_name_plural = _('games')
# 
#     def __str__(self):
#         return self.name
# 
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self._old_alias_for_id = self.alias_for_id
# 
#     def clean(self):
#         if self.alias_for and self.alias_for.alias_for:
#             raise ValidationError(_("Aliases can only span one level"))
#         if self.alias_for and self.alias_for.name == self.name:
#             raise ValidationError(_("An alias must have a different name"))


from django.db.models.signals import post_save
from django.dispatch import receiver
from bot.games.models import Game



@receiver(post_save, sender=Game, dispatch_uid='bot.plugins.stats.signals.game_became_alias')
def game_became_alias(sender, raw=False, instance=None, created=False, **kwargs):
    if raw:

# Path: bot/games/models.py
# class Game(models.Model):
#     name = models.CharField(_('name'), max_length=255)
#     alias_for = models.ForeignKey('self', null=True, blank=True, on_delete=models.CASCADE)
# 
#     objects = GameQuerySet.as_manager()
# 
#     class Meta:
#         verbose_name = _('game')
#         verbose_name_plural = _('games')
# 
#     def __str__(self):
#         return self.name
# 
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self._old_alias_for_id = self.alias_for_id
# 
#     def clean(self):
#         if self.alias_for and self.alias_for.alias_for:
#             raise ValidationError(_("Aliases can only span one level"))
#         if self.alias_for and self.alias_for.name == self.name:
#             raise ValidationError(_("An alias must have a different name"))


# Path: bot/plugins/stats/signals.py
from django.db.models.signals import post_save
from django.dispatch import receiver
from bot.games.models import Game




@receiver(post_save, sender=Game, dispatch_uid='bot.plugins.stats.signals.game_became_alias')
def game_became_alias(sender, raw=False, instance=None, created=False, **kwargs):
    if raw:

        return