async def 침몰(self, ctx, shipName): serverShipInfo = ShipInfo(ctx.message.server.id) try: serverShipInfo.removeShip(shipName, ctx.message.author.id) await self.bot.say("{} 배를 터트렸어용".format(shipName)) except ShipNotExistError: await self.bot.say("해당 이름의 배가 존재하지 않아용")
async def 선원모집(self, ctx, *args): shipName = args[0] thumbUrl = None embedColor = None if (len(args) > 1): try: maxCrew = int(args[1]) if (maxCrew < 1): await self.bot.say("최소 1명 이상의 인원을 주세용") return except ValueError: await self.bot.say("최대인원은 정수로 주세용") return if (len(args) > 2): thumbUrl = args[2] if (len(args) > 3): try: embedColor = int(args[3], 16) except ValueError: await self.bot.say("색은 16진수로 주세용 ex)0xDEADBF") return serverShipInfo = ShipInfo(ctx.message.server.id) serverShipInfo.addOrModifyShip(shipName, ctx.message.author.id, maxCrew, thumbUrl, embedColor) em = await serverShipInfo.shipInfo(shipName, self.bot) await self.bot.send_message(ctx.message.channel, embed=em)
async def boardShip(self, ctx, shipName): serverShipInfo = ShipInfo(ctx.message.server.id) try: serverShipInfo.addCrew(shipName, ctx.message.author.id) em = await serverShipInfo.shipInfo(shipName, self.bot) await self.bot.send_message(ctx.message.channel, embed=em) except ShipNotExistError: await self.bot.say("해당 이름의 배가 존재하지 않아용")
async def 출항(self, ctx, shipName): serverShipInfo = ShipInfo(ctx.message.server.id) try: crewNum = serverShipInfo.depart(shipName, ctx.message.author.id) await self.bot.say("{}명의 용사와 함께 🚢{} 출항해용".format(crewNum, shipName)) except ShipNotExistError: await self.bot.say("해당 이름의 배가 존재하지 않아용") except CrewNotExistError: await self.bot.say("해당 배에 속해있지 않아용")
async def 탈주(self, ctx, shipName): serverShipInfo = ShipInfo(ctx.message.server.id) try: serverShipInfo.removeCrew(shipName, ctx.message.author.id) await self.bot.say("{}에서 탈주했어용".format(shipName)) except ShipNotExistError: await self.bot.say("해당 이름의 배가 존재하지 않아용") except CrewNotExistError: await self.bot.say("해당 배에 속해있지 않아용")
async def 배정보(self, ctx, shipName): serverShipInfo = ShipInfo(ctx.message.server.id) try: em = await serverShipInfo.shipInfo(shipName, self.bot) except ShipNotExistError: await self.bot.say("해당 이름의 배가 존재하지 않아용") await self.bot.send_message(ctx.message.channel, embed=em)
async def 배목록(self, ctx): serverShipInfo = ShipInfo(ctx.message.server.id) ships = serverShipInfo.allShips() if ships: await self.bot.say(ships)