@@ -104,6 +104,89 @@ public async Task ToggleLogWatchCommand()
104104 await _cc . Reply ( Context , embed ) ;
105105 }
106106
107+ [ Command ( "remove-achievement" , RunMode = RunMode . Async ) ]
108+ [ Alias ( "ra" ) ]
109+ [ RequireOwner ]
110+ public async Task RemoveAchieve ( long id )
111+ {
112+ using ( var db = new NinjaBotEntities ( ) )
113+ {
114+ var foundCheeve = db . FindWowCheeves . Where ( c => c . AchId == id ) . FirstOrDefault ( ) ;
115+ if ( foundCheeve != null )
116+ {
117+ db . Remove ( foundCheeve ) ;
118+ await db . SaveChangesAsync ( ) ;
119+ await _cc . Reply ( Context , $ "Removed achievement id { id } from the database!") ;
120+ }
121+ else
122+ {
123+ await _cc . Reply ( Context , $ "Sorry, unable to find achievement ID { id } in the database!") ;
124+ }
125+ }
126+ }
127+
128+ [ Command ( "add-achievement" , RunMode = RunMode . Async ) ]
129+ [ Alias ( "adda" ) ]
130+ [ RequireOwner ]
131+ public async Task AddAchieve ( long id , int cat )
132+ {
133+ using ( var db = new NinjaBotEntities ( ) )
134+ {
135+ var foundCheeve = db . FindWowCheeves . Where ( c => c . AchId == id ) ;
136+ if ( foundCheeve != null )
137+ {
138+ var category = db . AchCategories . Where ( c => c . CatId == cat ) . FirstOrDefault ( ) ;
139+ if ( category != null )
140+ {
141+ try
142+ {
143+ db . FindWowCheeves . Add ( new FindWowCheeve
144+ {
145+ AchId = id ,
146+ AchCategory = category
147+ } ) ;
148+ await db . SaveChangesAsync ( ) ;
149+ await _cc . Reply ( Context , $ "Added achievement ID { id } with category { category . CatName } to the database!") ;
150+ }
151+ catch ( Exception ex )
152+ {
153+ System . Console . WriteLine ( $ "{ ex . Message } ") ;
154+ }
155+ }
156+ else
157+ {
158+ await _cc . Reply ( Context , $ "Unable to find category with ID { cat } in the database!") ;
159+ }
160+
161+ }
162+ else
163+ {
164+ await _cc . Reply ( Context , $ "Sorry, achievement { id } already exists in the database!") ;
165+ }
166+ }
167+ }
168+
169+ [ Command ( "list-achievements" , RunMode = RunMode . Async ) ]
170+ [ Alias ( "la" ) ]
171+ [ RequireOwner ]
172+ public async Task ListCheeves ( )
173+ {
174+ StringBuilder sb = new StringBuilder ( ) ;
175+ List < FindWowCheeve > cheeves = new List < FindWowCheeve > ( ) ;
176+ using ( var db = new NinjaBotEntities ( ) )
177+ {
178+ cheeves = db . FindWowCheeves . ToList ( ) ;
179+ }
180+ if ( cheeves . Count > 0 )
181+ {
182+ foreach ( var cheeve in cheeves )
183+ {
184+ sb . AppendLine ( $ "{ cheeve . AchId } ") ;
185+ }
186+ }
187+ await _cc . Reply ( Context , sb . ToString ( ) ) ;
188+ }
189+
107190 [ Command ( "tu" , RunMode = RunMode . Async ) ]
108191 [ RequireOwner ]
109192 public async Task StartTimer ( )
@@ -156,7 +239,7 @@ public async Task ListWowDiscordServers()
156239 [ Command ( "ksm" , RunMode = RunMode . Async ) ]
157240 [ Summary ( "Check a character for the Keystone Master achievement" ) ]
158241 public async Task CheckKsm ( [ Remainder ] string args = null )
159- {
242+ {
160243 var charInfo = await GetCharFromArgs ( args , Context ) ;
161244 var sb = new StringBuilder ( ) ;
162245 var embed = new EmbedBuilder ( ) ;
@@ -194,7 +277,7 @@ public async Task CheckKsm([Remainder]string args = null)
194277 sb . AppendLine ( $ "**{ charAchievements . name } ** from **{ charAchievements . realm } ** has the Keystone Master achievement! :)") ;
195278 embed . WithColor ( new Color ( 0 , 255 , 0 ) ) ;
196279 }
197- embed . ThumbnailUrl = charAchievements . thumbnailURL ;
280+ embed . ThumbnailUrl = charAchievements . thumbnailURL ;
198281 }
199282 else
200283 {
0 commit comments