-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage_ctx.py
87 lines (83 loc) · 2.87 KB
/
message_ctx.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#anti spam/cooldown
import discord
import random
random.seed()
from discord.ext import commands
bot = commands.Bot(command_prefix='$')
@bot.command()
async def test(ctx, arg):
await ctx.send(arg)
def nosharp(str1):
return str1.split("#")[0]
def name(author):
if(type(author) is discord.member.Member and author.nick != None):
return author.nick
return nosharp(str(author))
#
# def has_permission(member,permission):
#
# for role in member.roles:
# print(role.permissions.__getattribute__(permission))
# if role.permissions.__getattribute__(permission):
# return True
# return False
#
# def query(author):
# return
#
# async def message_function(m):
#
# ret_value = []
# if "j'ai faim" in(m.content.lower()):
# await m.channel.send("T'as perdu : " +name(m.author))
#
# if "bonjour" in(m.content.lower()):
# await m.channel.send("Bonjour " +name(m.author))
# if "bonne nuit" in(m.content.lower()) or "nenuit" in(m.content.lower()):
# x = random.randint(0,2)
# await m.channel.send(["Nenuit ","Bonne nuit ", "See you space cowboy" ][x]+ (name(m.author)) * (x<2))
#
# if "$victim" in (m.content.lower()):
# if has_permission(m.author,"move_members"):
# for k in m.mentions:
# await k.move_to(m.author.guild.get_channel(369161932730662922))
# else:
# await m.channel.send(name(m.author)+" tu n'as pas la permission")
# if "$kick" in (m.content.lower()):
# if has_permission(m.author,"move_members"):
# for k in m.mentions:
# await k.move_to()
# else:
# await m.channel.send(name(m.author)+" tu n'as pas la permission")
# # if "$mute" in (m.content.lower()):
# # if has_permission(m.author,"move_members"):
# # for k in m.mentions:
# # await k.move_to()
# # else:
# # await m.channel.send(name(m.author)+" tu n'as pas la permission")
#
#
# if "$dé" in(m.content):
#
# k=(m.content.split("$dé")[-1]).split("$")[0]
# rd = -1
# try:
# value = int(k)
#
# if value<=0:
# await m.channel.send("Les dés sont des entiers positifs")
# else:
# rd = random.randint(0,value-1)
# if((rd ==0 or rd ==9) and value ==10):
# rd2 = random.randint(0,value-1)
# rd = 10*rd+rd2
# if(rd>=95):
# await m.channel.send("Oh le critique de " + name(m.author))
# if(rd<5):
# await m.channel.send( "Cheh, critique de " + name(m.author))
# rd = "0"+str(rd)
# await m.channel.send( rd)
# except:
# await m.channel.send( "Les dés sont des entiers positifs")
#
# return 0