fix minor bugs in various plugins
- FriendsSince: Don't show for friend requests - FakeNitro: Fix attempting to bypass unicode emojis #2503 - MessageLatency: ignore bots #2504 - CtrlEnterSend: use cmd+enter on macOS #2502 - ReplaceGoogleSearch: trim LF character #2488 Co-authored-by: AutumnVN <autumnvnchino@gmail.com> Co-authored-by: rushiiMachine <33725716+rushiiMachine@users.noreply.github.com> Co-authored-by: Lumap <lumap@duck.com> Co-authored-by: Mylloon <kennel.anri@tutanota.com>
This commit is contained in:
parent
4f2c2b8e4a
commit
c836270320
|
@ -18,7 +18,7 @@ export default definePlugin({
|
||||||
type: OptionType.SELECT,
|
type: OptionType.SELECT,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "Ctrl+Enter (Enter or Shift+Enter for new line)",
|
label: "Ctrl+Enter (Enter or Shift+Enter for new line) (cmd+enter on macOS)",
|
||||||
value: "ctrl+enter"
|
value: "ctrl+enter"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ export default definePlugin({
|
||||||
result = event.shiftKey;
|
result = event.shiftKey;
|
||||||
break;
|
break;
|
||||||
case "ctrl+enter":
|
case "ctrl+enter":
|
||||||
result = event.ctrlKey;
|
result = navigator.platform.includes("Mac") ? event.metaKey : event.ctrlKey;
|
||||||
break;
|
break;
|
||||||
case "enter":
|
case "enter":
|
||||||
result = !event.shiftKey && !event.ctrlKey;
|
result = !event.shiftKey && !event.ctrlKey;
|
||||||
|
|
|
@ -813,7 +813,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
canUseEmote(e: Emoji, channelId: string) {
|
canUseEmote(e: Emoji, channelId: string) {
|
||||||
if (e.type === "UNICODE") return true;
|
if (e.type === 0) return true;
|
||||||
if (e.available === false) return false;
|
if (e.available === false) return false;
|
||||||
|
|
||||||
const isUnusableRoleSubEmoji = RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmojiOriginal ?? RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmoji;
|
const isUnusableRoleSubEmoji = RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmojiOriginal ?? RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmoji;
|
||||||
|
|
|
@ -52,6 +52,8 @@ export default definePlugin({
|
||||||
|
|
||||||
getFriendSince(userId: string) {
|
getFriendSince(userId: string) {
|
||||||
try {
|
try {
|
||||||
|
if (!RelationshipStore.isFriend(userId)) return null;
|
||||||
|
|
||||||
return RelationshipStore.getSince(userId);
|
return RelationshipStore.getSince(userId);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
new Logger("FriendsSince").error(err);
|
new Logger("FriendsSince").error(err);
|
||||||
|
@ -60,6 +62,8 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
friendsSince: ErrorBoundary.wrap(({ userId, textClassName }: { userId: string; textClassName?: string; }) => {
|
friendsSince: ErrorBoundary.wrap(({ userId, textClassName }: { userId: string; textClassName?: string; }) => {
|
||||||
|
if (!RelationshipStore.isFriend(userId)) return null;
|
||||||
|
|
||||||
const friendsSince = RelationshipStore.getSince(userId);
|
const friendsSince = RelationshipStore.getSince(userId);
|
||||||
if (!friendsSince) return null;
|
if (!friendsSince) return null;
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,9 @@ export default definePlugin({
|
||||||
// Message wasn't received through gateway
|
// Message wasn't received through gateway
|
||||||
if (!isNonNullish(nonce)) return null;
|
if (!isNonNullish(nonce)) return null;
|
||||||
|
|
||||||
|
// Bots basically never send a nonce, and if someone does do it then it's usually not a snowflake
|
||||||
|
if (message.bot) return null;
|
||||||
|
|
||||||
let isDiscordKotlin = false;
|
let isDiscordKotlin = false;
|
||||||
let delta = SnowflakeUtils.extractTimestamp(id) - SnowflakeUtils.extractTimestamp(nonce); // milliseconds
|
let delta = SnowflakeUtils.extractTimestamp(id) - SnowflakeUtils.extractTimestamp(nonce); // milliseconds
|
||||||
if (!showMillis) {
|
if (!showMillis) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ const settings = definePluginSettings({
|
||||||
});
|
});
|
||||||
|
|
||||||
function search(src: string, engine: string) {
|
function search(src: string, engine: string) {
|
||||||
open(engine + encodeURIComponent(src), "_blank");
|
open(engine + encodeURIComponent(src.trim()), "_blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeSearchItem(src: string) {
|
function makeSearchItem(src: string) {
|
||||||
|
|
4
src/webpack/common/types/stores.d.ts
vendored
4
src/webpack/common/types/stores.d.ts
vendored
|
@ -63,7 +63,7 @@ export interface CustomEmoji {
|
||||||
originalName?: string;
|
originalName?: string;
|
||||||
require_colons: boolean;
|
require_colons: boolean;
|
||||||
roles: string[];
|
roles: string[];
|
||||||
type: "GUILD_EMOJI";
|
type: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UnicodeEmoji {
|
export interface UnicodeEmoji {
|
||||||
|
@ -75,7 +75,7 @@ export interface UnicodeEmoji {
|
||||||
};
|
};
|
||||||
index: number;
|
index: number;
|
||||||
surrogates: string;
|
surrogates: string;
|
||||||
type: "UNICODE";
|
type: 0;
|
||||||
uniqueName: string;
|
uniqueName: string;
|
||||||
useSpriteSheet: boolean;
|
useSpriteSheet: boolean;
|
||||||
get allNamesString(): string;
|
get allNamesString(): string;
|
||||||
|
|
Loading…
Reference in a new issue