basic-implementation #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "basic-implementation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -0,0 +38,4 @@
this.settingEvents();
});
}
I made a thing like this
The problem with this is for the usage inside the router.
I need to make a thing like this :
So I have again an async function inside my constructor, and to solved this I need to create the same pattern inside the router class.
And by extension i need to generalize this for my ImplementableAPI class. It's included to force all the users of the ImplementableAPI to make an Dependence Injection Pattern for their API. And it's look a little bit restrictive to me.
We could try maybe an events who's called at the the end of the constructor. (I took this idea from DiscordJS)
Like that we could imagine a thing like this :
With this, the restriction is to call the event 'ready' at the end of the constrctor's tasks. It's looking more friendly than the Dependency Injection for a beginner who would to make his own ImplementableAPI.
Ok, my bad. I think I missunderstanded the Dependency Injection. Sleep on it.
I'm going to try another thing.
I keep my DiscordParser Class with the instantiate method. And I 'm going to insert the created object inside an method in Router who could be named 'inject' or something in this idea. And who could take an ImplementableAPI instance in params.
@ -0,0 +75,4 @@
return {
ChannelPeerTube: resp.ChannelPeerTube,
ChannelYtb: resp.ChannelYtb,
};
So i keep a thing like this :
for the discordParser.ts file
And i custom the Router Class by adding the injectDepency(..) (Router.ts:34) method.
Now, we're needing to use the router like this :
Encore quelques changements et go pour merger !
@ -0,0 +32,4 @@
class DiscordParser extends ImplementableApi {
readonly botPrefix: string;
readonly channels: {
[key: string]: TextChannel;
Toujours utile ?
@ -0,0 +34,4 @@
readonly channels: {
[key: string]: TextChannel;
ChannelYtb: TextChannel;
ChannelPeerTube: TextChannel;
youtubeChannel
/peertubeChannel
comme nom@ -0,0 +109,4 @@
id_arr.push(resolvedChannel[key].id);
if (this.channels)
if (id_arr.includes(message.channel.id)) {
Je comprends pas la partie de ce code, il répond à quel cas d'utilisation ?
Sinon :
@ -0,0 +108,4 @@
}
const { access_token } = await response.json();
// Upload
Un commentaire ici, c'est compenser à mon sens un problème sémantique dans le code.
J'aurais tendance à faire deux fonctions privées
this.authenticate()
etthis.upload()
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Gitea.