Araeynn commited on
Commit
11c0709
1 Parent(s): a9bb6db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -20
app.py CHANGED
@@ -157,11 +157,15 @@ The --setup command enables Lyre to communicate within a designated channel.
157
 
158
  ## Example
159
 
160
- --setup <#1194161958505676851>
 
 
161
 
162
  or
163
 
 
164
  --setup #general
 
165
 
166
  """
167
 
@@ -204,36 +208,43 @@ async def on_message(message):
204
  embed = discord.Embed(title="Error", description="Parameter `[channel]` is not in this guild. Use `--help` for command help.")
205
  await message.reply(embed=embed)
206
  return 0
207
- elif args[0].startswith("#"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  try:
209
- cname = args[0][1:]
210
  except:
211
  embed = discord.Embed(title="Error", description="Parameter `[channel]` invalid. Use `--help` for command help.")
212
  await message.reply(embed=embed)
213
  return 0
214
- try:
215
- c = discord.utils.get(client.get_all_channels(), guild__id=message.guild.id, name=cname)
216
- if c != None:
217
- with open(f"{guild_name}.guild", "a") as f:
218
- f.write(f"{c.id}\n")
219
- embed = discord.Embed(title="Success!", description=f"You can now chat with the bot in <#{c.id}>")
220
- message.reply(embed=embed)
221
- return 0
222
- else:
223
- embed = discord.Embed(title="Error", description="Parameter `[channel]` is not a valid channel in this guild. Use `--help` for command help.")
224
- message.reply(embed=embed)
225
- return 0
226
- except:
227
- embed = discord.Embed(title="Error", description="Parameter `[channel]` is not a valid channel in this guild. Use `--help` for command help.")
228
- message.reply(embed=embed)
229
  return 0
230
  else:
231
- embed = discord.Embed(title="Error", description="Parameter `[channel]` is not in valid forms. Use `--help` for command help.")
232
  await message.reply(embed=embed)
233
  return 0
234
 
235
 
236
-
237
  if message.content == "--help":
238
  def check(reaction, user):
239
  return reaction.message.id == msg.id and user == message.author
 
157
 
158
  ## Example
159
 
160
+ ```arduino
161
+ --setup <#1234567890123456789>
162
+ ```
163
 
164
  or
165
 
166
+ ```arduino
167
  --setup #general
168
+ ```
169
 
170
  """
171
 
 
208
  embed = discord.Embed(title="Error", description="Parameter `[channel]` is not in this guild. Use `--help` for command help.")
209
  await message.reply(embed=embed)
210
  return 0
211
+ else:
212
+ embed = discord.Embed(title="Error", description="Parameter `[channel]` is not in valid forms. Use `--help` for command help.")
213
+ await message.reply(embed=embed)
214
+ return 0
215
+ if message.content.startswith("--revoke"):
216
+ args = message.content.split()
217
+ del args[0]
218
+ if len(args) == 0:
219
+ embed = discord.Embed(title="Error", description="No args provided. Use `--help` for command help.")
220
+ await message.reply(embed=embed)
221
+ return 0
222
+ if args[0] == "":
223
+ embed = discord.Embed(title="Error", description="Parameter `[channel]` empty. Use `--help` for command help.")
224
+ await message.reply(embed=embed)
225
+ return 0
226
+ if args[0].startswith("<#") and args[0].endswith(">"):
227
  try:
228
+ cid = int(args[0][2:-1])
229
  except:
230
  embed = discord.Embed(title="Error", description="Parameter `[channel]` invalid. Use `--help` for command help.")
231
  await message.reply(embed=embed)
232
  return 0
233
+ with open(f"{guild_name}.guild", "r") as f:
234
+ k = f.read().split("\n")
235
+ if str(cid) in k:
236
+ k.remove(str(cid))
237
+ with open(f"{guild_name}.guild", "w") as f:
238
+ f.write("\n".join(k))
239
+ embed = discord.Embed(title="Success", description=f"Lyre is now unable to chat in {args[0]}")
240
+ await message.reply(embed=embed)
 
 
 
 
 
 
 
241
  return 0
242
  else:
243
+ embed = discord.Embed(title="Error", description="Parameter `[channel]` is not in valid forms, or does not exist. Use `--help` for command help.")
244
  await message.reply(embed=embed)
245
  return 0
246
 
247
 
 
248
  if message.content == "--help":
249
  def check(reaction, user):
250
  return reaction.message.id == msg.id and user == message.author