async def run(self): if not self.has_permission: return await self.not_permission() profil = ExistProfil(self.message.author.id) if Checkers(self.message.author.id).is_astreinte(): time_service = ( (__import__("time").time() - profil.end_service()) / 60) await self.message.channel.send( f"Fin de service pour <@{self.message.author.id}>") salaire = 0 # self.player.update_money((round(((1.5**1.1)*time_service-1.56), 2))) CP = 0 # (round((-0.5*salaire), 2)) if CP > 0: CP *= -1 profil.update_cp(CP) profil.add_service_time(time_service) await self.message.channel.send( f"<@{self.message.author.id}> - Pendant votre service, vous avez gagné {salaire} € et perdus {CP*-1} % de condition physique." ) else: if len(self.message.content.split()) > 1: if Checkers(self.message.author.id).is_cta( ) and self.message.content.split()[1] == "cta": cta = 1 else: cta = 0 else: cta = 0 profil.start_service(cta) if cta: await self.message.channel.send( f"Début de service au cta pour <@{self.message.author.id}>" ) else: await self.message.channel.send( f"Début de service pour <@{self.message.author.id}>")
async def run(self): if not self.has_permission : return await self.not_permission() try: target = int(self.message.content.split()[1]) except: return await self.error() target = ExistProfil(target) if Checkers(target.idd).is_astreinte(): ExistProfil(target.idd).end_service() await self.message.channel.send(f"Fin de service de <@{target.idd}>") else: ExistProfil(target.idd).start_service(0) await self.message.channel.send(f"Début de service de <@{target.idd}>")
async def speak(self): if self.message.channel.id != ExistProfil(self.message.author.id).location: return await self.error("Vous n'êtes pas dans le bon salon.") tph = ExistTph(self.message.author.id) if tph.frequency == "off": return await self.error("Votre tph est éteint.") chanfq = Frequency(tph.frequency).convertChannelsStringToChannelList().searchTph() chan_list = chanfq.channels chan_list.remove(self.message.channel.id) transmission = ' '.join(self.message.content.split(' ')[2:]) for chan in chan_list: wh = ExistWh(f"tph-{self.message.author.id}") await MessageSender(self.message, self.bot).wh( name = wh.name, avatar_url = wh.link, msg = f"[**{tph.frequency}**] > {transmission}", channel=self.message.guild.get_channel(int(chan)) ) await self.message.delete() await MessageSender(self.message, self.bot).wh( name = self.message.author.display_name, avatar_url=self.message.author.avatar_url, msg = f"**Se saisit de son tph et transmet un message** {transmission}" ) tph.refresh()
async def update(self): getter = Getters(self.message, self.bot) idd = getter.id name = getter.get_name() grade = getter.get_grade() poste = getter.get_poste() data = ExistProfil(getter.id) init = ProfilInit(idd, name, grade, poste, data.money, data.CP, data.location, data.service_time) await self.show()
async def show(self): getter = Getters(self.message, self.bot) data = ExistProfil(getter.id) self.string = '' for poste in data.poste: try: self.string += f"{postedb[int(poste)]}\n" except:continue embed=discord.Embed(title="Profil", color=0xff0000) embed.add_field(name="Nom:", value=f"{data.name}", inline=False) embed.add_field(name="Grade:", value=f"{gradeDB[data.grade]}", inline=False) if self.string != '': embed.add_field(name="Poste:", value=f"{self.string}", inline=False) embed.add_field(name="Argent:", value=f"{data.money} €", inline=False) embed.add_field(name="Condition Physique", value=f"{data.CP} %", inline=False) embed.set_thumbnail(url=f"{galonDB[data.grade]}") embed.set_footer(text=FOOTER) await self.message.channel.send(embed=embed)
async def run(self): if not self.has_permission: return await self.not_permission() self.player = ExistProfil(self.message.author.id) datas = Querry("SELECT * FROM service") cislist = " " ctalist = " " for data in datas: i, uid, name, starttime, cta = data member = self.message.guild.get_member(uid) name = member.display_name duringtime = time.time() - starttime minutes = int(duringtime / 60) hours = int(minutes / 60) minutes -= hours * 60 if cta: ctalist += f"• {name} en garde depuis `{hours} heure(s) et {minutes} minute(s)`\n" else: cislist += f"• {name} **|** {member.id} \n Durée de service : `{hours} heure(s) et {minutes} minute(s)`\n\n" embedcta = discord.Embed(description=f"{ctalist}", color=0xb3ff00) embedcta.set_author( name="Tableau de garde CTA 34", icon_url= "https://www.pompiercenter.com/images/sdis/logos/34logo_Logo-Herault-sapeurs-pompiers-rvb-coul%20-%20Copie.jpg" ) embedcta.set_footer(text=FOOTER) embedcis = discord.Embed(description=f"{cislist}", color=0xff0000) embedcis.set_author( name="Tableau de garde CSP Sète", icon_url= "https://www.radioone.fr/upload/news/main/5ec7c8f918faa4.67062370.JPG?=1617323441" ) embedcis.set_footer(text=FOOTER) await self.message.channel.send(embed=embedcta) await self.message.channel.send(embed=embedcis)
async def alert(self): try: intervention = ExistIntervention(self.message.content.split()[2]) intervention.cembed() except: return await self.error("Intervention introuvable") await self.channel.send(embed=intervention.embed_ticket) msg = await self.channel.send(embed=intervention.embed_will_alerted) await msg.add_reaction("✅") def check(reaction, user): return user == self.message.author and str(reaction.emoji) == '✅' reaction, user = await self.bot.wait_for('reaction_add', timeout=60.0, check=check) ville = { "s": 705087219592986735, "f": 705089353990275183, "bb": 705089462576873622, "bv": 705090448385114132, "b": 705090482891653181, "p": 705090522401865769 } def check(m): return m.author == self.message.author and m.channel == self.channel await self.channel.send("Sur quelle ville est l'intervention ?\n\ ```\ns -> Sète\nf -> Frontignan\nbb -> Balaruc les b.\nbv -> Balaruc le v.\nb -> Bouzigues\np -> Poussan```" ) msg = await self.bot.wait_for('message', check=check) intervention.save_city(int(ville[str(msg.content[0].lower())])) cat = discord.utils.get(self.message.guild.categories, id=int(ville[str( msg.content.split()[0].lower())])) chan = await self.message.guild.create_text_channel( f"{intervention.num}-{intervention.motif}", category=cat) intervention.save_chan(chan.id) for uid in intervention.to_alert: try: player = self.message.guild.get_member(uid) await player.add_roles( self.message.guild.get_role(705542846035263500)) u = self.bot.get_user(uid) try: ExistProfil(uid).end_service() except: pass await u.send( f"Vous êtes alerté sur l'intervention {intervention.num}") except: pass wh = ExistWh("cta") await MessageSender(self.message, self.bot).whe( wh.name, wh.link, intervention.embed_ticket, self.message.guild.get_channel(705094420843724870)) await MessageSender(self.message, self.bot).wh( wh.name, wh.link, f"<@&705542846035263500>", self.message.guild.get_channel(705094420843724870))
async def take(self): if self.message.channel.id == 705094420843724870 and not self.has_tph: tph = TphInit(self.message.author.id, int(__import__("time").time()+60*60), "off") WhInit(f"tph-{self.message.author.id}",f"tph-{self.message.author.display_name}", str(galonDB[ExistProfil(tph.id_owner).grade])) wh = ExistWh(f"tph-{self.message.author.id}") ms = MessageSender(self.message, self.bot) await ms.wh( name = self.message.author.display_name, avatar_url=self.message.author.avatar_url, msg = "**Récupère un tph**" ) await ms.wh( name = wh.name, avatar_url=wh.link, msg = "<:tph:833842597679857675> | Vous avez récupéré un TPH, faites `!tph frequency` pour l'allumer" ) elif self.has_tph: return await self.error("Vous avez déjà un TPH.") else: return await self.error("Il n'y a aucun tph à récupérer ici.") await self.message.delete()