def _transfer_casino(self, ctx, user: discord.Member, chips: int):
"""Transfers chips to another player"""
author = ctx.message.author
settings = super().check_server_settings(author.server)
chip_name = settings["System Config"]["Chip Name"]
limit = settings["System Config"]["Transfer Limit"]
if not super().membership_exists(author):
return await self.bot.say("{} is not registered to the casino.".format(author.name))
if not super().membership_exists(user):
return await self.bot.say("{} is not registered to the casino.".format(user.name))
if chips > limit:
return await self.bot.say(_("Your transfer cannot exceed the server limit of {} {} "
"chips.").format(limit, chip_name))
chip_name = settings["System Config"]["Chip Name"]
cooldown = self.check_cooldowns(user, "Transfer", settings, triggered=True)
if not cooldown:
try:
super().transfer_chips(author, user, chips)
except NegativeChips:
return await self.bot.say(_("An amount cannot be negative."))
except SameSenderAndReceiver:
return await self.bot.say(_("Sender and Reciever cannot be the same."))
except BotNotAUser:
return await self.bot.say(_("You can send chips to a bot."))
except InsufficientChips:
return await self.bot.say(_("Not enough chips to transfer."))
else:
logger.info("{}({}) transferred {} {} to {}({}).".format(author.name, author.id,
chip_name, chips,
user.name, user.id))
await self.bot.say(_("{} transferred {} {} to {}.").format(author.name, chip_name,
chips, user.name))
else:
await self.bot.say(cooldown)
评论列表
文章目录