lunarflu HF Staff commited on
Commit
458d6f2
Β·
1 Parent(s): 65ace7e

[decorators] error messages and reacts, success reacts

Browse files
Files changed (1) hide show
  1. app.py +72 -45
app.py CHANGED
@@ -47,70 +47,97 @@ async def on_ready():
47
  # jojo
48
  @bot.command()
49
  async def jojo(ctx):
 
 
 
 
 
 
 
 
 
50
 
51
- if ctx.message.attachments:
52
- thread = await ctx.message.create_thread(name=f'{ctx.author} Jojo Thread...')
53
- await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...yare yare, daze ...')
54
-
55
- attachment = ctx.message.attachments[0]
56
- style = 'JoJo'
57
- im = jojogan.predict(attachment.url, style)
58
- #await ctx.message.reply(f'Here is the {style} version of it', file=discord.File(im))
59
-
60
- await thread.send(f'Here is the {style} version of it', file=discord.File(im))
61
- else:
62
- await ctx.message.reply("No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
63
-
64
  #----------------------------------------------------------------------------------------------------------------------------------------------
65
  # Disney
66
  @bot.command()
67
  async def disney(ctx):
 
 
 
 
 
 
 
 
68
 
69
- if ctx.message.attachments:
70
- thread = await ctx.message.create_thread(name=f'{ctx.author} Disney Thread... ')
71
- await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
72
-
73
- attachment = ctx.message.attachments[0]
74
- style = 'Disney'
75
- im = jojogan.predict(attachment.url, style)
76
-
77
- await thread.send(f'Here is the {style} version of it', file=discord.File(im))
78
- else:
79
- await ctx.message.reply("No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
80
 
81
  #----------------------------------------------------------------------------------------------------------------------------------------------
82
  # Spider-Verse
83
  @bot.command()
84
  async def spiderverse(ctx):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
- if ctx.message.attachments:
87
- thread = await ctx.message.create_thread(name=f'{ctx.author} Spider-Verse Thread... ')
88
- await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
89
-
90
- attachment = ctx.message.attachments[0]
91
- style = 'Spider-Verse'
92
- im = jojogan.predict(attachment.url, style)
93
 
94
- await thread.send(f'Here is the {style} version of it', file=discord.File(im))
95
- else:
96
- await ctx.message.reply("No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
97
 
98
  #----------------------------------------------------------------------------------------------------------------------------------------------
99
  # sketch
100
  @bot.command()
101
  async def sketch(ctx):
 
 
 
 
 
 
 
 
102
 
103
- if ctx.message.attachments:
104
- thread = await ctx.message.create_thread(name=f'{ctx.author} Sketch Thread... ')
105
- await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
106
-
107
- attachment = ctx.message.attachments[0]
108
- style = 'sketch'
109
- im = jojogan.predict(attachment.url, style)
110
-
111
- await thread.send(f'Here is the {style} version of it', file=discord.File(im))
112
- else:
113
- await ctx.message.reply("No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
114
  #----------------------------------------------------------------------------------------------------------------------------------------------
115
  # Stage 1
116
  @bot.command()
 
47
  # jojo
48
  @bot.command()
49
  async def jojo(ctx):
50
+ try:
51
+ if ctx.message.attachments:
52
+ thread = await ctx.message.create_thread(name=f'{ctx.author} Jojo Thread...')
53
+ await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...yare yare, daze ...')
54
+
55
+ attachment = ctx.message.attachments[0]
56
+ style = 'JoJo'
57
+ im = jojogan.predict(attachment.url, style)
58
+ #await ctx.message.reply(f'Here is the {style} version of it', file=discord.File(im))
59
 
60
+ await thread.send(f'Here is the {style} version of it', file=discord.File(im))
61
+ await ctx.message.add_reaction('πŸ‘')
62
+ else:
63
+ await ctx.message.reply("No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
64
+ await ctx.message.add_reaction('❌')
65
+ except Exception as e:
66
+ print(f"Error: {e}")
67
+ await ctx.reply('jojo error')
68
+ await ctx.message.add_reaction('❌')
 
 
 
 
69
  #----------------------------------------------------------------------------------------------------------------------------------------------
70
  # Disney
71
  @bot.command()
72
  async def disney(ctx):
73
+ try:
74
+ if ctx.message.attachments:
75
+ thread = await ctx.message.create_thread(name=f'{ctx.author} Disney Thread... ')
76
+ await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
77
+
78
+ attachment = ctx.message.attachments[0]
79
+ style = 'Disney'
80
+ im = jojogan.predict(attachment.url, style)
81
 
82
+ await thread.send(f'Here is the {style} version of it', file=discord.File(im))
83
+ await ctx.message.add_reaction('πŸ‘')
84
+ else:
85
+ await ctx.message.reply("No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
86
+ await ctx.message.add_reaction('❌')
87
+ except Exception as e:
88
+ print(f"Error: {e}")
89
+ await ctx.reply('disney error')
90
+ await ctx.message.add_reaction('❌')
91
+
92
+
93
 
94
  #----------------------------------------------------------------------------------------------------------------------------------------------
95
  # Spider-Verse
96
  @bot.command()
97
  async def spiderverse(ctx):
98
+ try:
99
+ if ctx.message.attachments:
100
+ thread = await ctx.message.create_thread(name=f'{ctx.author} Spider-Verse Thread... ')
101
+ await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
102
+
103
+ attachment = ctx.message.attachments[0]
104
+ style = 'Spider-Verse'
105
+ im = jojogan.predict(attachment.url, style)
106
+
107
+ await thread.send(f'Here is the {style} version of it', file=discord.File(im))
108
+ await ctx.message.add_reaction('πŸ‘')
109
+ else:
110
+ await ctx.message.reply("No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
111
+ await ctx.message.add_reaction('❌')
112
+ except Exception as e:
113
+ print(f"Error: {e}")
114
+ await ctx.reply('spiderverse error')
115
+ await ctx.message.add_reaction('❌')
116
 
 
 
 
 
 
 
 
117
 
 
 
 
118
 
119
  #----------------------------------------------------------------------------------------------------------------------------------------------
120
  # sketch
121
  @bot.command()
122
  async def sketch(ctx):
123
+ try:
124
+ if ctx.message.attachments:
125
+ thread = await ctx.message.create_thread(name=f'{ctx.author} Sketch Thread... ')
126
+ await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
127
+
128
+ attachment = ctx.message.attachments[0]
129
+ style = 'sketch'
130
+ im = jojogan.predict(attachment.url, style)
131
 
132
+ await thread.send(f'Here is the {style} version of it', file=discord.File(im))
133
+ await ctx.message.add_reaction('πŸ‘')
134
+ else:
135
+ await ctx.message.reply("No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
136
+ await ctx.message.add_reaction('❌')
137
+ except Exception as e:
138
+ print(f"Error: {e}")
139
+ await ctx.reply('sketch error')
140
+ await ctx.message.add_reaction('❌')
 
 
141
  #----------------------------------------------------------------------------------------------------------------------------------------------
142
  # Stage 1
143
  @bot.command()