Araeynn commited on
Commit
119ba54
·
verified ·
1 Parent(s): 24c8880

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -143,10 +143,36 @@ async def on_disconnect():
143
 
144
  @client.event
145
  async def on_message(message):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  for user in message.mentions:
147
  if user.bot:
148
  message.content = message.content.replace(f"<@{user.id}>",
149
  f"<@{str(user)}[bot]>")
 
 
 
150
  try:
151
  msgchannel = message.channel
152
  try:
 
143
 
144
  @client.event
145
  async def on_message(message):
146
+ if message.content == "--help":
147
+ def check(reaction, user):
148
+ return reaction.message.id == msg.id and user == msg.author #msg.id is the id of the embed sent by the bot.
149
+
150
+ page = 0
151
+ titles = ["hoi", "hoi2"]
152
+ pages = ["hi", "hi2"]
153
+ embed = discord.Embed(title=titles[page], description=pages[page]
154
+ msg = await message.reply(embed=embed)
155
+ while True:
156
+ try:
157
+ reaction, _ = await bot.wait_for('reaction_add', timeout= 20.0, check=check)
158
+ if reaction.emoji == '◀️' and page > 0:
159
+ page -= 1
160
+ embed = discord.Embed(title=titles[page], description=pages[page]
161
+ await msg.edit(embed=embed)
162
+ if reaction.emoji == '▶️' and page < len(pages) -1:
163
+ page += 1
164
+ embed = discord.Embed(title=titles[page], description= pages[page]
165
+ await msg.edit(embed=embed)
166
+ except asyncio.TimeoutError:
167
+ await msg.delete()
168
+ return 0
169
  for user in message.mentions:
170
  if user.bot:
171
  message.content = message.content.replace(f"<@{user.id}>",
172
  f"<@{str(user)}[bot]>")
173
+ else:
174
+ message.content = message.content.replace(f"<@{user.id}>",
175
+ f"<@{str(user)}>")
176
  try:
177
  msgchannel = message.channel
178
  try: