-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjigglyBot.py
156 lines (123 loc) · 4.75 KB
/
jigglyBot.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import discord
import random
import os
from discord.ext import commands, tasks
import time
from itertools import cycle
client = commands.Bot(command_prefix = '*')
status = cycle(['I am cute'])
#Reaction Roles
reaction_title=""
reactions={}
reaction_message_id=""
@client.command(name="reaction_create_post")
async def reaction_create_post(ctx):
embed=discord.Embed(title="Create Reaction Post",color=0x8cc542)
embed.set_author(name="JigglyMod Bot")
embed.add_field(name="Set Title", value="*reaction_set_title \"New Title\"",inline=False)
embed.add_field(name="Add Role", value="*reaction_add_role @Role EMOJI",inline=False)
embed.add_field(name="Remove Role", value="*reaction_remove_role @Role",inline=False)
embed.add_field(name="Send Creation Post", value="*reaction_send_post",inline=False)
await ctx.send(embed=embed)
await ctx.message.delete()
@client.command(name="reaction_set_title")
async def reaction_set_title(ctx,new_title):
global reaction_title
reaction_title = new_title
await ctx.send("The title for the message is now '"+reaction_title+"'!")
await ctx.message.delete()
@client.command(name="reaction_add_role")
async def reaction_add_role(ctx, role: discord.Role, reaction):
if role != None:
reactions[role.name]=reaction
await ctx.send("Role '"+ role.name +"' has been added with emoji"+ reaction)
await ctx.message.delete()
else:
await ctx.send("Please try again")
print(reactions)
@client.command(name="reaction_remove_role")
async def reaction_remove_role(ctx, role: discord.Role, reaction):
if role.name in reactions:
del reactions[role.name]
await ctx.send("Role '"+ role.name +"' has been removed")
await ctx.message,delete()
else:
await ctx.send("That role was not added")
print(reactions)
@client.command(name="reaction_send_post")
async def reaction_send_post(ctx):
description = "React to add the Roles!\n"
for role in reactions:
description +="'"+role+"' -" + reactions[role]+"\n"
embed = discord.Embed(title=reaction_title, description = description, color=0x8cc542)
embed.set_author(name="JigglyMod Bot")
message = await ctx.send(embed=embed)
global reaction_message_id
reaction_message_id=str(message.id)
for role in reactions:
await message.add_reaction(reactions[role])
await ctx.message.delete()
@client.event
async def on_reaction_add(reaction, user):
if not user.bot:
message=reaction.message
if str(message.id)==reaction_message_id:
#add roles to users
role_to_give=""
for role in reactions:
if reactions[role]== reaction.emoji:
role_to_give = role
role_for_reaction = discord.utils.get(user.guild.roles,name=role_to_give)
await user.add_roles(role_for_reaction)
#Status + Online
#Status
@client.event
async def on_ready():
change_status.start()
#await client.change_presence(status=discord.Status.idle,activity=discord.Game('Simping Lina'))
print("Bot is Online")
#Changing Status every 10s
@tasks.loop(seconds=5)
async def change_status():
await client.change_presence(activity=discord.Game(next(status)))
#Error if command not found
@client.event
async def on_command_error(ctx,error):
resp=["Not a valid command."]
if isinstance(error,commands.CommandNotFound):
await ctx.send(random.choice(resp))
#Only those with permissions can use the following
@commands.has_permissions(manage_messages=True)
#Clears Texts
@client.command()
async def clear(ctx, amount:int):
await ctx.send(f"Clearing {amount} message(s)")
time.sleep(0.79)
await ctx.channel.purge(limit=amount+2)
#Error message if incorrect clear command
@clear.error
async def clear_error(ctx,error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Please specify number of texts')
#pin message
@client.event
async def on_message(message, channel="instagram-ids"):
if "instagram.com" in message.content:
await message.pin()
await client.process_commands(message)
'''
@client.event
async def on_message(message):
args = message.content.split(" ")[1:]
print(args)
msg = await message.channel.fetch_message(int(messageID))
if ("instagram.com" in args):
'''
client.run('NzgwNDI0NTU1NTU4NzMxNzg2.X7u5AQ.Pxk4fUg7CMT5YQADcvGtrRsqqsA')
#Upvote downvote Reactions
'''
@client.event
async def on_message(message):
if discord.File.endswith('jpg') in message.content:
await message.add_reaction('\U0001F44D')
'''