mirror-chatterino2/mocks/include/mocks/EmptyApplication.hpp
pajlada 9b31246502
feat: allow timeout-related commands to be used in multiple channels (#5402)
This changes the behaviour of the following commands:
 - `/ban`
 - `/timeout`
 - `/untimeout`
 - `/unban`

All of those commands now accept one or more `--channel` parameters to override which channel the action should take place in.
The `--channel` parameter accepts a channel ID or channel name with the same syntax as the other "user targets" do (e.g. `id:11148817` or `pajlada`)

examples
Ban user in the chat you're typing in:  
`/ban weeb123`

Ban user in the chat you're typing in, with a reason specified:  
`/ban weeb123 the ban reason`

Ban user in a separate chat, with a reason specified:  
`/ban --channel pajlada weeb123 the ban reason`

Ban user in two separate chats, with a reason specified:  
`/ban --channel pajlada --channel id:117166826 weeb123 the ban reason`


Timeout user in the chat you're typing in:  
`/timeout weeb123`

Timeout user in the chat you're typing in, with a reason specified:  
`/timeout weeb123 10m the timeout reason`

Timeout user in a separate chat, with a reason specified:  
`/timeout --channel pajlada weeb123 10m the timeout reason`

Timeout user in two separate chats, with a reason specified:  
`/timeout --channel pajlada --channel id:117166826 weeb123 10m the timeout reason`


Unban user in the chat you're typing in:  
`/unban weeb123`

Unban user in a separate chat:  
`/unban --channel pajlada weeb123`

Unban user in two separate chats:  
`/unban --channel pajlada --channel id:117166826 weeb123`
2024-06-16 12:22:51 +02:00

259 lines
6.4 KiB
C++

#pragma once
#include "Application.hpp"
#include "common/Args.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Updates.hpp"
#include <QTemporaryDir>
namespace chatterino::mock {
class EmptyApplication : public IApplication
{
public:
EmptyApplication()
: updates_(this->paths_)
{
}
virtual ~EmptyApplication() = default;
bool isTest() const override
{
return true;
}
const Paths &getPaths() override
{
return this->paths_;
}
const Args &getArgs() override
{
return this->args_;
}
Theme *getThemes() override
{
assert(
false &&
"EmptyApplication::getThemes was called without being initialized");
return nullptr;
}
Fonts *getFonts() override
{
assert(
false &&
"EmptyApplication::getFonts was called without being initialized");
return nullptr;
}
IEmotes *getEmotes() override
{
assert(
false &&
"EmptyApplication::getEmotes was called without being initialized");
return nullptr;
}
AccountController *getAccounts() override
{
assert(false && "EmptyApplication::getAccounts was called without "
"being initialized");
return nullptr;
}
HotkeyController *getHotkeys() override
{
assert(false && "EmptyApplication::getHotkeys was called without being "
"initialized");
return nullptr;
}
WindowManager *getWindows() override
{
assert(false && "EmptyApplication::getWindows was called without being "
"initialized");
return nullptr;
}
Toasts *getToasts() override
{
assert(
false &&
"EmptyApplication::getToasts was called without being initialized");
return nullptr;
}
CrashHandler *getCrashHandler() override
{
assert(false && "EmptyApplication::getCrashHandler was called without "
"being initialized");
return nullptr;
}
CommandController *getCommands() override
{
assert(false && "EmptyApplication::getCommands was called without "
"being initialized");
return nullptr;
}
NotificationController *getNotifications() override
{
assert(false && "EmptyApplication::getNotifications was called without "
"being initialized");
return nullptr;
}
HighlightController *getHighlights() override
{
assert(false && "EmptyApplication::getHighlights was called without "
"being initialized");
return nullptr;
}
ITwitchIrcServer *getTwitch() override
{
assert(
false &&
"EmptyApplication::getTwitch was called without being initialized");
return nullptr;
}
IAbstractIrcServer *getTwitchAbstract() override
{
assert(false && "EmptyApplication::getTwitchAbstract was called "
"without being initialized");
return nullptr;
}
PubSub *getTwitchPubSub() override
{
assert(false && "getTwitchPubSub was called without being initialized");
return nullptr;
}
TwitchBadges *getTwitchBadges() override
{
assert(false && "getTwitchBadges was called without being initialized");
return nullptr;
}
ILogging *getChatLogger() override
{
assert(!"getChatLogger was called without being initialized");
return nullptr;
}
IChatterinoBadges *getChatterinoBadges() override
{
assert(false && "EmptyApplication::getChatterinoBadges was called "
"without being initialized");
return nullptr;
}
FfzBadges *getFfzBadges() override
{
assert(false && "EmptyApplication::getFfzBadges was called without "
"being initialized");
return nullptr;
}
SeventvBadges *getSeventvBadges() override
{
assert(!"getSeventvBadges was called without being initialized");
return nullptr;
}
IUserDataController *getUserData() override
{
assert(false && "EmptyApplication::getUserData was called without "
"being initialized");
return nullptr;
}
ISoundController *getSound() override
{
assert(!"getSound was called without being initialized");
return nullptr;
}
ITwitchLiveController *getTwitchLiveController() override
{
assert(false && "EmptyApplication::getTwitchLiveController was called "
"without being initialized");
return nullptr;
}
ImageUploader *getImageUploader() override
{
assert(false && "EmptyApplication::getImageUploader was called without "
"being initialized");
return nullptr;
}
SeventvAPI *getSeventvAPI() override
{
return nullptr;
}
#ifdef CHATTERINO_HAVE_PLUGINS
PluginController *getPlugins() override
{
assert(false && "EmptyApplication::getPlugins was called without "
"being initialized");
return nullptr;
}
#endif
Updates &getUpdates() override
{
return this->updates_;
}
BttvEmotes *getBttvEmotes() override
{
assert(false && "EmptyApplication::getBttvEmotes was called without "
"being initialized");
return nullptr;
}
FfzEmotes *getFfzEmotes() override
{
assert(false && "EmptyApplication::getFfzEmotes was called without "
"being initialized");
return nullptr;
}
SeventvEmotes *getSeventvEmotes() override
{
assert(false && "EmptyApplication::getSeventvEmotes was called without "
"being initialized");
return nullptr;
}
ILinkResolver *getLinkResolver() override
{
assert(false && "EmptyApplication::getLinkResolver was called without "
"being initialized");
return nullptr;
}
IStreamerMode *getStreamerMode() override
{
assert(false && "EmptyApplication::getStreamerMode was called without "
"being initialized");
return nullptr;
}
protected:
QTemporaryDir settingsDir;
Paths paths_;
Args args_;
Updates updates_;
};
} // namespace chatterino::mock