Fix
Fix d'une activation non demander
This commit is contained in:
parent
4eba8ebeee
commit
fd8cc58501
1 changed files with 30 additions and 30 deletions
|
@ -3,9 +3,9 @@ from discord.ext import commands
|
||||||
|
|
||||||
#Paramètres
|
#Paramètres
|
||||||
|
|
||||||
deletion_minimal = -2 #quantité de votes totale nécessaire
|
deletion_minimal = -2 #quantité de votes totale nécessaire
|
||||||
#pour supprimer un post.
|
#pour supprimer un post.
|
||||||
#Prends en compte le nombre de votes
|
#Prends en compte le nombre de votes
|
||||||
#pour le conserver et pour le supprimer.
|
#pour le conserver et pour le supprimer.
|
||||||
delet_symbole = "🗑" #Réaction permettant la suppression du post.
|
delet_symbole = "🗑" #Réaction permettant la suppression du post.
|
||||||
cons_symbole = "♻" #Réaction permettant la conservation du post.
|
cons_symbole = "♻" #Réaction permettant la conservation du post.
|
||||||
|
@ -42,8 +42,8 @@ async def first_reaction(self , reaction , user):
|
||||||
elif reaction.emoji == cons_symbole:
|
elif reaction.emoji == cons_symbole:
|
||||||
reactDict[reaction.message.id]=1
|
reactDict[reaction.message.id]=1
|
||||||
date,heure = timeCorrect(reaction.message.timestamp)
|
date,heure = timeCorrect(reaction.message.timestamp)
|
||||||
|
|
||||||
|
|
||||||
message = str(reaction.message.author.mention)+" a recut un vote pour la suppression ou la conservation de son message du "+str(reaction.message.timestamp)+".Si vous souhaitez voir son message supprimé, votez "+delet_symbole+". Si vous pensez que son message est correct, votez "+str(cons_symbole)+"."
|
message = str(reaction.message.author.mention)+" a recut un vote pour la suppression ou la conservation de son message du "+str(reaction.message.timestamp)+".Si vous souhaitez voir son message supprimé, votez "+delet_symbole+". Si vous pensez que son message est correct, votez "+str(cons_symbole)+"."
|
||||||
m = await self.bot.send_message(reaction.message.channel,message)
|
m = await self.bot.send_message(reaction.message.channel,message)
|
||||||
messageDict[reaction.message.id]=m
|
messageDict[reaction.message.id]=m
|
||||||
|
@ -58,13 +58,13 @@ async def delete(self , reaction , user):
|
||||||
def timeCorrect(temps):
|
def timeCorrect(temps):
|
||||||
date = "5"
|
date = "5"
|
||||||
heure = "6"
|
heure = "6"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return date,heure
|
return date,heure
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Ben:
|
class Ben:
|
||||||
|
@ -73,8 +73,8 @@ class Ben:
|
||||||
f = open("log_test.txt","a") #Montres le début de l'enregistrement dans les logs.
|
f = open("log_test.txt","a") #Montres le début de l'enregistrement dans les logs.
|
||||||
f.write("\n\nDébut de l'enregistrement des réactions.\n\n\n")
|
f.write("\n\nDébut de l'enregistrement des réactions.\n\n\n")
|
||||||
f.close
|
f.close
|
||||||
|
|
||||||
|
|
||||||
async def on_reaction_remove(self,reaction,user):#Récupères la réaction
|
async def on_reaction_remove(self,reaction,user):#Récupères la réaction
|
||||||
print("-"+str(reaction.emoji)) #si on retire une réaction.
|
print("-"+str(reaction.emoji)) #si on retire une réaction.
|
||||||
print(reaction.count)
|
print(reaction.count)
|
||||||
|
@ -82,24 +82,24 @@ class Ben:
|
||||||
print(reaction.message.id)
|
print(reaction.message.id)
|
||||||
if str(reaction.emoji) == cons_symbole: #Vérifie si le caractère
|
if str(reaction.emoji) == cons_symbole: #Vérifie si le caractère
|
||||||
reactDict[reaction.message.id]-=1 #corresponds au symbole
|
reactDict[reaction.message.id]-=1 #corresponds au symbole
|
||||||
elif str(reaction.emoji) == delet_symbole: #de suppression
|
elif str(reaction.emoji) == delet_symbole: #de suppression
|
||||||
reactDict[reaction.message.id]+=1
|
reactDict[reaction.message.id]+=1
|
||||||
#ou au symbole de conservation.
|
#ou au symbole de conservation.
|
||||||
print("num = "+str(reactDict[reaction.message.id]))
|
print("num = "+str(reactDict[reaction.message.id]))
|
||||||
if reactDict[reaction.message.id]==deletion_minimal:
|
if reactDict[reaction.message.id]==deletion_minimal:
|
||||||
await delete(self , reaction , user) #si le
|
await delete(self , reaction , user) #si le
|
||||||
#nombre est
|
#nombre est
|
||||||
#suppérieur,
|
#suppérieur,
|
||||||
#suppression.
|
#suppression.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#def auto_deletion(self,Message):
|
#def auto_deletion(self,Message):
|
||||||
# await self.bot.delete_message(Message)
|
# await self.bot.delete_message(Message)
|
||||||
# print(Message.content)
|
# print(Message.content)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def on_reaction_add(self, reaction, user): #Récupères la réaction
|
async def on_reaction_add(self, reaction, user): #Récupères la réaction
|
||||||
print("+"+str(reaction.emoji)) #si on ajoute une réaction.
|
print("+"+str(reaction.emoji)) #si on ajoute une réaction.
|
||||||
|
@ -108,31 +108,31 @@ class Ben:
|
||||||
print(reaction.message.id)
|
print(reaction.message.id)
|
||||||
if anti_delete(reaction.message.author.id)== True:
|
if anti_delete(reaction.message.author.id)== True:
|
||||||
print("message autorise")
|
print("message autorise")
|
||||||
if str(reaction.emoji) <= cons_symbole:
|
if str(reaction.emoji) == cons_symbole:
|
||||||
if reactDict.get(reaction.message.id)!=None:
|
if reactDict.get(reaction.message.id)!=None:
|
||||||
reactDict[reaction.message.id]+=1
|
reactDict[reaction.message.id]+=1
|
||||||
print("message present")
|
print("message present")
|
||||||
else:
|
else:
|
||||||
await first_reaction(self,reaction,user)
|
await first_reaction(self,reaction,user)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if str(reaction.emoji) == delet_symbole:
|
if str(reaction.emoji) == delet_symbole:
|
||||||
if reactDict.get(reaction.message.id)!=None:
|
if reactDict.get(reaction.message.id)!=None:
|
||||||
reactDict[reaction.message.id]-=1
|
reactDict[reaction.message.id]-=1
|
||||||
print("message present")
|
print("message present")
|
||||||
else:
|
else:
|
||||||
await first_reaction(self,reaction,user)
|
await first_reaction(self,reaction,user)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if reactDict.get(reaction.message.id) != None :
|
if reactDict.get(reaction.message.id) != None :
|
||||||
if reactDict[reaction.message.id]<=deletion_minimal:
|
if reactDict[reaction.message.id]<=deletion_minimal:
|
||||||
await delete(self , reaction , user)
|
await delete(self , reaction , user)
|
||||||
else:
|
else:
|
||||||
print(reactDict[reaction.message.id])
|
print(reactDict[reaction.message.id])
|
||||||
|
|
||||||
print("tzdsqdzqs"+str(reactDict[reaction.message.id]))
|
print("tzdsqdzqs"+str(reactDict[reaction.message.id]))
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(Ben(bot))
|
bot.add_cog(Ben(bot))
|
||||||
|
|
Reference in a new issue