-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Veeit/main
Add apple typos
- Loading branch information
Showing
3 changed files
with
26 additions
and
15 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
Sources/SwiftDEBot/Command/Message Commands/TypoCommand.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import DiscordBM | ||
import Foundation | ||
|
||
struct TypoCommand: MessageCommand { | ||
let helpText = "Hilft bei der Korrektur von Tippfehlern in Nachrichten." | ||
|
||
let trigger: [String: [String]] = [ | ||
"iPhone": ["Iphone", "ipPhone", "IPhone", "IFöhn"], | ||
"iPad": ["IPad", "Ipad"], | ||
"Xcode": ["XCode", "xCode"] | ||
] | ||
|
||
func run(client: DiscordClient, message: Gateway.MessageCreate) async throws { | ||
let content = message.content | ||
|
||
for (correctWord, typos) in trigger { | ||
if typos.contains(where: content.contains), | ||
let handle = message.author?.mentionHandle { | ||
try await client.send("Psst \(handle), das schreibt sich \(correctWord).", to: message.channel_id) | ||
break | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters